11# See https://docs.flagsmith.com/deployment/docker for more information on running Flagsmith in Docker
22# This Docker Compose file will run the entire Flagsmith Platform
33
4+ x-flagsmith-env : &flagsmith-env
5+ # All environments variables are available here:
6+ # API: https://docs.flagsmith.com/deployment/locally-api#environment-variables
7+ # UI: https://docs.flagsmith.com/deployment/locally-frontend#environment-variables
8+
9+ DATABASE_URL : postgresql://postgres:password@postgres:5432/flagsmith
10+ USE_POSTGRES_FOR_ANALYTICS : ' true' # Store API and Flag Analytics data in Postgres
11+ ENVIRONMENT : production # set to 'production' in production.
12+ DJANGO_ALLOWED_HOSTS : ' *' # Change this in production
13+ FLAGSMITH_DOMAIN : localhost:8000 # Change this in production
14+ DJANGO_SECRET_KEY : secret # Change this in production
15+ # PREVENT_SIGNUP: 'true' # Uncomment to prevent any additional signups
16+ # ALLOW_REGISTRATION_WITHOUT_INVITE: 'true' # Uncomment and set to false to only allow signups via invitations
17+
18+ # Enable Task Processor
19+ TASK_RUN_METHOD : TASK_PROCESSOR # other options are: SYNCHRONOUSLY, SEPARATE_THREAD (default)
20+ PROMETHEUS_ENABLED : ' true'
21+
22+ # Uncomment if you want to enable Google OAuth. Note this does not turn Google OAuth on. You still need to use
23+ # Flagsmith on Flagsmith to enable it - https://docs.flagsmith.com/deployment/#oauth_google
24+ # DJANGO_SECURE_CROSS_ORIGIN_OPENER_POLICY: 'same-origin-allow-popups'
25+
26+ # For more info on configuring E-Mails - https://docs.flagsmith.com/deployment/locally-api#environment-variables
27+ # Example SMTP:
28+ # EMAIL_BACKEND: django.core.mail.backends.smtp.EmailBackend
29+ # EMAIL_HOST: mail.example.com
30+ # SENDER_EMAIL: flagsmith@example.com
31+ # EMAIL_HOST_USER: flagsmith@example.com
32+ # EMAIL_HOST_PASSWORD: smtp_account_password
33+ # EMAIL_PORT: 587 # optional
34+ # EMAIL_USE_TLS: 'true' # optional
35+
436volumes :
537 pgdata :
638
@@ -20,57 +52,39 @@ services:
2052 retries : 20
2153 start_period : 20s
2254
23- flagsmith :
55+ migrate-db :
2456 image : docker.flagsmith.com/flagsmith/flagsmith:latest
57+ command :
58+ - migrate
2559 environment :
26- # All environments variables are available here:
27- # API: https://docs.flagsmith.com/deployment/locally-api#environment-variables
28- # UI: https://docs.flagsmith.com/deployment/locally-frontend#environment-variables
29-
30- DATABASE_URL : postgresql://postgres:password@postgres:5432/flagsmith
31- USE_POSTGRES_FOR_ANALYTICS : ' true' # Store API and Flag Analytics data in Postgres
32-
33- ENVIRONMENT : production # set to 'production' in production.
34- DJANGO_ALLOWED_HOSTS : ' *' # Change this in production
35- FLAGSMITH_DOMAIN : localhost:8000 # Change this in production
36- DJANGO_SECRET_KEY : secret # Change this in production
37- # PREVENT_SIGNUP: 'true' # Uncomment to prevent any additional signups
38- # ALLOW_REGISTRATION_WITHOUT_INVITE: 'true' # Uncomment and set to false to only allow signups via invitations
39-
40- # Enable Task Processor
41- TASK_RUN_METHOD : TASK_PROCESSOR # other options are: SYNCHRONOUSLY, SEPARATE_THREAD (default)
42- PROMETHEUS_ENABLED : ' true'
43-
44- # Uncomment if you want to enable Google OAuth. Note this does not turn Google OAuth on. You still need to use
45- # Flagsmith on Flagsmith to enable it - https://docs.flagsmith.com/deployment/#oauth_google
46- # DJANGO_SECURE_CROSS_ORIGIN_OPENER_POLICY: 'same-origin-allow-popups'
60+ << : *flagsmith-env
61+ healthcheck :
62+ disable : true
63+ depends_on :
64+ postgres :
65+ condition : service_healthy
4766
48- # For more info on configuring E-Mails - https://docs.flagsmith.com/deployment/locally-api#environment-variables
49- # Example SMTP:
50- # EMAIL_BACKEND: django.core.mail.backends.smtp.EmailBackend
51- # EMAIL_HOST: mail.example.com
52- # SENDER_EMAIL: flagsmith@example.com
53- # EMAIL_HOST_USER: flagsmith@example.com
54- # EMAIL_HOST_PASSWORD: smtp_account_password
55- # EMAIL_PORT: 587 # optional
56- # EMAIL_USE_TLS: 'true' # optional
67+ flagsmith :
68+ image : docker.flagsmith.com/flagsmith/flagsmith:latest
69+ command :
70+ - serve
71+ environment :
72+ << : *flagsmith-env
5773 ports :
5874 - 8000:8000
5975 depends_on :
60- postgres :
61- condition : service_healthy
76+ migrate-db :
77+ condition : service_completed_successfully
6278
6379 # The flagsmith_processor service is only needed if TASK_RUN_METHOD set to TASK_PROCESSOR
6480 # in the application environment
6581 flagsmith-task-processor :
6682 image : docker.flagsmith.com/flagsmith/flagsmith:latest
6783 environment :
68- DATABASE_URL : postgresql://postgres:password@postgres:5432/flagsmith
69- USE_POSTGRES_FOR_ANALYTICS : ' true'
70- DJANGO_ALLOWED_HOSTS : ' *'
71- PROMETHEUS_ENABLED : ' true'
84+ << : *flagsmith-env
7285 ports :
7386 - 8001:8000
7487 depends_on :
75- - flagsmith
88+ migrate-db :
89+ condition : service_completed_successfully
7690 command : run-task-processor
0 commit comments