diff --git a/resources/docker/.gitignore b/resources/docker/.gitignore index c2f1693ec..03be9d38e 100755 --- a/resources/docker/.gitignore +++ b/resources/docker/.gitignore @@ -2,3 +2,8 @@ !nginx/ !php/ !.gitignore +!php.ini +!start-task-runner +!supervisord.conf +!supervisord.laravel.conf +!utilities.sh \ No newline at end of file diff --git a/resources/docker/nginx/default.conf b/resources/docker/nginx/default.conf deleted file mode 100644 index ced8c907b..000000000 --- a/resources/docker/nginx/default.conf +++ /dev/null @@ -1,27 +0,0 @@ -server { - listen 80 default_server; - server_name phpvms.test; - - access_log /var/log/nginx/access.log; - error_log /var/log/nginx/error.log; - - root /var/www/public; - index index.php index.html index.htm; - - location / { - try_files $uri $uri/ /index.php$is_args$args; - } - - location ~ \.php$ { - try_files $uri =404; - fastcgi_split_path_info ^(.+\.php)(/.+)$; - fastcgi_pass app:9000; - fastcgi_index index.php; - fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; - include /etc/nginx/fastcgi_params; - } - - location ~ /\.ht { - deny all; - } -} diff --git a/resources/docker/php.ini b/resources/docker/php.ini new file mode 100644 index 000000000..9c6b29484 --- /dev/null +++ b/resources/docker/php.ini @@ -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 \ No newline at end of file diff --git a/resources/docker/php/ext-opcache.ini b/resources/docker/php/ext-opcache.ini deleted file mode 100644 index d5050ea45..000000000 --- a/resources/docker/php/ext-opcache.ini +++ /dev/null @@ -1,8 +0,0 @@ -[opcache] -opcache.enable = 1 -opcache.memory_consumption = 128 -opcache.interned_strings_buffer = 8 -opcache.max_accelerated_files = 4000 -opcache.revalidate_freq = 60 -opcache.fast_shutdown = 1 -opcache.enable_cli = 1 diff --git a/resources/docker/php/www.conf b/resources/docker/php/www.conf deleted file mode 100644 index 725d0d2cc..000000000 --- a/resources/docker/php/www.conf +++ /dev/null @@ -1,15 +0,0 @@ -[www] - -user = www-data -group = www-data - -listen = :9000 - -pm = dynamic -pm.max_children = 5 -pm.start_servers = 2 -pm.min_spare_servers = 1 -pm.max_spare_servers = 3 - -php_flag[display_errors] = on -php_admin_flag[log_errors] = on diff --git a/resources/docker/start-task-runner b/resources/docker/start-task-runner new file mode 100644 index 000000000..93340a4af --- /dev/null +++ b/resources/docker/start-task-runner @@ -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 \ No newline at end of file diff --git a/resources/docker/supervisord.conf b/resources/docker/supervisord.conf new file mode 100644 index 000000000..3063a9ca0 --- /dev/null +++ b/resources/docker/supervisord.conf @@ -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 \ No newline at end of file diff --git a/resources/docker/supervisord.laravel.conf b/resources/docker/supervisord.laravel.conf new file mode 100644 index 000000000..d57f7582f --- /dev/null +++ b/resources/docker/supervisord.laravel.conf @@ -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 \ No newline at end of file diff --git a/resources/docker/utilities.sh b/resources/docker/utilities.sh new file mode 100644 index 000000000..4daaa42c6 --- /dev/null +++ b/resources/docker/utilities.sh @@ -0,0 +1,4 @@ +# Commonly used aliases +alias ..="cd .." +alias ...="cd ../.." +alias art="php artisan" \ No newline at end of file