docker-laravel-queue-worker
docker-laravel-queue-worker copied to clipboard
Correct docker-compose.yml file?
Hi. I added an ipunktbs/laravel-queue-worker
image to my docker-compose.yml
file. Did I set it up correctly?
version: "3"
services:
#PHP Service
app:
build:
context: .
dockerfile: Dockerfile
container_name: app
restart: unless-stopped
tty: true
working_dir: /var/www
volumes:
- ./:/var/www
networks:
- app-network
#Queue Service
queue:
image: ipunktbs/laravel-queue-worker
container_name: queue
restart: unless-stopped
tty: true
environment:
QUEUE_CONNECTION: ${QUEUE_CONNECTION}
volumes:
- ./:/var/www/app
networks:
- app-network
#Nginx Service
webserver:
image: nginx:alpine
container_name: webserver
restart: unless-stopped
tty: true
ports:
- "80:80"
- "443:443"
volumes:
- ./:/var/www
- ./docker/nginx/conf.d/:/etc/nginx/conf.d/
networks:
- app-network
#MySQL Service
db:
image: mysql:5.7.22
container_name: db
restart: unless-stopped
tty: true
ports:
- "3307:3306"
environment:
MYSQL_DATABASE: ${DB_DATABASE}
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD}
volumes:
- dbdata_price-crawler:/var/lib/mysql
networks:
- app-network
#Docker Networks
networks:
app-network:
driver: bridge
#Volumes
volumes:
dbdata_price-crawler:
driver: local
I think so. Did it run?
@rokde Yes, it works. What do you think about Task Scheduling? Add the cron task * * * * * cd /var/www/price-crawler && docker-compose exec app php artisan schedule:run >> /dev/null 2>&1
to the system itself, or create a separate container for it? I think this is the wrong way to start the task scheduler. Have you had experience with Task Scheduling and Docker? https://laravel.com/docs/7.x/scheduling#scheduling-queued-jobs