Skip to content

Instantly share code, notes, and snippets.

@vchakoshy
Last active November 15, 2020 09:01
Show Gist options
  • Save vchakoshy/fd9314a0f03e2da2eaac96023fc3c900 to your computer and use it in GitHub Desktop.
Save vchakoshy/fd9314a0f03e2da2eaac96023fc3c900 to your computer and use it in GitHub Desktop.
laravel docker compose and docker swarm with roll out and health check and cron jobs
version: "3.4"
services:
app:
image: appimage/master:stable # change me
ports:
- 8081:80
env_file:
- stage-prod.env
environment:
APACHE_EXTENSION_REMOTEIP: 1
stop_grace_period: 10s
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost"]
interval: 5s
timeout: 2s
retries: 30
start_period: 5s
deploy:
replicas: 2
update_config:
order: start-first
app-cron:
image: appimage/master:stable # change me
env_file:
- stage-prod.env
environment:
- CRON_USER=docker
- CRON_SCHEDULE=* * * * *
- CRON_COMMAND=cd /var/www/html && php artisan schedule:run >> /dev/null 2>&1
stop_grace_period: 120s
deploy:
replicas: 1
update_config:
order: start-first
delay: 20s
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment