Skip to content

Commit

Permalink
Add scheduler, queue worker and update app
Browse files Browse the repository at this point in the history
  • Loading branch information
arthurpar06 committed Nov 17, 2024
1 parent 5402adc commit cc3a059
Show file tree
Hide file tree
Showing 9 changed files with 117 additions and 50 deletions.
5 changes: 5 additions & 0 deletions resources/docker/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,8 @@
!nginx/
!php/
!.gitignore
!php.ini
!start-task-runner
!supervisord.conf
!supervisord.laravel.conf
!utilities.sh
27 changes: 0 additions & 27 deletions resources/docker/nginx/default.conf

This file was deleted.

31 changes: 31 additions & 0 deletions resources/docker/php.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
[PHP]
post_max_size = 100M
upload_max_filesize = 100M
expose_php = 0
realpath_cache_size = 16M
realpath_cache_ttl = 360
max_input_time = 5
memory_limit = 512M

[Opcache]
opcache.enable = 1
opcache.enable_cli = 1
opcache.memory_consumption = 256M
opcache.use_cwd = 0
opcache.max_file_size = 0
opcache.max_accelerated_files = 32531
opcache.validate_timestamps = 0
opcache.file_update_protection = 0
opcache.interned_strings_buffer = 16
opcache.file_cache = 60

[JIT]
opcache.jit_buffer_size = 128M
opcache.jit = function
opcache.jit_prof_threshold = 0.001
opcache.jit_max_root_traces = 2048
opcache.jit_max_side_traces = 256

[zlib]
zlib.output_compression = On
zlib.output_compression_level = 9
8 changes: 0 additions & 8 deletions resources/docker/php/ext-opcache.ini

This file was deleted.

15 changes: 0 additions & 15 deletions resources/docker/php/www.conf

This file was deleted.

20 changes: 20 additions & 0 deletions resources/docker/start-task-runner
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/usr/bin/env sh
set -e

composer dump-autoload --optimize --classmap-authoritative --no-interaction --no-ansi

# Since this will start before the app, we initialize everything here (allowing us to avoid overriding the app entrypoint).
php artisan storage:link

php artisan optimize:clear
php artisan cache:clear
php artisan view:clear

php artisan event:cache
php artisan config:cache
php artisan route:cache
#php artisan view:cache

php artisan migrate --force

exec /usr/bin/supervisord -c /etc/supervisor/conf.d/supervisord.laravel.conf
16 changes: 16 additions & 0 deletions resources/docker/supervisord.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
[supervisord]
nodaemon=true
#user=%(ENV_USER)s
user=root
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
#chown=%(ENV_USER)s:%(ENV_USER)s

[rpcinterface:supervisor]
supervisor.rpcinterface_factory=supervisor.rpcinterface:make_main_rpcinterface
41 changes: 41 additions & 0 deletions resources/docker/supervisord.laravel.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
[program:scheduler]
process_name=%(program_name)s_%(process_num)02d
command=supercronic -overlapping /etc/supercronic/laravel
user=root
#user=%(ENV_USER)s
autostart=%(ENV_WITH_SCHEDULER)s
autorestart=true
stdout_logfile=%(ENV_ROOT)s/storage/logs/scheduler.log
stdout_logfile_maxbytes=200MB
stderr_logfile=%(ENV_ROOT)s/storage/logs/scheduler.log
stderr_logfile_maxbytes=200MB

[program:clear-scheduler-cache]
process_name=%(program_name)s_%(process_num)02d
command=php %(ENV_ROOT)s/artisan schedule:clear-cache
user=root
#user=%(ENV_USER)s
autostart=%(ENV_WITH_SCHEDULER)s
autorestart=false
startsecs=0
startretries=1
stdout_logfile=%(ENV_ROOT)s/storage/logs/scheduler.log
stdout_logfile_maxbytes=200MB
stderr_logfile=%(ENV_ROOT)s/storage/logs/scheduler.log
stderr_logfile_maxbytes=200MB

[program:horizon]
process_name=%(program_name)s_%(process_num)02d
command=php %(ENV_ROOT)s/artisan horizon
user=root
#user=%(ENV_USER)s
autostart=%(ENV_WITH_HORIZON)s
autorestart=true
stdout_logfile=%(ENV_ROOT)s/storage/logs/horizon.log
stdout_logfile_maxbytes=200MB
stderr_logfile=%(ENV_ROOT)s/storage/logs/horizon.log
stderr_logfile_maxbytes=200MB
stopwaitsecs=3600

[include]
files=/etc/supervisor/supervisord.conf
4 changes: 4 additions & 0 deletions resources/docker/utilities.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Commonly used aliases
alias ..="cd .."
alias ...="cd ../.."
alias art="php artisan"

0 comments on commit cc3a059

Please sign in to comment.