Skip to content

Correct docker-compose.yml file? #10

Open

Description

@altynbek07

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

Activity

  1. rokde commented on Jun 21, 2020

    @rokde
    Member

    I think so. Did it run?

  2. altynbek07 commented on Jun 21, 2020

    @altynbek07
    Author

    @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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions