From af662a02fb10d7d5072fc20fa06c0379e141cc6f Mon Sep 17 00:00:00 2001 From: Daniel Polito Date: Wed, 4 Sep 2024 13:03:50 -0300 Subject: [PATCH 1/2] Add autorestart to Supervisor config --- 8.0-swoole-nginx-prod/supervisor.conf | 4 +++- 8.0-swoole-nginx/supervisor.conf | 4 +++- 8.0-swoole-prod/Dockerfile | 16 ++++++++++------ 8.0-swoole/Dockerfile | 16 ++++++++++------ 8.1-swoole-nginx-prod/supervisor.conf | 4 +++- 8.1-swoole-nginx/supervisor.conf | 4 +++- 8.1-swoole-prod/Dockerfile | 16 ++++++++++------ 8.1-swoole/Dockerfile | 16 ++++++++++------ 8.2-swoole-nginx-prod/supervisor.conf | 4 +++- 8.2-swoole-nginx/supervisor.conf | 4 +++- 8.2-swoole-prod/Dockerfile | 16 ++++++++++------ 8.2-swoole/Dockerfile | 16 ++++++++++------ 8.3-swoole-nginx-prod/supervisor.conf | 4 +++- 8.3-swoole-nginx/supervisor.conf | 4 +++- 8.3-swoole-prod/Dockerfile | 16 ++++++++++------ 8.3-swoole/Dockerfile | 16 ++++++++++------ template/Dockerfile.blade.php | 16 ++++++++++------ template/supervisor-conf.blade.php | 4 +++- 18 files changed, 117 insertions(+), 63 deletions(-) diff --git a/8.0-swoole-nginx-prod/supervisor.conf b/8.0-swoole-nginx-prod/supervisor.conf index 312fe84..1737e28 100644 --- a/8.0-swoole-nginx-prod/supervisor.conf +++ b/8.0-swoole-nginx-prod/supervisor.conf @@ -1,12 +1,14 @@ [program:nginx] depends_on = octane command = nginx -g "daemon off;" +autorestart = true stopasgroup = true stderr_logfile = /dev/stderr stdout_logfile = /dev/stdout [program:octane] -command = su-exec kool php artisan octane:start --server=swoole +command = su-exec kool php artisan octane:start +autorestart = true stopasgroup = true stderr_logfile = /dev/stderr stdout_logfile = /dev/stdout diff --git a/8.0-swoole-nginx/supervisor.conf b/8.0-swoole-nginx/supervisor.conf index b5cdc25..ac7aa23 100644 --- a/8.0-swoole-nginx/supervisor.conf +++ b/8.0-swoole-nginx/supervisor.conf @@ -1,12 +1,14 @@ [program:nginx] depends_on = octane command = nginx -g "daemon off;" +autorestart = true stopasgroup = true stderr_logfile = /dev/stderr stdout_logfile = /dev/stdout [program:octane] -command = su-exec kool php artisan octane:start --server=swoole --watch +command = su-exec kool php artisan octane:start --watch +autorestart = true stopasgroup = true stderr_logfile = /dev/stderr stdout_logfile = /dev/stdout diff --git a/8.0-swoole-prod/Dockerfile b/8.0-swoole-prod/Dockerfile index b1875ec..6257d2b 100644 --- a/8.0-swoole-prod/Dockerfile +++ b/8.0-swoole-prod/Dockerfile @@ -1,8 +1,12 @@ FROM kooldev/php:8.0-prod -RUN apk add --no-cache --virtual .build-deps $PHPIZE_DEPS && \ - pecl install swoole && \ - docker-php-ext-enable swoole && \ - # cleanup - apk del .build-deps && \ - rm -rf /var/cache/apk/* /tmp/* +COPY --from=mlocati/php-extension-installer /usr/bin/install-php-extensions /usr/local/bin/ + +RUN install-php-extensions swoole + +# RUN apk add --no-cache --virtual .build-deps $PHPIZE_DEPS && \ +# pecl install swoole && \ +# docker-php-ext-enable swoole && \ +# # cleanup +# apk del .build-deps && \ +# rm -rf /var/cache/apk/* /tmp/* diff --git a/8.0-swoole/Dockerfile b/8.0-swoole/Dockerfile index 12c71b6..33f2377 100644 --- a/8.0-swoole/Dockerfile +++ b/8.0-swoole/Dockerfile @@ -1,8 +1,12 @@ FROM kooldev/php:8.0-node -RUN apk add --no-cache --virtual .build-deps $PHPIZE_DEPS && \ - pecl install swoole && \ - docker-php-ext-enable swoole && \ - # cleanup - apk del .build-deps && \ - rm -rf /var/cache/apk/* /tmp/* +COPY --from=mlocati/php-extension-installer /usr/bin/install-php-extensions /usr/local/bin/ + +RUN install-php-extensions swoole + +# RUN apk add --no-cache --virtual .build-deps $PHPIZE_DEPS && \ +# pecl install swoole && \ +# docker-php-ext-enable swoole && \ +# # cleanup +# apk del .build-deps && \ +# rm -rf /var/cache/apk/* /tmp/* diff --git a/8.1-swoole-nginx-prod/supervisor.conf b/8.1-swoole-nginx-prod/supervisor.conf index 312fe84..1737e28 100644 --- a/8.1-swoole-nginx-prod/supervisor.conf +++ b/8.1-swoole-nginx-prod/supervisor.conf @@ -1,12 +1,14 @@ [program:nginx] depends_on = octane command = nginx -g "daemon off;" +autorestart = true stopasgroup = true stderr_logfile = /dev/stderr stdout_logfile = /dev/stdout [program:octane] -command = su-exec kool php artisan octane:start --server=swoole +command = su-exec kool php artisan octane:start +autorestart = true stopasgroup = true stderr_logfile = /dev/stderr stdout_logfile = /dev/stdout diff --git a/8.1-swoole-nginx/supervisor.conf b/8.1-swoole-nginx/supervisor.conf index b5cdc25..ac7aa23 100644 --- a/8.1-swoole-nginx/supervisor.conf +++ b/8.1-swoole-nginx/supervisor.conf @@ -1,12 +1,14 @@ [program:nginx] depends_on = octane command = nginx -g "daemon off;" +autorestart = true stopasgroup = true stderr_logfile = /dev/stderr stdout_logfile = /dev/stdout [program:octane] -command = su-exec kool php artisan octane:start --server=swoole --watch +command = su-exec kool php artisan octane:start --watch +autorestart = true stopasgroup = true stderr_logfile = /dev/stderr stdout_logfile = /dev/stdout diff --git a/8.1-swoole-prod/Dockerfile b/8.1-swoole-prod/Dockerfile index 868c47a..40a315a 100644 --- a/8.1-swoole-prod/Dockerfile +++ b/8.1-swoole-prod/Dockerfile @@ -1,8 +1,12 @@ FROM kooldev/php:8.1-prod -RUN apk add --no-cache --virtual .build-deps $PHPIZE_DEPS && \ - pecl install swoole && \ - docker-php-ext-enable swoole && \ - # cleanup - apk del .build-deps && \ - rm -rf /var/cache/apk/* /tmp/* +COPY --from=mlocati/php-extension-installer /usr/bin/install-php-extensions /usr/local/bin/ + +RUN install-php-extensions swoole + +# RUN apk add --no-cache --virtual .build-deps $PHPIZE_DEPS && \ +# pecl install swoole && \ +# docker-php-ext-enable swoole && \ +# # cleanup +# apk del .build-deps && \ +# rm -rf /var/cache/apk/* /tmp/* diff --git a/8.1-swoole/Dockerfile b/8.1-swoole/Dockerfile index 3aaa6a9..62d5b49 100644 --- a/8.1-swoole/Dockerfile +++ b/8.1-swoole/Dockerfile @@ -1,8 +1,12 @@ FROM kooldev/php:8.1-node -RUN apk add --no-cache --virtual .build-deps $PHPIZE_DEPS && \ - pecl install swoole && \ - docker-php-ext-enable swoole && \ - # cleanup - apk del .build-deps && \ - rm -rf /var/cache/apk/* /tmp/* +COPY --from=mlocati/php-extension-installer /usr/bin/install-php-extensions /usr/local/bin/ + +RUN install-php-extensions swoole + +# RUN apk add --no-cache --virtual .build-deps $PHPIZE_DEPS && \ +# pecl install swoole && \ +# docker-php-ext-enable swoole && \ +# # cleanup +# apk del .build-deps && \ +# rm -rf /var/cache/apk/* /tmp/* diff --git a/8.2-swoole-nginx-prod/supervisor.conf b/8.2-swoole-nginx-prod/supervisor.conf index 312fe84..1737e28 100644 --- a/8.2-swoole-nginx-prod/supervisor.conf +++ b/8.2-swoole-nginx-prod/supervisor.conf @@ -1,12 +1,14 @@ [program:nginx] depends_on = octane command = nginx -g "daemon off;" +autorestart = true stopasgroup = true stderr_logfile = /dev/stderr stdout_logfile = /dev/stdout [program:octane] -command = su-exec kool php artisan octane:start --server=swoole +command = su-exec kool php artisan octane:start +autorestart = true stopasgroup = true stderr_logfile = /dev/stderr stdout_logfile = /dev/stdout diff --git a/8.2-swoole-nginx/supervisor.conf b/8.2-swoole-nginx/supervisor.conf index b5cdc25..ac7aa23 100644 --- a/8.2-swoole-nginx/supervisor.conf +++ b/8.2-swoole-nginx/supervisor.conf @@ -1,12 +1,14 @@ [program:nginx] depends_on = octane command = nginx -g "daemon off;" +autorestart = true stopasgroup = true stderr_logfile = /dev/stderr stdout_logfile = /dev/stdout [program:octane] -command = su-exec kool php artisan octane:start --server=swoole --watch +command = su-exec kool php artisan octane:start --watch +autorestart = true stopasgroup = true stderr_logfile = /dev/stderr stdout_logfile = /dev/stdout diff --git a/8.2-swoole-prod/Dockerfile b/8.2-swoole-prod/Dockerfile index 54e654e..6ceafc8 100644 --- a/8.2-swoole-prod/Dockerfile +++ b/8.2-swoole-prod/Dockerfile @@ -1,8 +1,12 @@ FROM kooldev/php:8.2-prod -RUN apk add --no-cache --virtual .build-deps $PHPIZE_DEPS && \ - pecl install swoole && \ - docker-php-ext-enable swoole && \ - # cleanup - apk del .build-deps && \ - rm -rf /var/cache/apk/* /tmp/* +COPY --from=mlocati/php-extension-installer /usr/bin/install-php-extensions /usr/local/bin/ + +RUN install-php-extensions swoole + +# RUN apk add --no-cache --virtual .build-deps $PHPIZE_DEPS && \ +# pecl install swoole && \ +# docker-php-ext-enable swoole && \ +# # cleanup +# apk del .build-deps && \ +# rm -rf /var/cache/apk/* /tmp/* diff --git a/8.2-swoole/Dockerfile b/8.2-swoole/Dockerfile index caacf3f..731708b 100644 --- a/8.2-swoole/Dockerfile +++ b/8.2-swoole/Dockerfile @@ -1,8 +1,12 @@ FROM kooldev/php:8.2-node -RUN apk add --no-cache --virtual .build-deps $PHPIZE_DEPS && \ - pecl install swoole && \ - docker-php-ext-enable swoole && \ - # cleanup - apk del .build-deps && \ - rm -rf /var/cache/apk/* /tmp/* +COPY --from=mlocati/php-extension-installer /usr/bin/install-php-extensions /usr/local/bin/ + +RUN install-php-extensions swoole + +# RUN apk add --no-cache --virtual .build-deps $PHPIZE_DEPS && \ +# pecl install swoole && \ +# docker-php-ext-enable swoole && \ +# # cleanup +# apk del .build-deps && \ +# rm -rf /var/cache/apk/* /tmp/* diff --git a/8.3-swoole-nginx-prod/supervisor.conf b/8.3-swoole-nginx-prod/supervisor.conf index 312fe84..1737e28 100644 --- a/8.3-swoole-nginx-prod/supervisor.conf +++ b/8.3-swoole-nginx-prod/supervisor.conf @@ -1,12 +1,14 @@ [program:nginx] depends_on = octane command = nginx -g "daemon off;" +autorestart = true stopasgroup = true stderr_logfile = /dev/stderr stdout_logfile = /dev/stdout [program:octane] -command = su-exec kool php artisan octane:start --server=swoole +command = su-exec kool php artisan octane:start +autorestart = true stopasgroup = true stderr_logfile = /dev/stderr stdout_logfile = /dev/stdout diff --git a/8.3-swoole-nginx/supervisor.conf b/8.3-swoole-nginx/supervisor.conf index b5cdc25..ac7aa23 100644 --- a/8.3-swoole-nginx/supervisor.conf +++ b/8.3-swoole-nginx/supervisor.conf @@ -1,12 +1,14 @@ [program:nginx] depends_on = octane command = nginx -g "daemon off;" +autorestart = true stopasgroup = true stderr_logfile = /dev/stderr stdout_logfile = /dev/stdout [program:octane] -command = su-exec kool php artisan octane:start --server=swoole --watch +command = su-exec kool php artisan octane:start --watch +autorestart = true stopasgroup = true stderr_logfile = /dev/stderr stdout_logfile = /dev/stdout diff --git a/8.3-swoole-prod/Dockerfile b/8.3-swoole-prod/Dockerfile index 3f1f9a7..84c2d39 100644 --- a/8.3-swoole-prod/Dockerfile +++ b/8.3-swoole-prod/Dockerfile @@ -1,8 +1,12 @@ FROM kooldev/php:8.3-prod -RUN apk add --no-cache --virtual .build-deps $PHPIZE_DEPS && \ - pecl install swoole && \ - docker-php-ext-enable swoole && \ - # cleanup - apk del .build-deps && \ - rm -rf /var/cache/apk/* /tmp/* +COPY --from=mlocati/php-extension-installer /usr/bin/install-php-extensions /usr/local/bin/ + +RUN install-php-extensions swoole + +# RUN apk add --no-cache --virtual .build-deps $PHPIZE_DEPS && \ +# pecl install swoole && \ +# docker-php-ext-enable swoole && \ +# # cleanup +# apk del .build-deps && \ +# rm -rf /var/cache/apk/* /tmp/* diff --git a/8.3-swoole/Dockerfile b/8.3-swoole/Dockerfile index 7b5060e..46eeaf8 100644 --- a/8.3-swoole/Dockerfile +++ b/8.3-swoole/Dockerfile @@ -1,8 +1,12 @@ FROM kooldev/php:8.3-node -RUN apk add --no-cache --virtual .build-deps $PHPIZE_DEPS && \ - pecl install swoole && \ - docker-php-ext-enable swoole && \ - # cleanup - apk del .build-deps && \ - rm -rf /var/cache/apk/* /tmp/* +COPY --from=mlocati/php-extension-installer /usr/bin/install-php-extensions /usr/local/bin/ + +RUN install-php-extensions swoole + +# RUN apk add --no-cache --virtual .build-deps $PHPIZE_DEPS && \ +# pecl install swoole && \ +# docker-php-ext-enable swoole && \ +# # cleanup +# apk del .build-deps && \ +# rm -rf /var/cache/apk/* /tmp/* diff --git a/template/Dockerfile.blade.php b/template/Dockerfile.blade.php index a0f786b..0854157 100644 --- a/template/Dockerfile.blade.php +++ b/template/Dockerfile.blade.php @@ -1,8 +1,12 @@ FROM {{ $from }} -RUN apk add --no-cache --virtual .build-deps $PHPIZE_DEPS && \ - pecl install swoole && \ - docker-php-ext-enable swoole && \ - # cleanup - apk del .build-deps && \ - rm -rf /var/cache/apk/* /tmp/* +COPY --from=mlocati/php-extension-installer /usr/bin/install-php-extensions /usr/local/bin/ + +RUN install-php-extensions swoole + +# RUN apk add --no-cache --virtual .build-deps $PHPIZE_DEPS && \ +# pecl install swoole && \ +# docker-php-ext-enable swoole && \ +# # cleanup +# apk del .build-deps && \ +# rm -rf /var/cache/apk/* /tmp/* diff --git a/template/supervisor-conf.blade.php b/template/supervisor-conf.blade.php index dc14f5d..e8d1784 100644 --- a/template/supervisor-conf.blade.php +++ b/template/supervisor-conf.blade.php @@ -1,12 +1,14 @@ [program:nginx] depends_on = octane command = nginx -g "daemon off;" +autorestart = true stopasgroup = true stderr_logfile = /dev/stderr stdout_logfile = /dev/stdout [program:octane] -command = su-exec kool php artisan octane:start --server=swoole{!! $prod ? '' : ' --watch' !!} +command = su-exec kool php artisan octane:start{!! $prod ? '' : ' --watch' !!} +autorestart = true stopasgroup = true stderr_logfile = /dev/stderr stdout_logfile = /dev/stdout From 88571df54a354f213960da35cbc2a6be366dd03c Mon Sep 17 00:00:00 2001 From: Daniel Polito Date: Wed, 4 Sep 2024 13:32:02 -0300 Subject: [PATCH 2/2] tweak --- 8.0-swoole-prod/Dockerfile | 7 ------- 8.0-swoole/Dockerfile | 7 ------- 8.1-swoole-prod/Dockerfile | 7 ------- 8.1-swoole/Dockerfile | 7 ------- 8.2-swoole-prod/Dockerfile | 7 ------- 8.2-swoole/Dockerfile | 7 ------- 8.3-swoole-prod/Dockerfile | 7 ------- 8.3-swoole/Dockerfile | 7 ------- template/Dockerfile.blade.php | 7 ------- 9 files changed, 63 deletions(-) diff --git a/8.0-swoole-prod/Dockerfile b/8.0-swoole-prod/Dockerfile index 6257d2b..27d619a 100644 --- a/8.0-swoole-prod/Dockerfile +++ b/8.0-swoole-prod/Dockerfile @@ -3,10 +3,3 @@ FROM kooldev/php:8.0-prod COPY --from=mlocati/php-extension-installer /usr/bin/install-php-extensions /usr/local/bin/ RUN install-php-extensions swoole - -# RUN apk add --no-cache --virtual .build-deps $PHPIZE_DEPS && \ -# pecl install swoole && \ -# docker-php-ext-enable swoole && \ -# # cleanup -# apk del .build-deps && \ -# rm -rf /var/cache/apk/* /tmp/* diff --git a/8.0-swoole/Dockerfile b/8.0-swoole/Dockerfile index 33f2377..0121e31 100644 --- a/8.0-swoole/Dockerfile +++ b/8.0-swoole/Dockerfile @@ -3,10 +3,3 @@ FROM kooldev/php:8.0-node COPY --from=mlocati/php-extension-installer /usr/bin/install-php-extensions /usr/local/bin/ RUN install-php-extensions swoole - -# RUN apk add --no-cache --virtual .build-deps $PHPIZE_DEPS && \ -# pecl install swoole && \ -# docker-php-ext-enable swoole && \ -# # cleanup -# apk del .build-deps && \ -# rm -rf /var/cache/apk/* /tmp/* diff --git a/8.1-swoole-prod/Dockerfile b/8.1-swoole-prod/Dockerfile index 40a315a..281ffd1 100644 --- a/8.1-swoole-prod/Dockerfile +++ b/8.1-swoole-prod/Dockerfile @@ -3,10 +3,3 @@ FROM kooldev/php:8.1-prod COPY --from=mlocati/php-extension-installer /usr/bin/install-php-extensions /usr/local/bin/ RUN install-php-extensions swoole - -# RUN apk add --no-cache --virtual .build-deps $PHPIZE_DEPS && \ -# pecl install swoole && \ -# docker-php-ext-enable swoole && \ -# # cleanup -# apk del .build-deps && \ -# rm -rf /var/cache/apk/* /tmp/* diff --git a/8.1-swoole/Dockerfile b/8.1-swoole/Dockerfile index 62d5b49..68c158f 100644 --- a/8.1-swoole/Dockerfile +++ b/8.1-swoole/Dockerfile @@ -3,10 +3,3 @@ FROM kooldev/php:8.1-node COPY --from=mlocati/php-extension-installer /usr/bin/install-php-extensions /usr/local/bin/ RUN install-php-extensions swoole - -# RUN apk add --no-cache --virtual .build-deps $PHPIZE_DEPS && \ -# pecl install swoole && \ -# docker-php-ext-enable swoole && \ -# # cleanup -# apk del .build-deps && \ -# rm -rf /var/cache/apk/* /tmp/* diff --git a/8.2-swoole-prod/Dockerfile b/8.2-swoole-prod/Dockerfile index 6ceafc8..5ab1100 100644 --- a/8.2-swoole-prod/Dockerfile +++ b/8.2-swoole-prod/Dockerfile @@ -3,10 +3,3 @@ FROM kooldev/php:8.2-prod COPY --from=mlocati/php-extension-installer /usr/bin/install-php-extensions /usr/local/bin/ RUN install-php-extensions swoole - -# RUN apk add --no-cache --virtual .build-deps $PHPIZE_DEPS && \ -# pecl install swoole && \ -# docker-php-ext-enable swoole && \ -# # cleanup -# apk del .build-deps && \ -# rm -rf /var/cache/apk/* /tmp/* diff --git a/8.2-swoole/Dockerfile b/8.2-swoole/Dockerfile index 731708b..09553f4 100644 --- a/8.2-swoole/Dockerfile +++ b/8.2-swoole/Dockerfile @@ -3,10 +3,3 @@ FROM kooldev/php:8.2-node COPY --from=mlocati/php-extension-installer /usr/bin/install-php-extensions /usr/local/bin/ RUN install-php-extensions swoole - -# RUN apk add --no-cache --virtual .build-deps $PHPIZE_DEPS && \ -# pecl install swoole && \ -# docker-php-ext-enable swoole && \ -# # cleanup -# apk del .build-deps && \ -# rm -rf /var/cache/apk/* /tmp/* diff --git a/8.3-swoole-prod/Dockerfile b/8.3-swoole-prod/Dockerfile index 84c2d39..7c5a7cf 100644 --- a/8.3-swoole-prod/Dockerfile +++ b/8.3-swoole-prod/Dockerfile @@ -3,10 +3,3 @@ FROM kooldev/php:8.3-prod COPY --from=mlocati/php-extension-installer /usr/bin/install-php-extensions /usr/local/bin/ RUN install-php-extensions swoole - -# RUN apk add --no-cache --virtual .build-deps $PHPIZE_DEPS && \ -# pecl install swoole && \ -# docker-php-ext-enable swoole && \ -# # cleanup -# apk del .build-deps && \ -# rm -rf /var/cache/apk/* /tmp/* diff --git a/8.3-swoole/Dockerfile b/8.3-swoole/Dockerfile index 46eeaf8..e2ddbb8 100644 --- a/8.3-swoole/Dockerfile +++ b/8.3-swoole/Dockerfile @@ -3,10 +3,3 @@ FROM kooldev/php:8.3-node COPY --from=mlocati/php-extension-installer /usr/bin/install-php-extensions /usr/local/bin/ RUN install-php-extensions swoole - -# RUN apk add --no-cache --virtual .build-deps $PHPIZE_DEPS && \ -# pecl install swoole && \ -# docker-php-ext-enable swoole && \ -# # cleanup -# apk del .build-deps && \ -# rm -rf /var/cache/apk/* /tmp/* diff --git a/template/Dockerfile.blade.php b/template/Dockerfile.blade.php index 0854157..c20f1d8 100644 --- a/template/Dockerfile.blade.php +++ b/template/Dockerfile.blade.php @@ -3,10 +3,3 @@ COPY --from=mlocati/php-extension-installer /usr/bin/install-php-extensions /usr/local/bin/ RUN install-php-extensions swoole - -# RUN apk add --no-cache --virtual .build-deps $PHPIZE_DEPS && \ -# pecl install swoole && \ -# docker-php-ext-enable swoole && \ -# # cleanup -# apk del .build-deps && \ -# rm -rf /var/cache/apk/* /tmp/*