Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 10 additions & 11 deletions docker-compose-prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ x-volumes: &default-volume
x-restart-policy: &restart_policy
restart: unless-stopped

x-restart-policy-always: &restart_policy_always

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All containers must have the same restart policy. For example, after Docker daemon restarts, database is not started automatically, but worker is require a database

restart: always

x-environment: &default-environment
REDIS_URL: redis://redis
DATABASE_URL: "postgresql://packeton:pack123@postgres:5432/packeton?serverVersion=14&charset=utf8"
Expand All @@ -17,14 +20,14 @@ services:
redis:
image: redis:7-alpine
hostname: redis
<<: *restart_policy
<<: [*restart_policy]
volumes:
- redis-data:/data

postgres:
image: postgres:14-alpine
hostname: postgres
<<: *restart_policy
<<: [*restart_policy]
volumes:
- postgres-data:/var/lib/postgresql/data
environment:
Expand All @@ -36,10 +39,9 @@ services:
image: packeton/packeton:latest
hostname: php-fpm
command: ['php-fpm', '-F']
<<: *restart_policy
<<: *default-volume
<<: [*restart_policy, *default-volume]
environment:
<<: *default-environment
<<: [*default-environment]
SKIP_INIT: 0
WAIT_FOR_HOST: 'postgres:5432'
depends_on:
Expand All @@ -51,8 +53,7 @@ services:
hostname: nginx
ports:
- '127.0.0.1:8088:80'
<<: *restart_policy
<<: *default-volume
<<: [*restart_policy, *default-volume]
command: >
bash -c 'sed s/_PHP_FPM_HOST_/php-fpm:9000/g < docker/nginx/nginx-tpl.conf > /etc/nginx/nginx.conf && nginx'
environment:
Expand All @@ -66,8 +67,7 @@ services:
hostname: packeton-worker
command: ['bin/console', 'packagist:run-workers', '-v']
user: www-data
<<: *restart_policy
<<: *default-volume
<<: [*restart_policy_always, *default-volume]
environment:
<<: *default-environment
WAIT_FOR_HOST: 'php-fpm:9000'
Expand All @@ -79,8 +79,7 @@ services:
hostname: packeton-cron
command: ['bin/console', 'okvpn:cron', '--demand', '--time-limit=3600']
user: www-data
<<: *restart_policy
<<: *default-volume
<<: [*restart_policy_always, *default-volume]
environment:
<<: *default-environment
WAIT_FOR_HOST: 'php-fpm:9000'
Expand Down