feat: add cron scheduling and update services
- Added go-crond library to Dockerfile for task scheduling - Created schedule service in compose.yaml with go-crond - Added cron configuration file: docker/cron/laravel - Updated README.md - Improved service configurations with health checks - Switched to base frankenphp image
This commit is contained in:
36
compose.yaml
36
compose.yaml
@@ -1,5 +1,6 @@
|
||||
services:
|
||||
app:
|
||||
image: laravel_frankenphp
|
||||
build:
|
||||
context: .
|
||||
dockerfile: docker/Dockerfile
|
||||
@@ -69,28 +70,45 @@ services:
|
||||
networks:
|
||||
- laravel_network
|
||||
queue:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: docker/Dockerfile
|
||||
image: laravel_frankenphp
|
||||
container_name: laravel_queue
|
||||
working_dir: /var/www
|
||||
command: php artisan queue:work --verbose --tries=3
|
||||
restart: unless-stopped
|
||||
command: php artisan queue:work --verbose --tries=3 --sleep=3
|
||||
healthcheck:
|
||||
test: [ "CMD", "php", "artisan", "queue:monitor", "default" ]
|
||||
interval: 30s
|
||||
timeout: 10s
|
||||
retries: 3
|
||||
start_period: 60s
|
||||
volumes:
|
||||
- ./laravel:/var/www
|
||||
depends_on:
|
||||
- postgres
|
||||
postgres:
|
||||
condition: service_healthy
|
||||
networks:
|
||||
- laravel_network
|
||||
schedule:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: docker/Dockerfile
|
||||
image: laravel_frankenphp
|
||||
container_name: laravel_schedule
|
||||
restart: unless-stopped
|
||||
working_dir: /var/www
|
||||
user: "${UID:-1000}:${GID:-1000}"
|
||||
command: php artisan schedule:work
|
||||
volumes:
|
||||
- ./laravel:/var/www
|
||||
- ./docker/cron:/etc/cron.d:ro
|
||||
command:
|
||||
- "go-crond"
|
||||
- "--default-user=${UID:-1000}"
|
||||
- "--allow-unprivileged"
|
||||
- "--include=/etc/cron.d"
|
||||
- "--verbose"
|
||||
healthcheck:
|
||||
test: [ "CMD", "pgrep", "-f", "go-crond" ]
|
||||
interval: 30s
|
||||
timeout: 10s
|
||||
retries: 3
|
||||
start_period: 40s
|
||||
depends_on:
|
||||
- app
|
||||
networks:
|
||||
|
||||
Reference in New Issue
Block a user