dallinger/docker/docker-compose.yml.j2
services:
postgresql:
image: postgres:12
environment:
POSTGRES_USER: dallinger
POSTGRES_PASSWORD: dallinger
POSTGRES_DB: dallinger
volumes:
- dallinger_{{ experiment_name }}_pg_data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U $${POSTGRES_USER}"]
interval: 2s
timeout: 5s
ports:
# bots might need to communicate with postgresql
- "5432:5432"
redis:
image: redis
command: redis-server --appendonly yes
volumes:
- dallinger_{{ experiment_name }}_redis_data:/data
healthcheck:
test: "[ $$(redis-cli ping) = 'PONG' ]"
interval: 2s
timeout: 1s
ports:
# bots might need to communicate with redis
- "6379:6379"
worker:
image: {{ experiment_image }}
command: dallinger_heroku_worker
depends_on:
postgresql:
condition: service_healthy
redis:
condition: service_healthy
user: "${UID}:${GID}"
{%- if needs_chrome %}
cap_add:
- SYS_ADMIN
{%- endif %}
volumes:
- "/dev/shm:/dev/shm"
{%- for volumestr in volumes %}
- "{{ volumestr }}"
{%- endfor %}
{%- if config.get("docker_volumes", "") %}
{%- for volume in config.get("docker_volumes", "").split(",") %}
- {{ volume | string() }}
{%- endfor %}
{%- endif %}
environment: &commonenv
{%- if needs_chrome %}
HOST: web # Tell the worker where we expect the web service to be
{%- endif %}
REDIS_URL: redis://redis:6379
DATABASE_URL: postgresql://dallinger:dallinger@postgresql/dallinger
HOME: /tmp
web:
image: {{ experiment_image }}
user: "${UID}:${GID}"
command: dallinger_heroku_web
depends_on:
postgresql:
condition: service_healthy
redis:
condition: service_healthy
{%- if needs_chrome %}
cap_add: # Is it really necessary?
- SYS_ADMIN # Or only needed for the `worker` container?
{%- endif %}
volumes:
- "/dev/shm:/dev/shm"
{%- for volumestr in volumes %}
- "{{ volumestr }}"
{%- endfor %}
{%- if config.get("docker_volumes", "") %}
{%- for volume in config.get("docker_volumes", "").split(",") %}
- {{ volume | string() }}
{%- endfor %}
{%- endif %}
environment:
<<: *commonenv
PORT: 5000
ports:
- "5000:5000"
clock:
image: {{ experiment_image }}
user: "${UID}:${GID}"
command: dallinger_heroku_clock
depends_on:
postgresql:
condition: service_healthy
redis:
condition: service_healthy
{%- if needs_chrome %}
cap_add: # Is it really necessary?
- SYS_ADMIN # Or only needed for the `worker` container?
{%- endif %}
volumes:
- "/dev/shm:/dev/shm"
{%- for volumestr in volumes %}
- "{{ volumestr }}"
{%- endfor %}
environment:
<<: *commonenv
volumes:
dallinger_{{ experiment_name }}_pg_data:
dallinger_{{ experiment_name }}_redis_data: