0

Docker yml. I edited the laravel and redis containers in the file. Both containers are working fine. But when I don't run the artisan queue:work command externally, the queues don't start. I have no idea how to solve this situation. In addition, I made the necessary settings for the supervisiord file, which is among the laravel sail notes.

I am a beginner in Docker. Sorry if this is a wrong or wrong question.

Docker Yml

# For more information: https://laravel.com/docs/sail
version: '3'
services:
    laravel.test:
        build:
            context: ./docker/8.0
            dockerfile: Dockerfile
            args:
                WWWGROUP: '${WWWGROUP}'
        image: sail-8.0/app
        container_name: LaravelTest
        extra_hosts:
            - 'host.docker.internal:host-gateway'
        ports:
            - '${APP_PORT:-8000}:8000'
        environment:
            WWWUSER: '${WWWUSER}'
            LARAVEL_SAIL: 1
            XDEBUG_MODE: '${SAIL_XDEBUG_MODE:-off}'
            XDEBUG_CONFIG: '${SAIL_XDEBUG_CONFIG:-client_host=host.docker.internal}'
        volumes:
            - '.:/var/www/html'
        networks:
            - sail
        depends_on:
            - mysql
            - redis
    mysql:
        image: 'mysql:8.0'
        container_name: MySql
        ports:
            - '${FORWARD_DB_PORT:-3306}:3306'
        environment:
            MYSQL_ROOT_USER: '${DB_USERNAME}'
            MYSQL_ROOT_PASSWORD: '${DB_PASSWORD}'
            MYSQL_DATABASE: '${DB_DATABASE}'
            MYSQL_USER: '${DB_USERNAME}'
            MYSQL_PASSWORD: '${DB_PASSWORD}'
            MYSQL_ALLOW_EMPTY_PASSWORD: 'yes'
        volumes:
            - "/var/lib/mysql"
        networks:
            - sail
    phpmyadmin:
        image: 'phpmyadmin:latest'
        container_name: PhpMyAdmin
        ports:
            - 8081:80
        environment:
            PMA_HOST: mysql
            MYSQL_ROOT_USER: '${DB_USERNAME}'
            MYSQL_ROOT_PASSWORD: '${DB_PASSWORD}'
            MYSQL_DATABASE: '${DB_DATABASE}'
        depends_on:
            - mysql
        networks:
            - sail
    redis:
        image: 'redis:alpine'
        container_name: Redis
        ports:
            - '${FORWARD_REDIS_PORT:-6379}:6379'
        volumes:
            - 'sailredis:/data'
        networks:
            - sail
        healthcheck:
            test: ["CMD", "redis-cli", "ping"]
            retries: 3
            timeout: 5s
networks:
    sail:
        driver: bridge
volumes:
    sailmysql:
        driver: local
    sailredis:
        driver: local

nrkdrk
  • 78
  • 9
  • The `sail build --no-cache` command fixed the problem for me. A new build must be purchased for the changes made in the supervisor file. – nrkdrk Oct 15 '21 at 07:03

1 Answers1

1

You always need to run the artisan queue:work command. But in production mode, it doesn't work like that. As Laravel's documentation mentioned here, You need to use a process monitor such as Supervisor to ensure that the queue worker always runs in the background and does not stop running.

  • It is true that you said yes, so I edited the supervisor file in the project by adding the command as necessary. However, this command does not work even when I raise the container. I think my mistake is not associating the docker yml with the supervisor file. What do you think I can do about it? How can I mount docker and supervisor files – nrkdrk Oct 14 '21 at 21:28
  • Are you using Sail or your own custom docker image? – Mahmoud Moradian Oct 14 '21 at 22:30
  • 1
    I am using Laravel sail – nrkdrk Oct 15 '21 at 06:19
  • 2
    Thank you for your help my friend Mahmood Moradian. I found the problem and fixed it. I was skipping building with sail. In order to run the changes made to the supervisor file, it was absolutely necessary to get a build. Build code for other developers: sail build --no-cache – nrkdrk Oct 15 '21 at 07:01