From a6644abaa2474d46636ca35cd947136de5e1b58e Mon Sep 17 00:00:00 2001 From: David Bomba Date: Thu, 28 Jan 2021 19:55:20 +1100 Subject: [PATCH] Add supervisor to DockerFile --- alpine/Dockerfile_v5 | 8 ++++++-- config/supervisor/supervisord.conf | 29 +++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+), 2 deletions(-) create mode 100644 config/supervisor/supervisord.conf diff --git a/alpine/Dockerfile_v5 b/alpine/Dockerfile_v5 index 59bcfe4..089c05b 100644 --- a/alpine/Dockerfile_v5 +++ b/alpine/Dockerfile_v5 @@ -28,7 +28,9 @@ RUN npm install --production \ && npm run production \ && rm -rf node_modules \ && mv /var/www/app/storage $BAK_STORAGE_PATH \ - && mv /var/www/app/public $BAK_PUBLIC_PATH + && mv /var/www/app/public $BAK_PUBLIC_PATH \ + && mkdir /var/log/supervisord /var/run/supervisord \ + && chown $INVOICENINJA_USER:www-data /var/log/supervisord /var/run/supervisord # Prepare php image FROM php:${PHP_VERSION}-fpm-alpine @@ -66,12 +68,14 @@ RUN install-php-extensions \ # Install chromium RUN set -eux; \ apk add --no-cache \ + supervisor \ mysql-client \ git \ chromium \ ttf-freefont COPY ./config/php/php.ini /usr/local/etc/php/conf.d/in-php.ini +COPY ./config/supervisor/supervisord.conf / ## Separate user ARG UID=1500 @@ -98,4 +102,4 @@ ENV LOG errorlog ENV SNAPPDF_EXECUTABLE_PATH /usr/bin/chromium-browser ENTRYPOINT ["docker-entrypoint"] -CMD ["php-fpm"] +CMD ["/usr/bin/supervisord", "-c", "/supervisord.conf"] \ No newline at end of file diff --git a/config/supervisor/supervisord.conf b/config/supervisor/supervisord.conf new file mode 100644 index 0000000..33bd482 --- /dev/null +++ b/config/supervisor/supervisord.conf @@ -0,0 +1,29 @@ +[supervisord] +nodaemon=true +user=invoiceninja +pidfile=/var/run/supervisord/supervisord.pid +logfile=/dev/null ; nodaemon will cause logs to go to stdout +logfile_maxbytes=0 +loglevel=error + +[program:php-fpm] +stdout_logfile=/dev/stdout +stdout_logfile_maxbytes=0 +stderr_logfile=/dev/stderr +stderr_logfile_maxbytes=0 +command=php-fpm + +[program:scheduler] +stdout_logfile=/dev/stdout +stdout_logfile_maxbytes=0 +stderr_logfile=/dev/stderr +stderr_logfile_maxbytes=0 +command=php artisan schedule:work + +[program:queue-worker] +stdout_logfile=/dev/stdout +stdout_logfile_maxbytes=0 +stderr_logfile=/dev/stderr +stderr_logfile_maxbytes=0 +numprocs=2 +command=php artisan queue:work --sleep=3 --tries=1 --memory=1024 --timeout=3600 --daemon \ No newline at end of file