From ce7c4fd67d875399eaff742a90d9a7acc468edc4 Mon Sep 17 00:00:00 2001 From: Mortexa <47121888+smortexa@users.noreply.github.com> Date: Sat, 4 May 2024 12:12:12 +0330 Subject: [PATCH] Improve Supervisor setup (#74) --- FrankenPHP.Dockerfile | 2 ++ RoadRunner.Dockerfile | 2 ++ Swoole.Dockerfile | 2 ++ .../FrankenPHP/supervisord.frankenphp.conf | 21 ++++++++----------- .../RoadRunner/supervisord.roadrunner.conf | 21 ++++++++----------- .../octane/Swoole/supervisord.swoole.conf | 21 ++++++++----------- deployment/supervisord.conf | 14 +++++++++++++ deployment/supervisord.horizon.conf | 9 +++----- deployment/supervisord.scheduler.conf | 11 ++++------ deployment/supervisord.worker.conf | 9 +++----- 10 files changed, 57 insertions(+), 55 deletions(-) create mode 100644 deployment/supervisord.conf diff --git a/FrankenPHP.Dockerfile b/FrankenPHP.Dockerfile index 774dceb..e364bdd 100644 --- a/FrankenPHP.Dockerfile +++ b/FrankenPHP.Dockerfile @@ -78,6 +78,7 @@ RUN apt-get update; \ wget \ nano \ ncdu \ + procps \ ca-certificates \ supervisor \ libsodium-dev \ @@ -143,6 +144,7 @@ RUN mkdir -p \ storage/logs \ bootstrap/cache && chmod -R a+rw storage +COPY --chown=${USER}:${USER} deployment/supervisord.conf /etc/supervisor/ COPY --chown=${USER}:${USER} deployment/octane/FrankenPHP/supervisord.frankenphp.conf /etc/supervisor/conf.d/ COPY --chown=${USER}:${USER} deployment/supervisord.*.conf /etc/supervisor/conf.d/ COPY --chown=${USER}:${USER} deployment/start-container /usr/local/bin/start-container diff --git a/RoadRunner.Dockerfile b/RoadRunner.Dockerfile index 81f9ef3..346c90d 100644 --- a/RoadRunner.Dockerfile +++ b/RoadRunner.Dockerfile @@ -73,6 +73,7 @@ RUN apt-get update; \ wget \ nano \ ncdu \ + procps \ ca-certificates \ supervisor \ libsodium-dev \ @@ -138,6 +139,7 @@ RUN mkdir -p \ storage/logs \ bootstrap/cache && chmod -R a+rw storage +COPY --chown=${USER}:${USER} deployment/supervisord.conf /etc/supervisor/ COPY --chown=${USER}:${USER} deployment/octane/RoadRunner/supervisord.roadrunner.conf /etc/supervisor/conf.d COPY --chown=${USER}:${USER} deployment/supervisord.*.conf /etc/supervisor/conf.d/ COPY --chown=${USER}:${USER} deployment/php.ini ${PHP_INI_DIR}/conf.d/99-octane.ini diff --git a/Swoole.Dockerfile b/Swoole.Dockerfile index 24cca7d..f1b00c3 100644 --- a/Swoole.Dockerfile +++ b/Swoole.Dockerfile @@ -73,6 +73,7 @@ RUN apt-get update; \ wget \ nano \ ncdu \ + procps \ ca-certificates \ supervisor \ libsodium-dev \ @@ -139,6 +140,7 @@ RUN mkdir -p \ storage/logs \ bootstrap/cache && chmod -R a+rw storage +COPY --chown=${USER}:${USER} deployment/supervisord.conf /etc/supervisor/ COPY --chown=${USER}:${USER} deployment/octane/Swoole/supervisord.swoole.conf /etc/supervisor/conf.d/ COPY --chown=${USER}:${USER} deployment/supervisord.*.conf /etc/supervisor/conf.d/ COPY --chown=${USER}:${USER} deployment/php.ini ${PHP_INI_DIR}/conf.d/99-octane.ini diff --git a/deployment/octane/FrankenPHP/supervisord.frankenphp.conf b/deployment/octane/FrankenPHP/supervisord.frankenphp.conf index 49b064c..89c0782 100644 --- a/deployment/octane/FrankenPHP/supervisord.frankenphp.conf +++ b/deployment/octane/FrankenPHP/supervisord.frankenphp.conf @@ -1,9 +1,3 @@ -[supervisord] -nodaemon=true -user=%(ENV_USER)s -logfile=/var/log/supervisor/supervisord.log -pidfile=/var/run/supervisord.pid - [program:octane] process_name=%(program_name)s_%(process_num)02d command=php %(ENV_ROOT)s/artisan octane:start --server=frankenphp --host=0.0.0.0 --port=8000 --admin-port=2019 @@ -24,9 +18,9 @@ user=%(ENV_USER)s autostart=%(ENV_WITH_HORIZON)s autorestart=true stdout_logfile=%(ENV_ROOT)s/storage/logs/horizon.log -stdout_logfile_maxbytes=0 +stdout_logfile_maxbytes=200MB stderr_logfile=%(ENV_ROOT)s/storage/logs/horizon.log -stderr_logfile_maxbytes=0 +stderr_logfile_maxbytes=200MB stopwaitsecs=3600 [program:scheduler] @@ -36,9 +30,9 @@ user=%(ENV_USER)s autostart=%(ENV_WITH_SCHEDULER)s autorestart=true stdout_logfile=%(ENV_ROOT)s/storage/logs/scheduler.log -stdout_logfile_maxbytes=0 +stdout_logfile_maxbytes=200MB stderr_logfile=%(ENV_ROOT)s/storage/logs/scheduler.log -stderr_logfile_maxbytes=0 +stderr_logfile_maxbytes=200MB [program:clear-scheduler-cache] process_name=%(program_name)s_%(process_num)02d @@ -49,6 +43,9 @@ autorestart=false startsecs=0 startretries=1 stdout_logfile=%(ENV_ROOT)s/storage/logs/scheduler.log -stdout_logfile_maxbytes=0 +stdout_logfile_maxbytes=200MB stderr_logfile=%(ENV_ROOT)s/storage/logs/scheduler.log -stderr_logfile_maxbytes=0 \ No newline at end of file +stderr_logfile_maxbytes=200MB + +[include] +files=/etc/supervisor/supervisord.conf \ No newline at end of file diff --git a/deployment/octane/RoadRunner/supervisord.roadrunner.conf b/deployment/octane/RoadRunner/supervisord.roadrunner.conf index da360f7..8ffd957 100644 --- a/deployment/octane/RoadRunner/supervisord.roadrunner.conf +++ b/deployment/octane/RoadRunner/supervisord.roadrunner.conf @@ -1,9 +1,3 @@ -[supervisord] -nodaemon=true -user=%(ENV_USER)s -logfile=/var/log/supervisor/supervisord.log -pidfile=/var/run/supervisord.pid - [program:octane] process_name=%(program_name)s_%(process_num)02d command=php %(ENV_ROOT)s/artisan octane:start --server=roadrunner --host=0.0.0.0 --port=8000 --rpc-port=6001 --rr-config=%(ENV_ROOT)s/.rr.yaml @@ -23,9 +17,9 @@ user=%(ENV_USER)s autostart=%(ENV_WITH_HORIZON)s autorestart=true stdout_logfile=%(ENV_ROOT)s/storage/logs/horizon.log -stdout_logfile_maxbytes=0 +stdout_logfile_maxbytes=200MB stderr_logfile=%(ENV_ROOT)s/storage/logs/horizon.log -stderr_logfile_maxbytes=0 +stderr_logfile_maxbytes=200MB stopwaitsecs=3600 [program:scheduler] @@ -35,9 +29,9 @@ user=%(ENV_USER)s autostart=%(ENV_WITH_SCHEDULER)s autorestart=true stdout_logfile=%(ENV_ROOT)s/storage/logs/scheduler.log -stdout_logfile_maxbytes=0 +stdout_logfile_maxbytes=200MB stderr_logfile=%(ENV_ROOT)s/storage/logs/scheduler.log -stderr_logfile_maxbytes=0 +stderr_logfile_maxbytes=200MB [program:clear-scheduler-cache] process_name=%(program_name)s_%(process_num)02d @@ -48,6 +42,9 @@ autorestart=false startsecs=0 startretries=1 stdout_logfile=%(ENV_ROOT)s/storage/logs/scheduler.log -stdout_logfile_maxbytes=0 +stdout_logfile_maxbytes=200MB stderr_logfile=%(ENV_ROOT)s/storage/logs/scheduler.log -stderr_logfile_maxbytes=0 \ No newline at end of file +stderr_logfile_maxbytes=200MB + +[include] +files=/etc/supervisor/supervisord.conf \ No newline at end of file diff --git a/deployment/octane/Swoole/supervisord.swoole.conf b/deployment/octane/Swoole/supervisord.swoole.conf index 6d83e9c..58abdc4 100644 --- a/deployment/octane/Swoole/supervisord.swoole.conf +++ b/deployment/octane/Swoole/supervisord.swoole.conf @@ -1,9 +1,3 @@ -[supervisord] -nodaemon=true -user=%(ENV_USER)s -logfile=/var/log/supervisor/supervisord.log -pidfile=/var/run/supervisord.pid - [program:octane] process_name=%(program_name)s_%(process_num)02d command=php %(ENV_ROOT)s/artisan octane:start --server=swoole --host=0.0.0.0 --port=8000 @@ -23,9 +17,9 @@ user=%(ENV_USER)s autostart=%(ENV_WITH_HORIZON)s autorestart=true stdout_logfile=%(ENV_ROOT)s/storage/logs/horizon.log -stdout_logfile_maxbytes=0 +stdout_logfile_maxbytes=200MB stderr_logfile=%(ENV_ROOT)s/storage/logs/horizon.log -stderr_logfile_maxbytes=0 +stderr_logfile_maxbytes=200MB stopwaitsecs=3600 [program:scheduler] @@ -35,9 +29,9 @@ user=%(ENV_USER)s autostart=%(ENV_WITH_SCHEDULER)s autorestart=true stdout_logfile=%(ENV_ROOT)s/storage/logs/scheduler.log -stdout_logfile_maxbytes=0 +stdout_logfile_maxbytes=200MB stderr_logfile=%(ENV_ROOT)s/storage/logs/scheduler.log -stderr_logfile_maxbytes=0 +stderr_logfile_maxbytes=200MB [program:clear-scheduler-cache] process_name=%(program_name)s_%(process_num)02d @@ -48,6 +42,9 @@ autorestart=false startsecs=0 startretries=1 stdout_logfile=%(ENV_ROOT)s/storage/logs/scheduler.log -stdout_logfile_maxbytes=0 +stdout_logfile_maxbytes=200MB stderr_logfile=%(ENV_ROOT)s/storage/logs/scheduler.log -stderr_logfile_maxbytes=0 \ No newline at end of file +stderr_logfile_maxbytes=200MB + +[include] +files=/etc/supervisor/supervisord.conf \ No newline at end of file diff --git a/deployment/supervisord.conf b/deployment/supervisord.conf new file mode 100644 index 0000000..7cdc878 --- /dev/null +++ b/deployment/supervisord.conf @@ -0,0 +1,14 @@ +[supervisord] +nodaemon=true +user=%(ENV_USER)s +logfile=/var/log/supervisor/supervisord.log +pidfile=/var/run/supervisord.pid + +[unix_http_server] +file=/var/run/supervisor.sock + +[supervisorctl] +serverurl=unix:///var/run/supervisor.sock + +[rpcinterface:supervisor] +supervisor.rpcinterface_factory=supervisor.rpcinterface:make_main_rpcinterface \ No newline at end of file diff --git a/deployment/supervisord.horizon.conf b/deployment/supervisord.horizon.conf index 6d03393..1ed21de 100644 --- a/deployment/supervisord.horizon.conf +++ b/deployment/supervisord.horizon.conf @@ -1,9 +1,3 @@ -[supervisord] -nodaemon=true -user=%(ENV_USER)s -logfile=/var/log/supervisor/supervisord.log -pidfile=/var/run/supervisord.pid - [program:horizon] process_name=%(program_name)s_%(process_num)02d command=php %(ENV_ROOT)s/artisan horizon @@ -15,3 +9,6 @@ stdout_logfile_maxbytes=0 stderr_logfile=/dev/stderr stderr_logfile_maxbytes=0 stopwaitsecs=3600 + +[include] +files=/etc/supervisor/supervisord.conf \ No newline at end of file diff --git a/deployment/supervisord.scheduler.conf b/deployment/supervisord.scheduler.conf index 8dad0d7..a2e6825 100644 --- a/deployment/supervisord.scheduler.conf +++ b/deployment/supervisord.scheduler.conf @@ -1,9 +1,3 @@ -[supervisord] -nodaemon=true -user=%(ENV_USER)s -logfile=/var/log/supervisor/supervisord.log -pidfile=/var/run/supervisord.pid - [program:scheduler] process_name=%(program_name)s_%(process_num)02d command=supercronic -overlapping /etc/supercronic/laravel @@ -26,4 +20,7 @@ startretries=1 stdout_logfile=/dev/stdout stdout_logfile_maxbytes=0 stderr_logfile=/dev/stderr -stderr_logfile_maxbytes=0 \ No newline at end of file +stderr_logfile_maxbytes=0 + +[include] +files=/etc/supervisor/supervisord.conf \ No newline at end of file diff --git a/deployment/supervisord.worker.conf b/deployment/supervisord.worker.conf index efd760d..ed420aa 100644 --- a/deployment/supervisord.worker.conf +++ b/deployment/supervisord.worker.conf @@ -1,9 +1,3 @@ -[supervisord] -nodaemon=true -user=%(ENV_USER)s -logfile=/var/log/supervisor/supervisord.log -pidfile=/var/run/supervisord.pid - [program:worker] process_name=%(program_name)s_%(process_num)02d command=%(ENV_WORKER_COMMAND)s @@ -14,3 +8,6 @@ stdout_logfile=/dev/stdout stdout_logfile_maxbytes=0 stderr_logfile=/dev/stderr stderr_logfile_maxbytes=0 + +[include] +files=/etc/supervisor/supervisord.conf \ No newline at end of file