Skip to content

Commit

Permalink
Improve Supervisor setup (#74)
Browse files Browse the repository at this point in the history
  • Loading branch information
smortexa committed May 4, 2024
1 parent 2e6f5a4 commit ce7c4fd
Show file tree
Hide file tree
Showing 10 changed files with 57 additions and 55 deletions.
2 changes: 2 additions & 0 deletions FrankenPHP.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ RUN apt-get update; \
wget \
nano \
ncdu \
procps \
ca-certificates \
supervisor \
libsodium-dev \
Expand Down Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions RoadRunner.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ RUN apt-get update; \
wget \
nano \
ncdu \
procps \
ca-certificates \
supervisor \
libsodium-dev \
Expand Down Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions Swoole.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ RUN apt-get update; \
wget \
nano \
ncdu \
procps \
ca-certificates \
supervisor \
libsodium-dev \
Expand Down Expand Up @@ -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
Expand Down
21 changes: 9 additions & 12 deletions deployment/octane/FrankenPHP/supervisord.frankenphp.conf
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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]
Expand All @@ -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
Expand All @@ -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
stderr_logfile_maxbytes=200MB

[include]
files=/etc/supervisor/supervisord.conf
21 changes: 9 additions & 12 deletions deployment/octane/RoadRunner/supervisord.roadrunner.conf
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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]
Expand All @@ -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
Expand All @@ -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
stderr_logfile_maxbytes=200MB

[include]
files=/etc/supervisor/supervisord.conf
21 changes: 9 additions & 12 deletions deployment/octane/Swoole/supervisord.swoole.conf
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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]
Expand All @@ -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
Expand All @@ -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
stderr_logfile_maxbytes=200MB

[include]
files=/etc/supervisor/supervisord.conf
14 changes: 14 additions & 0 deletions deployment/supervisord.conf
Original file line number Diff line number Diff line change
@@ -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
9 changes: 3 additions & 6 deletions deployment/supervisord.horizon.conf
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -15,3 +9,6 @@ stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0
stopwaitsecs=3600

[include]
files=/etc/supervisor/supervisord.conf
11 changes: 4 additions & 7 deletions deployment/supervisord.scheduler.conf
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -26,4 +20,7 @@ startretries=1
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0
stderr_logfile_maxbytes=0

[include]
files=/etc/supervisor/supervisord.conf
9 changes: 3 additions & 6 deletions deployment/supervisord.worker.conf
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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

0 comments on commit ce7c4fd

Please sign in to comment.