$ docker --version): Docker version 18.09.2, build 6247962$ git rev-parse HEAD): 1602ff2dd054afd085881cffd5426246f880bfeaI run
docker-compose up nginx php-fpm workspace postgres redis php-worker
Everything works fine, caching, db, files. Everything.
But, when i try to use queue driver redis in my .env
QUEUE_CONNECTION=redis
And after that i send notification, i see in console this output, and no notifications is sent
workspace_1 | *** Booting runit daemon...
workspace_1 | *** Runit started as PID 16
workspace_1 | Jul 29 05:46:02 acca9fdab1b3 cron[19]: (CRON) INFO (pidfile fd = 3)
workspace_1 | Jul 29 05:46:02 acca9fdab1b3 cron[19]: (CRON) INFO (Running @reboot jobs)
redis_1 | 1:M 29 Jul 2019 05:45:59.896 * DB loaded from disk: 0.006 seconds
redis_1 | 1:M 29 Jul 2019 05:45:59.896 * Ready to accept connections
php-worker_1 | 2019-07-29 05:46:03,110 CRIT Supervisor is running as root. Privileges were not dropped because no user is specified in the config file. If you intend to run as root, you can set user=root in the config file to avoid this message.
php-worker_1 | 2019-07-29 05:46:03,110 INFO Included extra file "/etc/supervisord.d/laravel-worker.conf" during parsing
php-fpm_1 | [29-Jul-2019 05:46:02] NOTICE: fpm is running, pid 1
php-worker_1 | 2019-07-29 05:46:03,134 INFO RPC interface 'supervisor' initialized
php-fpm_1 | [29-Jul-2019 05:46:02] NOTICE: ready to handle connections
php-worker_1 | 2019-07-29 05:46:03,134 CRIT Server 'inet_http_server' running without any HTTP authentication checking
php-worker_1 | 2019-07-29 05:46:03,135 INFO supervisord started with pid 1
php-worker_1 | 2019-07-29 05:46:04,138 INFO spawned: 'laravel-worker_00' with pid 7
php-worker_1 | 2019-07-29 05:46:05,141 INFO success: laravel-worker_00 entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
php-worker_1 | 2019-07-29 05:46:06,211 INFO exited: laravel-worker_00 (exit status 1; not expected)
php-worker_1 | 2019-07-29 05:46:07,214 INFO spawned: 'laravel-worker_00' with pid 14
php-worker_1 | 2019-07-29 05:46:08,216 INFO success: laravel-worker_00 entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
php-worker_1 | 2019-07-29 05:46:21,007 INFO exited: laravel-worker_00 (exit status 1; not expected)
php-worker_1 | 2019-07-29 05:46:22,012 INFO spawned: 'laravel-worker_00' with pid 21
php-worker_1 | 2019-07-29 05:46:22,811 INFO exited: laravel-worker_00 (exit status 1; not expected)
php-worker_1 | 2019-07-29 05:46:23,814 INFO spawned: 'laravel-worker_00' with pid 28
php-worker_1 | 2019-07-29 05:46:24,674 INFO exited: laravel-worker_00 (exit status 1; not expected)
php-worker_1 | 2019-07-29 05:46:26,685 INFO spawned: 'laravel-worker_00' with pid 35
php-worker_1 | 2019-07-29 05:46:27,559 INFO exited: laravel-worker_00 (exit status 1; not expected)
php-worker_1 | 2019-07-29 05:46:30,568 INFO spawned: 'laravel-worker_00' with pid 42
php-worker_1 | 2019-07-29 05:46:31,379 INFO exited: laravel-worker_00 (exit status 1; not expected)
php-worker_1 | 2019-07-29 05:46:32,381 INFO gave up: laravel-worker_00 entered FATAL state, too many start retries too quickly
But, if i run queue inside php workspace
docker-compose exec workspace bash
everything works fine, i tried from all users.
root@8a30acabb433:/var/www# php artisan queue:work redis
[2019-07-29 05:30:26][FQCiMtEiGC0iS98w8sMAuI4CfqY0r8xZ] Processing: App\Notifications\AuthEmailCode
[2019-07-29 05:30:28][FQCiMtEiGC0iS98w8sMAuI4CfqY0r8xZ] Processed: App\Notifications\AuthEmailCode
[2019-07-29 05:30:28][IccrDNAe6Y4DoJbUNRNjUAkCSdKJOMj3] Processing: App\Notifications\AuthEmailCode
[2019-07-29 05:30:28][IccrDNAe6Y4DoJbUNRNjUAkCSdKJOMj3] Processed: App\Notifications\AuthEmailCode
^C
root@8a30acabb433:/var/www# su laradock
laradock@8a30acabb433:/var/www$ php /var/www/artisan queue:work --sleep=3 --tries=3 --daemon
[2019-07-29 05:32:32][2ptZfNLePdakWEwte4VNzJPCjOsJhouu] Processing: App\Notifications\AuthEmailCode
[2019-07-29 05:32:32][2ptZfNLePdakWEwte4VNzJPCjOsJhouu] Processed: App\Notifications\AuthEmailCode
[2019-07-29 05:32:32][RkOyy6lWbmewf0Qh8Oiap8EV2m1VZ5Je] Processing: App\Notifications\AuthEmailCode
[2019-07-29 05:32:35][RkOyy6lWbmewf0Qh8Oiap8EV2m1VZ5Je] Processed: App\Notifications\AuthEmailCode
^C
laradock@8a30acabb433:/var/www$ exit
In my php-worker directory i have laravel-worker.conf, inside this file:
[program:laravel-worker]
process_name=%(program_name)s_%(process_num)02d
command=php /var/www/artisan queue:work --sleep=3 --tries=3 --daemon
autostart=true
autorestart=true
numprocs=1
user=laradock
redirect_stderr=true
i also tried from root
[program:laravel-worker]
process_name=%(program_name)s_%(process_num)02d
command=php /var/www/artisan queue:work --sleep=3 --tries=3 --daemon
autostart=true
autorestart=true
numprocs=1
user=root
redirect_stderr=true
and also i added to my Dokerfile redis php extension
# Install Redis
ARG INSTALL_PHPREDIS=false
ENV INSTALL_PHPREDIS ${INSTALL_PHPREDIS}
RUN if [ ${INSTALL_PHPREDIS} = true ]; then \
# Install Php Redis extension
pecl install -o -f redis \
&& rm -rf /tmp/pear \
&& docker-php-ext-enable redis \
;fi
And rebuilt it by using docker-compose build php-worker
and also entered to php-worker shell and rechecked
/etc/supervisor/conf.d # php -r "print_r(get_loaded_extensions());"
Array
(
[0] => Core
...
[36] => redis
[37] => sodium
)
/etc/supervisor/conf.d #
php-worker not exiting, and working fine.
Please, tell where i went wront?
After i wrote this amazing issue i found out how to fix it.
here what you should do:
You must enter this in your /php-worker/supervisord.d/laravel-worker.conf
stdout_logfile=/dev/fd/1
stdout_logfile_maxbytes=0
After that you will see all logs in terminal
My bad is i forgot about postgres..
PDOException: could not find driver in /var/www/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php:70\n
php-worker_1 | Stack trace:\n
Most helpful comment
After i wrote this amazing issue i found out how to fix it.
here what you should do:
You must enter this in your /php-worker/supervisord.d/laravel-worker.conf
After that you will see all logs in terminal
My bad is i forgot about postgres..