I am running a project with Laravel. I use Dokploy, Docker, Nginx, PHP 7.4. From time to time there is a high load on the server. I checked the logs and see the following errors:
2024-11-28 05:25:55,583 INFO exited: laravel-queue_04 (exit status 1; not expected)
2024-11-28 05:25:55,595 INFO spawned: 'laravel-queue_03' with pid 1119923
2024-11-28 05:25:55,598 INFO spawned: 'laravel-queue_04' with pid 1119924
2024-11-28 05:25:56,437 INFO success: laravel-queue_00 entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2024-11-28 05:25:56,437 INFO success: laravel-queue_02 entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2024-11-28 05:25:56,552 INFO success: laravel-queue_01 entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
The Supervisor.conf file has the following set:
[supervisord]
nodaemon=true
loglevel = info
logfile=/var/log/supervisord.log
pidfile=/var/run/supervisord.pid
[group:laravel-worker]
priority=999
programs=nginx,php8-fpm,laravel-schedule,laravel-notification,laravel-queue
[program:nginx]
priority=10
autostart=true
autorestart=true
stderr_logfile_maxbytes=0
stdout_logfile_maxbytes=0
stdout_events_enabled=true
stderr_events_enabled=true
command=/usr/sbin/nginx -g 'daemon off;'
stderr_logfile=/var/log/nginx/error.log
stdout_logfile=/var/log/nginx/access.log
[program:php8-fpm]
priority=5
autostart=true
autorestart=true
stderr_logfile_maxbytes=0
stdout_logfile_maxbytes=0
command=/usr/local/sbin/php-fpm -R
stderr_logfile=/var/log/nginx/php-error.log
stdout_logfile=/var/log/nginx/php-access.log
[program:laravel-schedule]
numprocs=1
autostart=true
autorestart=true
redirect_stderr=true
process_name=%(program_name)s_%(process_num)02d
command=php /var/www/artisan schedule:run
stdout_logfile=/var/log/nginx/schedule.log
[program:laravel-notification]
numprocs=1
autostart=true
autorestart=true
redirect_stderr=true
process_name=%(program_name)s_%(process_num)02d
command=php /var/www/artisan notification:worker
stdout_logfile=/var/log/nginx/notification.log
[program:laravel-queue]
numprocs=5
autostart=true
autorestart=true
redirect_stderr=true
process_name=%(program_name)s_%(process_num)02d
stdout_logfile=/var/log/nginx/worker.log
command=php /var/www/artisan queue:work sqs --sleep=600 --tries=3
The Dockerfile file has the following set:
# Install composer
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
# Clear cache
RUN apt-get clean && rm -rf /var/lib/apt/lists/*
# Add user for laravel application
RUN groupadd -g 1000 www
RUN useradd -u 1000 -ms /bin/bash -g www www
# Copy code to /var/www
COPY --chown=www:www-data . /var/www
# add root to www group
RUN chmod -R ug+w /var/www/storage
RUN chmod -R ug+w /var/www/uploads
# Copy nginx/php/supervisor configs
RUN cp docker/supervisor.conf /etc/supervisord.conf
RUN cp docker/php.ini /usr/local/etc/php/conf.d/app.ini
RUN cp docker/nginx.conf /etc/nginx/sites-enabled/default
# PHP Error Log Files
RUN mkdir /var/log/php
RUN touch /var/log/php/errors.log && chmod 777 /var/log/php/errors.log
# Deployment steps
RUN composer install --optimize-autoloader
RUN chmod +x /var/www/docker/run.sh
RUN touch /var/www/storage/logs/laravel.log && chmod 777 /var/www/storage/logs/laravel.log
EXPOSE 80
ENTRYPOINT ["/var/www/docker/run.sh"]
What am I doing wrong and what needs to be corrected?