@ibrahimwickama , for a vanilla docker-compose?
version: "3.8"
services:
postgres:
deploy:
resources:
limits:
cpus: '${DOCKER_POSTGRES_CPUS:-0}'
memory: '${DOCKER_POSTGRES_MEMORY:-0}'
environment:
- POSTGRES_USER=${POSTGRES_USER:-postgres}
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD:-postgres}
- POSTGRES_DB=${POSTGRES_DB:-lightning_dev}
image: 'postgres:14.2-alpine'
restart: '${DOCKER_RESTART_POLICY:-unless-stopped}'
stop_grace_period: '3s'
volumes:
- 'postgres:/var/lib/postgresql/data'
// define a service for the migrations
migrations:
image: 'openfn/lightning:latest'
command: ["/app/bin/lightning", "eval", "Lightning.Release.migrate"]
env_file:
- 'OpenFn/openfn.env'
depends_on:
- postgres
// don't start the webserver until the migrations have exited successfully
web:
image: 'openfn/lightning:latest'
command: ["/app/bin/lightning", "eval" "/app/bin/server"]
env_file:
- 'OpenFn/openfn.env'
deploy:
resources:
limits:
cpus: '${DOCKER_WEB_CPUS:-0}'
memory: '${DOCKER_WEB_MEMORY:-0}'
environment:
- DATABASE_URL=postgresql://postgres:postgres@postgres:5432/lightning_dev
depends_on:
migrations:
condition: service_completed_successfully
postgres:
condition: service_started
healthcheck:
test: '${DOCKER_WEB_HEALTHCHECK_TEST:-curl localhost:4000/health_check}'
interval: '10s'
timeout: '3s'
start_period: '5s'
retries: 3
ports:
- '${LIGHTNING_EXTERNAL_PORT:-127.0.0.1:${PORT-4000}}:${URL_PORT-4000}'
worker:
image: 'openfn/ws-worker:latest'
deploy:
resources:
limits:
cpus: '${DOCKER_WORKER_CPUS:-0}'
memory: '${DOCKER_WEB_MEMORY:-0}'
depends_on:
web:
condition: service_healthy
restart: true
command:
['pnpm', 'start:prod', '-l', 'ws://web:${URL_PORT-4000}/worker']
restart: '${DOCKER_RESTART_POLICY:-unless-stopped}'
stop_grace_period: '3s'
expose:
- '2222'
volumes:
postgres: {}