analytics/docker-compose.yml
Jake Howard ff9e4b444b
Create the admin user as a separate command (#233)
This means the migrations can always be run on startup, meaning the database won't get out of sync with the running application. It also means users who don't set the credential variables in their compose files don't keep creating admin users every time the application starts.
2020-07-28 14:11:02 +03:00

76 lines
1.8 KiB
YAML

# NOTE:
# This Docker-compose file is created as a sample and should not be used directly for production
# You can adjust the settings as-per your environment
version: "3.3"
services:
# As it says, this service is a fake smtp server which accepts SMTP connections
# the inbox is available at localhost:8025, in actuality, you need to use a proper smtp server
fake_smtp:
image: mailhog/mailhog:v1.0.0
ports:
- 1025:1025
- 8025:8025
healthcheck:
test: echo | telnet 127.0.0.1 1025
plausible_db:
image: postgres:12
command: ["postgres", "-c", "log_statement=all", "-c", "log_destination=stderr"]
volumes:
- db-data:/var/lib/postgresql/data
environment:
- POSTGRES_PASSWORD=postgres
- POSTGRES_DB=plausible_db
- POSTGRES_USER=postgres
ports:
- 5432:5432
plausible_events_db:
image: yandex/clickhouse-server:latest
volumes:
- event-data:/var/lib/clickhouse
ports:
- 8123:8123
plausible:
build:
context: .
dockerfile: ./Dockerfile
command: sh -c "sleep 10 && /entrypoint.sh db migrate && /entrypoint.sh run"
depends_on:
- plausible_db
- plausible_events_db
- fake_smtp
ports:
- 80:8080
links:
- plausible_db
- plausible_events_db
- fake_smtp
env_file:
- plausible-variables.sample.env
setup:
build:
context: .
dockerfile: ./Dockerfile
command: sh -c "sleep 10 && /entrypoint.sh db createdb && /entrypoint.sh db migrate && /entrypoint.sh db init-admin"
depends_on:
- plausible_db
- plausible_events_db
links:
- plausible_db
- plausible_events_db
env_file:
- plausible-variables.sample.env
volumes:
db-data:
driver: local
event-data:
driver: local