ipunkt / docker-laravel-queue-worker

A docker image for working with queues being monitored by supervisor as recommended by laravel.
https://hub.docker.com/r/ipunktbs/laravel-queue-worker/
MIT License
70 stars 20 forks source link

Correct docker-compose.yml file? #10

Open altynbek07 opened 4 years ago

altynbek07 commented 4 years ago

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
rokde commented 4 years ago

I think so. Did it run?

altynbek07 commented 4 years ago

@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