From ea862d7c4401b3782ce712e5ad3fb1cfc72f11c4 Mon Sep 17 00:00:00 2001 From: Mortexa <47121888+smortexa@users.noreply.github.com> Date: Tue, 9 Apr 2024 21:06:25 +0330 Subject: [PATCH] wip --- .dockerignore | 3 +++ .gitignore | 4 +++- FrankenPHP.Dockerfile | 21 +++++++++---------- RoadRunner.Dockerfile | 4 ++-- Swoole.Dockerfile | 4 ++-- .../FrankenPHP/supervisord.frankenphp.conf | 16 +++++++++++--- .../RoadRunner/supervisord.roadrunner.conf | 15 ++++++++++--- .../octane/Swoole/supervisord.swoole.conf | 15 ++++++++++--- 8 files changed, 57 insertions(+), 25 deletions(-) diff --git a/.dockerignore b/.dockerignore index f4aa9ec..6430494 100644 --- a/.dockerignore +++ b/.dockerignore @@ -9,6 +9,7 @@ /storage/ssr /storage/clockwork /storage/logs +/storage/pail .phpunit.result.cache Homestead.json Homestead.yaml @@ -30,3 +31,5 @@ _ide_helper.php rr .rr.yaml frankenphp +.config +.data \ No newline at end of file diff --git a/.gitignore b/.gitignore index 33f2691..64dec27 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ .vscode .idea -**/.DS_Store \ No newline at end of file +**/.DS_Store +.config +.data \ No newline at end of file diff --git a/FrankenPHP.Dockerfile b/FrankenPHP.Dockerfile index 164c6e9..17c5553 100644 --- a/FrankenPHP.Dockerfile +++ b/FrankenPHP.Dockerfile @@ -1,7 +1,7 @@ # Accepted values: 8.3 - 8.2 ARG PHP_VERSION=8.3 -ARG FRANKENPHP_VERSION=1.1-php${PHP_VERSION} +ARG FRANKENPHP_VERSION=latest ARG COMPOSER_VERSION=latest @@ -36,9 +36,7 @@ RUN npm run build FROM composer:${COMPOSER_VERSION} AS vendor -FROM dunglas/frankenphp:${FRANKENPHP_VERSION} AS server - -FROM php:${PHP_VERSION}-zts-bookworm AS base +FROM dunglas/frankenphp:${FRANKENPHP_VERSION}-php${PHP_VERSION} LABEL maintainer="SMortexa " LABEL org.opencontainers.image.title="Laravel Octane Dockerfile" @@ -49,6 +47,7 @@ LABEL org.opencontainers.image.licenses=MIT ARG WWWUSER=1000 ARG WWWGROUP=1000 ARG TZ=UTC +ARG APP_DIR=/var/www/html ENV DEBIAN_FRONTEND=noninteractive \ TERM=xterm-color \ @@ -56,9 +55,11 @@ ENV DEBIAN_FRONTEND=noninteractive \ WITH_SCHEDULER=false \ OCTANE_SERVER=frankenphp \ USER=octane \ - ROOT=/var/www/html \ + ROOT=${APP_DIR} \ COMPOSER_FUND=0 \ - COMPOSER_MAX_PARALLEL_HTTP=24 + COMPOSER_MAX_PARALLEL_HTTP=24 \ + XDG_CONFIG_HOME=${APP_DIR}/.config \ + XDG_DATA_HOME=${APP_DIR}/.data WORKDIR ${ROOT} @@ -110,14 +111,14 @@ RUN wget -q "https://github.com/aptible/supercronic/releases/download/v0.2.29/su -O /usr/bin/supercronic \ && chmod +x /usr/bin/supercronic \ && mkdir -p /etc/supercronic \ - && echo "*/1 * * * * php ${ROOT}/artisan schedule:run --verbose --no-interaction" > /etc/supercronic/laravel + && echo "*/1 * * * * php ${ROOT}/artisan schedule:run --no-interaction" > /etc/supercronic/laravel RUN userdel --remove --force www-data \ && groupadd --force -g ${WWWGROUP} ${USER} \ && useradd -ms /bin/bash --no-log-init --no-user-group -g ${WWWGROUP} -u ${WWWUSER} ${USER} RUN chown -R ${USER}:${USER} ${ROOT} /var/{log,run} \ - && chmod -R a+rw /var/{log,run} + && chmod -R a+rw ${ROOT} /var/{log,run} RUN cp ${PHP_INI_DIR}/php.ini-production ${PHP_INI_DIR}/php.ini @@ -158,9 +159,7 @@ RUN composer install \ && composer clear-cache \ && php artisan storage:link -COPY --chown=${USER}:${USER} --from=server /usr/local/bin/frankenphp ./frankenphp - -RUN chmod +x /usr/local/bin/start-container frankenphp +RUN chmod +x /usr/local/bin/start-container RUN cat deployment/utilities.sh >> ~/.bashrc diff --git a/RoadRunner.Dockerfile b/RoadRunner.Dockerfile index 16d2221..c7f2fa3 100644 --- a/RoadRunner.Dockerfile +++ b/RoadRunner.Dockerfile @@ -106,14 +106,14 @@ RUN wget -q "https://github.com/aptible/supercronic/releases/download/v0.2.29/su -O /usr/bin/supercronic \ && chmod +x /usr/bin/supercronic \ && mkdir -p /etc/supercronic \ - && echo "*/1 * * * * php ${ROOT}/artisan schedule:run --verbose --no-interaction" > /etc/supercronic/laravel + && echo "*/1 * * * * php ${ROOT}/artisan schedule:run --no-interaction" > /etc/supercronic/laravel RUN userdel --remove --force www-data \ && groupadd --force -g ${WWWGROUP} ${USER} \ && useradd -ms /bin/bash --no-log-init --no-user-group -g ${WWWGROUP} -u ${WWWUSER} ${USER} RUN chown -R ${USER}:${USER} ${ROOT} /var/{log,run} \ - && chmod -R a+rw /var/{log,run} + && chmod -R a+rw ${ROOT} /var/{log,run} RUN cp ${PHP_INI_DIR}/php.ini-production ${PHP_INI_DIR}/php.ini diff --git a/Swoole.Dockerfile b/Swoole.Dockerfile index 2fa03ba..4152a21 100644 --- a/Swoole.Dockerfile +++ b/Swoole.Dockerfile @@ -107,14 +107,14 @@ RUN wget -q "https://github.com/aptible/supercronic/releases/download/v0.2.29/su -O /usr/bin/supercronic \ && chmod +x /usr/bin/supercronic \ && mkdir -p /etc/supercronic \ - && echo "*/1 * * * * php ${ROOT}/artisan schedule:run --verbose --no-interaction" > /etc/supercronic/laravel + && echo "*/1 * * * * php ${ROOT}/artisan schedule:run --no-interaction" > /etc/supercronic/laravel RUN userdel --remove --force www-data \ && groupadd --force -g ${WWWGROUP} ${USER} \ && useradd -ms /bin/bash --no-log-init --no-user-group -g ${WWWGROUP} -u ${WWWUSER} ${USER} RUN chown -R ${USER}:${USER} ${ROOT} /var/{log,run} \ - && chmod -R a+rw /var/{log,run} + && chmod -R a+rw ${ROOT} /var/{log,run} RUN cp ${PHP_INI_DIR}/php.ini-production ${PHP_INI_DIR}/php.ini diff --git a/deployment/octane/FrankenPHP/supervisord.frankenphp.conf b/deployment/octane/FrankenPHP/supervisord.frankenphp.conf index e582505..ba3926c 100644 --- a/deployment/octane/FrankenPHP/supervisord.frankenphp.conf +++ b/deployment/octane/FrankenPHP/supervisord.frankenphp.conf @@ -7,6 +7,7 @@ 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=80 --admin-port=2019 +# command=php %(ENV_ROOT)s/artisan octane:start --server=frankenphp --host=localhost --port=443 --admin-port=2019 --https --http-redirect user=%(ENV_USER)s autostart=true autorestart=true @@ -22,7 +23,10 @@ command=php %(ENV_ROOT)s/artisan horizon user=%(ENV_USER)s autostart=%(ENV_WITH_HORIZON)s autorestart=true -stdout_logfile=%(ENV_ROOT)s/horizon.log +stdout_logfile=%(ENV_ROOT)s/storage/logs/horizon.log +stdout_logfile_maxbytes=0 +stderr_logfile=%(ENV_ROOT)s/storage/logs/horizon.log +stderr_logfile_maxbytes=0 stopwaitsecs=3600 [program:scheduler] @@ -31,7 +35,10 @@ command=supercronic -overlapping /etc/supercronic/laravel user=%(ENV_USER)s autostart=%(ENV_WITH_SCHEDULER)s autorestart=true -stdout_logfile=%(ENV_ROOT)s/scheduler.log +stdout_logfile=%(ENV_ROOT)s/storage/logs/scheduler.log +stdout_logfile_maxbytes=0 +stderr_logfile=%(ENV_ROOT)s/storage/logs/scheduler.log +stderr_logfile_maxbytes=0 [program:clear-scheduler-cache] process_name=%(program_name)s_%(process_num)02d @@ -39,4 +46,7 @@ command=php %(ENV_ROOT)s/artisan schedule:clear-cache user=%(ENV_USER)s autostart=%(ENV_WITH_SCHEDULER)s autorestart=false -stdout_logfile=%(ENV_ROOT)s/scheduler.log \ No newline at end of file +stdout_logfile=%(ENV_ROOT)s/storage/logs/scheduler.log +stdout_logfile_maxbytes=0 +stderr_logfile=%(ENV_ROOT)s/storage/logs/scheduler.log +stderr_logfile_maxbytes=0 \ No newline at end of file diff --git a/deployment/octane/RoadRunner/supervisord.roadrunner.conf b/deployment/octane/RoadRunner/supervisord.roadrunner.conf index d47e6b2..b494f31 100644 --- a/deployment/octane/RoadRunner/supervisord.roadrunner.conf +++ b/deployment/octane/RoadRunner/supervisord.roadrunner.conf @@ -22,7 +22,10 @@ command=php %(ENV_ROOT)s/artisan horizon user=%(ENV_USER)s autostart=%(ENV_WITH_HORIZON)s autorestart=true -stdout_logfile=%(ENV_ROOT)s/horizon.log +stdout_logfile=%(ENV_ROOT)s/storage/logs/horizon.log +stdout_logfile_maxbytes=0 +stderr_logfile=%(ENV_ROOT)s/storage/logs/horizon.log +stderr_logfile_maxbytes=0 stopwaitsecs=3600 [program:scheduler] @@ -31,7 +34,10 @@ command=supercronic -overlapping /etc/supercronic/laravel user=%(ENV_USER)s autostart=%(ENV_WITH_SCHEDULER)s autorestart=true -stdout_logfile=%(ENV_ROOT)s/scheduler.log +stdout_logfile=%(ENV_ROOT)s/storage/logs/scheduler.log +stdout_logfile_maxbytes=0 +stderr_logfile=%(ENV_ROOT)s/storage/logs/scheduler.log +stderr_logfile_maxbytes=0 [program:clear-scheduler-cache] process_name=%(program_name)s_%(process_num)02d @@ -39,4 +45,7 @@ command=php %(ENV_ROOT)s/artisan schedule:clear-cache user=%(ENV_USER)s autostart=%(ENV_WITH_SCHEDULER)s autorestart=false -stdout_logfile=%(ENV_ROOT)s/scheduler.log \ No newline at end of file +stdout_logfile=%(ENV_ROOT)s/storage/logs/scheduler.log +stdout_logfile_maxbytes=0 +stderr_logfile=%(ENV_ROOT)s/storage/logs/scheduler.log +stderr_logfile_maxbytes=0 \ No newline at end of file diff --git a/deployment/octane/Swoole/supervisord.swoole.conf b/deployment/octane/Swoole/supervisord.swoole.conf index 15db3ac..e12790a 100644 --- a/deployment/octane/Swoole/supervisord.swoole.conf +++ b/deployment/octane/Swoole/supervisord.swoole.conf @@ -22,7 +22,10 @@ command=php %(ENV_ROOT)s/artisan horizon user=%(ENV_USER)s autostart=%(ENV_WITH_HORIZON)s autorestart=true -stdout_logfile=%(ENV_ROOT)s/horizon.log +stdout_logfile=%(ENV_ROOT)s/storage/logs/horizon.log +stdout_logfile_maxbytes=0 +stderr_logfile=%(ENV_ROOT)s/storage/logs/horizon.log +stderr_logfile_maxbytes=0 stopwaitsecs=3600 [program:scheduler] @@ -31,7 +34,10 @@ command=supercronic -overlapping /etc/supercronic/laravel user=%(ENV_USER)s autostart=%(ENV_WITH_SCHEDULER)s autorestart=true -stdout_logfile=%(ENV_ROOT)s/scheduler.log +stdout_logfile=%(ENV_ROOT)s/storage/logs/scheduler.log +stdout_logfile_maxbytes=0 +stderr_logfile=%(ENV_ROOT)s/storage/logs/scheduler.log +stderr_logfile_maxbytes=0 [program:clear-scheduler-cache] process_name=%(program_name)s_%(process_num)02d @@ -39,4 +45,7 @@ command=php %(ENV_ROOT)s/artisan schedule:clear-cache user=%(ENV_USER)s autostart=%(ENV_WITH_SCHEDULER)s autorestart=false -stdout_logfile=%(ENV_ROOT)s/scheduler.log \ No newline at end of file +stdout_logfile=%(ENV_ROOT)s/storage/logs/scheduler.log +stdout_logfile_maxbytes=0 +stderr_logfile=%(ENV_ROOT)s/storage/logs/scheduler.log +stderr_logfile_maxbytes=0 \ No newline at end of file