From 7a171b96c70b547261cdb4ca0c194076dbee3fa1 Mon Sep 17 00:00:00 2001 From: Benjamin Brummer Date: Sun, 12 Jan 2025 10:46:52 +0000 Subject: [PATCH 01/16] align with debian, php 8.3 --- alpine/5/Dockerfile | 53 +++++++++++++--------------- alpine/5/rootfs/etc/supervisord.conf | 3 -- docker-compose.yml | 6 ++-- 3 files changed, 27 insertions(+), 35 deletions(-) diff --git a/alpine/5/Dockerfile b/alpine/5/Dockerfile index cf5dea6d..5b573ab5 100644 --- a/alpine/5/Dockerfile +++ b/alpine/5/Dockerfile @@ -1,42 +1,44 @@ -ARG PHP_VERSION=8.2 +ARG PHP_VERSION=8.3 ARG BAK_STORAGE_PATH=/var/www/app/docker-backup-storage/ ARG BAK_PUBLIC_PATH=/var/www/app/docker-backup-public/ # Get Invoice Ninja and install nodejs packages -FROM --platform=$BUILDPLATFORM node:lts-alpine as nodebuild +FROM --platform=$BUILDPLATFORM php:${PHP_VERSION}-fpm-alpine AS nodebuild # Download Invoice Ninja ARG INVOICENINJA_VERSION ARG REPOSITORY=invoiceninja/invoiceninja ARG FILENAME=invoiceninja.tar -RUN set -eux; apk add curl unzip grep - -RUN DOWNLOAD_URL=$(curl -s "https://api.github.com/repos/invoiceninja/invoiceninja/releases/latest" | grep -o '"browser_download_url": "[^"]*invoiceninja.tar"' | cut -d '"' -f 4) && \ - curl -LJO "$DOWNLOAD_URL" && \ - mv invoiceninja.tar /tmp/ninja.tar +RUN mkdir -p /var/www/app # Extract Invoice Ninja -RUN mkdir -p /var/www/app \ - && tar -xvf /tmp/ninja.tar -C /var/www/app/ \ - && mkdir -p /var/www/app/public/logo /var/www/app/storage - +RUN apk add --no-cache curl \ + && curl -s "https://api.github.com/repos/invoiceninja/invoiceninja/releases/latest" | \ + grep -o '"browser_download_url": "[^"]*invoiceninja.tar.gz"' | \ + cut -d '"' -f 4 | \ + xargs curl -sL | \ + tar -xz --strip-components=1 -C /var/www/app/ \ + && apk --purge del curl + +RUN mkdir -p /var/www/app/public/logo /var/www/app/storage + WORKDIR /var/www/app # Prepare php image -FROM php:${PHP_VERSION}-fpm-alpine as phpbuild +FROM php:${PHP_VERSION}-fpm-alpine AS phpbuild LABEL maintainer="David Bomba " +ARG php_require="bcmath gd pdo_mysql zip" +ARG php_suggest="exif imagick intl pcntl soap" +ARG php_extra="opcache" + # Adding caching_sha2_password.so # With this we get native support for caching_sha2_password RUN apk add --no-cache mariadb-connector-c -RUN mv /usr/local/etc/php/php.ini-production /usr/local/etc/php/php.ini - -# Install PHP extensions -# https://hub.docker.com/r/mlocati/php-extension-installer/tags -COPY --from=mlocati/php-extension-installer /usr/bin/install-php-extensions /usr/local/bin/ +RUN ln -s "${PHP_INI_DIR}/php.ini-production" "${PHP_INI_DIR}/php.ini" # Install chromium RUN set -eux; \ @@ -48,18 +50,11 @@ RUN set -eux; \ ttf-freefont \ ttf-dejavu -RUN install-php-extensions \ - bcmath \ - exif \ - gd \ - gmp \ - mysqli \ - opcache \ - pdo_mysql \ - zip \ - intl \ - @composer \ - && rm /usr/local/bin/install-php-extensions +# Install PHP extensions +RUN ( curl -sSLf https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions -o - || echo 'return 1' ) | sh -s \ + ${php_require} \ + ${php_suggest} \ + ${php_extra} # Copy files COPY rootfs / diff --git a/alpine/5/rootfs/etc/supervisord.conf b/alpine/5/rootfs/etc/supervisord.conf index 3ca2d928..b4817b9f 100644 --- a/alpine/5/rootfs/etc/supervisord.conf +++ b/alpine/5/rootfs/etc/supervisord.conf @@ -6,7 +6,6 @@ logfile_maxbytes=0 loglevel=info [program:php-fpm] -redirect_stderr=true stdout_logfile=/dev/stdout stdout_logfile_maxbytes=0 stderr_logfile=/dev/stderr @@ -15,7 +14,6 @@ command=php-fpm [program:scheduler] autorestart=true -redirect_stderr=true stdout_logfile=/dev/stdout stdout_logfile_maxbytes=0 stderr_logfile=/dev/stderr @@ -25,7 +23,6 @@ command=php artisan schedule:work [program:queue-worker] process_name=%(program_name)s_%(process_num)02d autorestart=true -redirect_stderr=true stdout_logfile=/dev/stdout stdout_logfile_maxbytes=0 stderr_logfile=/dev/stderr diff --git a/docker-compose.yml b/docker-compose.yml index 187a7422..ab26b260 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,5 +1,3 @@ -version: '3.7' - services: server: image: nginx @@ -23,7 +21,9 @@ services: - "in5.localhost:192.168.0.124 " #host and ip app: - image: invoiceninja/invoiceninja:5 + build: + context: ./alpine/5 + image: invoiceninja/invoiceninja:${TAG:-5} env_file: env restart: always volumes: From 103b912467d2b70f31f9168c093737215f2f7e5d Mon Sep 17 00:00:00 2001 From: Benjamin Brummer Date: Sun, 12 Jan 2025 11:12:38 +0000 Subject: [PATCH 02/16] align nginx with debian --- config/nginx/in-vhost.conf | 34 ---------------------------------- config/nginx/invoiceninja.conf | 14 ++++++++++++++ config/nginx/laravel.conf | 32 ++++++++++++++++++++++++++++++++ 3 files changed, 46 insertions(+), 34 deletions(-) delete mode 100644 config/nginx/in-vhost.conf create mode 100644 config/nginx/invoiceninja.conf create mode 100644 config/nginx/laravel.conf diff --git a/config/nginx/in-vhost.conf b/config/nginx/in-vhost.conf deleted file mode 100644 index cf262f72..00000000 --- a/config/nginx/in-vhost.conf +++ /dev/null @@ -1,34 +0,0 @@ -server { - listen 80 default_server; - server_name _; - - server_tokens off; - - client_max_body_size 100M; - - root /var/www/app/public/; - index index.php; - - location / { - try_files $uri $uri/ /index.php?$query_string; - } - - location = /favicon.ico { access_log off; log_not_found off; } - location = /robots.txt { access_log off; log_not_found off; } - - - location ~* /storage/.*\.php$ { - return 503; - } - - location ~ \.php$ { - fastcgi_split_path_info ^(.+\.php)(/.+)$; - fastcgi_pass app:9000; - fastcgi_index index.php; - include fastcgi_params; - fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; - fastcgi_intercept_errors off; - fastcgi_buffer_size 16k; - fastcgi_buffers 4 16k; - } -} diff --git a/config/nginx/invoiceninja.conf b/config/nginx/invoiceninja.conf new file mode 100644 index 00000000..78add9d1 --- /dev/null +++ b/config/nginx/invoiceninja.conf @@ -0,0 +1,14 @@ +# https://nginx.org/en/docs/http/ngx_http_core_module.html +client_max_body_size 10M; +client_body_buffer_size 10M; +server_tokens off; + +# https://nginx.org/en/docs/http/ngx_http_fastcgi_module.html +fastcgi_buffers 32 16K; + +# https://nginx.org/en/docs/http/ngx_http_gzip_module.html +gzip on; +gzip_comp_level 2; +gzip_min_length 1M; +gzip_proxied any; +gzip_types *; diff --git a/config/nginx/laravel.conf b/config/nginx/laravel.conf new file mode 100644 index 00000000..5edb43ad --- /dev/null +++ b/config/nginx/laravel.conf @@ -0,0 +1,32 @@ +# https://laravel.com/docs/master/deployment#nginx +server { + listen 80 default_server; + server_name _; + root /var/www/app/public; + + add_header X-Frame-Options "SAMEORIGIN"; + add_header X-Content-Type-Options "nosniff"; + + index index.php; + + charset utf-8; + + location / { + try_files $uri $uri/ /index.php?$query_string; + } + + location = /favicon.ico { access_log off; log_not_found off; } + location = /robots.txt { access_log off; log_not_found off; } + + error_page 404 /index.php; + + location ~ \.php$ { + fastcgi_pass app:9000; + fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name; + include fastcgi_params; + } + + location ~ /\.(?!well-known).* { + deny all; + } +} From 797aa6bdf80fe3a20d2a0112915b3299e4a5d312 Mon Sep 17 00:00:00 2001 From: Benjamin Brummer Date: Sun, 12 Jan 2025 11:43:08 +0000 Subject: [PATCH 03/16] redis/valkey cache --- docker-compose.yml | 9 +++++++++ env | 7 ++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index ab26b260..4482edde 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -82,6 +82,15 @@ services: # networks: # - invoiceninja # + valkey: + image: valkey/valkey:8 + restart: unless-stopped + healthcheck: + test: [ "CMD", "valkey-cli", "ping" ] + start_period: 10s + networks: + - invoiceninja + logging: *default-logging networks: invoiceninja: diff --git a/env b/env index eb49e7d6..9d99e599 100644 --- a/env +++ b/env @@ -7,8 +7,13 @@ PHANTOMJS_PDF_GENERATION=false PDF_GENERATOR=snappdf TRUSTED_PROXIES='*' +CACHE_DRIVER=redis +QUEUE_CONNECTION=redis +SESSION_DRIVER=redis -QUEUE_CONNECTION=database +REDIS_HOST=valkey +REDIS_PASSWORD=null +REDIS_PORT=6379 # DB connection DB_HOST=db From cbaf961012e754491248bf134597a051b06e54ab Mon Sep 17 00:00:00 2001 From: Benjamin Brummer Date: Sun, 12 Jan 2025 12:27:20 +0000 Subject: [PATCH 04/16] update php.ini, fix for valkey configuration --- config/php/php.ini | 38 ++++++++++++++++++++------------------ docker-compose.yml | 7 +++---- 2 files changed, 23 insertions(+), 22 deletions(-) diff --git a/config/php/php.ini b/config/php/php.ini index f5298a68..3039423f 100644 --- a/config/php/php.ini +++ b/config/php/php.ini @@ -1,21 +1,23 @@ -session.auto_start = Off -short_open_tag = Off +[core] +; https://www.php.net/manual/en/ini.core.php +post_max_size=10M +upload_max_filesize=10M -error_reporting = E_ALL & ~E_NOTICE & ~E_WARNING & ~E_STRICT & ~E_DEPRECATED +[opcache] +; https://www.php.net/manual/en/opcache.installation.php#opcache.installation.recommended +opcache.enable_cli=1 -; opcache.enable=1 -; opcache.preload=/var/www/app/preload.php -; opcache.preload_user=www-data +[jit] +; https://wiki.php.net/rfc/jit_config_defaults +opcache.jit=tracing +opcache.jit_buffer_size=64M -; ; The OPcache shared memory storage size. -; opcache.max_accelerated_files=300000 -; opcache.validate_timestamps=1 -; opcache.revalidate_freq=30 -; opcache.jit_buffer_size=256M -; opcache.jit=1205 -; opcache.memory_consumption=1024M - - -post_max_size = 60M -upload_max_filesize = 50M -memory_limit=512M +[extra] +; https://frankenphp.dev/docs/performance/#php-performance +; http://symfony.com/doc/current/performance.html +opcache.memory_consumption=256 +opcache.max_accelerated_files=20000 +opcache.preload=/var/www/app/preload.php +opcache.validate_timestamps=0 +realpath_cache_size = 4096K +realpath_cache_ttl = 600 diff --git a/docker-compose.yml b/docker-compose.yml index 4482edde..83223a50 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -6,7 +6,7 @@ services: volumes: # Vhost configuration #- ./config/caddy/Caddyfile:/etc/caddy/Caddyfiledocker-com - - ./config/nginx/in-vhost.conf:/etc/nginx/conf.d/in-vhost.conf:ro + - ./config/nginx:/etc/nginx/conf.d:ro - ./docker/app/public:/var/www/app/public:ro depends_on: - app @@ -30,11 +30,11 @@ services: - ./config/hosts:/etc/hosts:ro - ./docker/app/public:/var/www/app/public:rw,delegated - ./docker/app/storage:/var/www/app/storage:rw,delegated - - ./config/php/php.ini:/usr/local/etc/php/php.ini - - ./config/php/php-cli.ini:/usr/local/etc/php/php-cli.ini + - ./config/php/php.ini:/usr/local/etc/php/conf.d/invoiceninja.ini depends_on: - db + - valkey networks: - invoiceninja extra_hosts: @@ -90,7 +90,6 @@ services: start_period: 10s networks: - invoiceninja - logging: *default-logging networks: invoiceninja: From 9b63fc3fbcd149c674e6d56675f8626caca6a1ae Mon Sep 17 00:00:00 2001 From: Benjamin Brummer Date: Sun, 12 Jan 2025 14:03:31 +0000 Subject: [PATCH 05/16] php-fpm.conf, renamed server to nginx --- config/php/php-cli.ini | 18 ------------------ config/php/php-fpm.conf | 1 + docker-compose.yml | 3 ++- 3 files changed, 3 insertions(+), 19 deletions(-) delete mode 100644 config/php/php-cli.ini create mode 100644 config/php/php-fpm.conf diff --git a/config/php/php-cli.ini b/config/php/php-cli.ini deleted file mode 100644 index c66bcfbf..00000000 --- a/config/php/php-cli.ini +++ /dev/null @@ -1,18 +0,0 @@ -session.auto_start = Off -short_open_tag = Off - -error_reporting = E_ALL & ~E_NOTICE & ~E_WARNING & ~E_STRICT & ~E_DEPRECATED - -; opcache.enable_cli=1 -; opcache.fast_shutdown=1 -; opcache.memory_consumption=256 -; opcache.interned_strings_buffer=8 -; opcache.max_accelerated_files=4000 -; opcache.revalidate_freq=60 -; # http://symfony.com/doc/current/performance.html -; realpath_cache_size = 4096K -; realpath_cache_ttl = 600 - -memory_limit = 2G -post_max_size = 60M -upload_max_filesize = 50M \ No newline at end of file diff --git a/config/php/php-fpm.conf b/config/php/php-fpm.conf new file mode 100644 index 00000000..63bbada7 --- /dev/null +++ b/config/php/php-fpm.conf @@ -0,0 +1 @@ +pm.max_children = 10 diff --git a/docker-compose.yml b/docker-compose.yml index 83223a50..9dc3a49e 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,5 +1,5 @@ services: - server: + nginx: image: nginx restart: always env_file: env @@ -31,6 +31,7 @@ services: - ./docker/app/public:/var/www/app/public:rw,delegated - ./docker/app/storage:/var/www/app/storage:rw,delegated - ./config/php/php.ini:/usr/local/etc/php/conf.d/invoiceninja.ini + - ./config/php/php-fpm.conf:/usr/local/etc/php-fpm.d/invoiceninja.conf depends_on: - db From a520f32385215688bbfc8c71452e4666ab29e9db Mon Sep 17 00:00:00 2001 From: Benjamin Brummer Date: Mon, 13 Jan 2025 12:16:43 +0000 Subject: [PATCH 06/16] cleanup --- alpine/5/Dockerfile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/alpine/5/Dockerfile b/alpine/5/Dockerfile index 5b573ab5..7bd77f31 100644 --- a/alpine/5/Dockerfile +++ b/alpine/5/Dockerfile @@ -47,6 +47,8 @@ RUN set -eux; \ supervisor \ mysql-client \ chromium \ + # font-noto-cjk-extra \ + # font-wqy-zenhei \ ttf-freefont \ ttf-dejavu @@ -82,8 +84,6 @@ ENV BAK_STORAGE_PATH $BAK_STORAGE_PATH ENV BAK_PUBLIC_PATH $BAK_PUBLIC_PATH COPY --from=nodebuild --chown=$INVOICENINJA_USER:$INVOICENINJA_USER /var/www/app /var/www/app -RUN rm -rf /var/www/app/ui - USER $UID WORKDIR /var/www/app @@ -101,7 +101,7 @@ ARG BAK_PUBLIC_PATH RUN mv /var/www/app/storage $BAK_STORAGE_PATH \ && mv /var/www/app/public $BAK_PUBLIC_PATH -FROM phpbuild as prod +FROM phpbuild AS prod COPY --from=dependencybuild --chown=$INVOICENINJA_USER:$INVOICENINJA_USER /var/www/app /var/www/app From 977e2001f02707e4a6e6cb7df98ce0b40d7e8ee0 Mon Sep 17 00:00:00 2001 From: Benjamin Brummer Date: Mon, 13 Jan 2025 12:19:01 +0000 Subject: [PATCH 07/16] disable preload for artisan tinker --- alpine/5/rootfs/usr/local/bin/invoiceninja-init.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/alpine/5/rootfs/usr/local/bin/invoiceninja-init.sh b/alpine/5/rootfs/usr/local/bin/invoiceninja-init.sh index b4b2ee5a..f4a21bac 100755 --- a/alpine/5/rootfs/usr/local/bin/invoiceninja-init.sh +++ b/alpine/5/rootfs/usr/local/bin/invoiceninja-init.sh @@ -30,7 +30,7 @@ php artisan optimize php artisan package:discover # Check if DB works, if not crash the app. -DB_READY=$(php artisan tinker --execute='echo app()->call("App\Utils\SystemHealth@dbCheck")["success"];') +DB_READY=$(php -d opcache.preload='' artisan tinker --execute='echo app()->call("App\Utils\SystemHealth@dbCheck")["success"];') if [ "$DB_READY" != "1" ]; then php artisan migrate:status # Print verbose error in_error "Error connecting to DB" @@ -39,7 +39,7 @@ fi php artisan migrate --force # If first IN run, it needs to be initialized -IN_INIT=$(php artisan tinker --execute='echo Schema::hasTable("accounts") && !App\Models\Account::all()->first();') +IN_INIT=$(php -d opcache.preload='' artisan tinker --execute='echo Schema::hasTable("accounts") && !App\Models\Account::all()->first();') if [ "$IN_INIT" == "1" ]; then docker_process_init_files /docker-entrypoint-init.d/* fi From 7629f51492b3959a561b2fcbf8fc84c192ab2705 Mon Sep 17 00:00:00 2001 From: Benjamin Brummer Date: Tue, 14 Jan 2025 20:25:50 +0000 Subject: [PATCH 08/16] cleanup php.ini --- config/php/php.ini | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/config/php/php.ini b/config/php/php.ini index 3039423f..b9f3c58f 100644 --- a/config/php/php.ini +++ b/config/php/php.ini @@ -13,11 +13,10 @@ opcache.jit=tracing opcache.jit_buffer_size=64M [extra] -; https://frankenphp.dev/docs/performance/#php-performance ; http://symfony.com/doc/current/performance.html opcache.memory_consumption=256 opcache.max_accelerated_files=20000 opcache.preload=/var/www/app/preload.php opcache.validate_timestamps=0 -realpath_cache_size = 4096K -realpath_cache_ttl = 600 +realpath_cache_size=4096K +realpath_cache_ttl=600 From 974df2fa20621e0a2127495b36ce0c14162dcddd Mon Sep 17 00:00:00 2001 From: Benjamin Brummer Date: Tue, 14 Jan 2025 20:27:22 +0000 Subject: [PATCH 09/16] align supervisord to laravel docs/debian --- alpine/5/rootfs/etc/supervisord.conf | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/alpine/5/rootfs/etc/supervisord.conf b/alpine/5/rootfs/etc/supervisord.conf index b4817b9f..ddaefb84 100644 --- a/alpine/5/rootfs/etc/supervisord.conf +++ b/alpine/5/rootfs/etc/supervisord.conf @@ -6,29 +6,33 @@ logfile_maxbytes=0 loglevel=info [program:php-fpm] +command=php-fpm stdout_logfile=/dev/stdout stdout_logfile_maxbytes=0 stderr_logfile=/dev/stderr stderr_logfile_maxbytes=0 -command=php-fpm [program:scheduler] +command=php artisan schedule:work autorestart=true stdout_logfile=/dev/stdout stdout_logfile_maxbytes=0 stderr_logfile=/dev/stderr stderr_logfile_maxbytes=0 -command=php artisan schedule:work [program:queue-worker] process_name=%(program_name)s_%(process_num)02d +command=php artisan queue:work --sleep=3 --tries=1 --timeout=3600 +autostart=true autorestart=true +stopasgroup=true +killasgroup=true +numprocs=2 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=256 --timeout=3600 +stopwaitsecs=3600 [eventlistener:shutdown] command=shutdown.sh From 7a72c2ef16d78bc91f26141b85c1f0c4408c980e Mon Sep 17 00:00:00 2001 From: Benjamin Brummer Date: Wed, 15 Jan 2025 09:29:59 +0000 Subject: [PATCH 10/16] set alpine to 3.20 --- alpine/5/Dockerfile | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/alpine/5/Dockerfile b/alpine/5/Dockerfile index 7bd77f31..27ae8a38 100644 --- a/alpine/5/Dockerfile +++ b/alpine/5/Dockerfile @@ -1,9 +1,10 @@ ARG PHP_VERSION=8.3 +ARG ALPINE_VERSION=3.20 ARG BAK_STORAGE_PATH=/var/www/app/docker-backup-storage/ ARG BAK_PUBLIC_PATH=/var/www/app/docker-backup-public/ # Get Invoice Ninja and install nodejs packages -FROM --platform=$BUILDPLATFORM php:${PHP_VERSION}-fpm-alpine AS nodebuild +FROM --platform=$BUILDPLATFORM php:${PHP_VERSION}-fpm-alpine${ALPINE_VERSION} AS nodebuild # Download Invoice Ninja ARG INVOICENINJA_VERSION @@ -26,7 +27,7 @@ RUN mkdir -p /var/www/app/public/logo /var/www/app/storage WORKDIR /var/www/app # Prepare php image -FROM php:${PHP_VERSION}-fpm-alpine AS phpbuild +FROM php:${PHP_VERSION}-fpm-alpine${ALPINE_VERSION} AS phpbuild LABEL maintainer="David Bomba " @@ -34,10 +35,6 @@ ARG php_require="bcmath gd pdo_mysql zip" ARG php_suggest="exif imagick intl pcntl soap" ARG php_extra="opcache" -# Adding caching_sha2_password.so -# With this we get native support for caching_sha2_password -RUN apk add --no-cache mariadb-connector-c - RUN ln -s "${PHP_INI_DIR}/php.ini-production" "${PHP_INI_DIR}/php.ini" # Install chromium @@ -45,7 +42,7 @@ RUN set -eux; \ apk add --no-cache \ font-isas-misc \ supervisor \ - mysql-client \ + mariadb-client \ chromium \ # font-noto-cjk-extra \ # font-wqy-zenhei \ From 42c62adf1ada68ee2d135121db71af5dda33fa31 Mon Sep 17 00:00:00 2001 From: Benjamin Brummer Date: Wed, 15 Jan 2025 09:49:58 +0000 Subject: [PATCH 11/16] php optimization --- .../usr/local/etc/php-fpm.d/invoiceninja.conf | 1 + .../usr/local/etc/php/conf.d/in-php.ini | 17 -------------- .../usr/local/etc/php/conf.d/invoiceninja.ini | 22 +++++++++++++++++++ docker-compose.yml | 4 ++-- 4 files changed, 25 insertions(+), 19 deletions(-) create mode 100644 alpine/5/rootfs/usr/local/etc/php-fpm.d/invoiceninja.conf delete mode 100644 alpine/5/rootfs/usr/local/etc/php/conf.d/in-php.ini create mode 100644 alpine/5/rootfs/usr/local/etc/php/conf.d/invoiceninja.ini diff --git a/alpine/5/rootfs/usr/local/etc/php-fpm.d/invoiceninja.conf b/alpine/5/rootfs/usr/local/etc/php-fpm.d/invoiceninja.conf new file mode 100644 index 00000000..63bbada7 --- /dev/null +++ b/alpine/5/rootfs/usr/local/etc/php-fpm.d/invoiceninja.conf @@ -0,0 +1 @@ +pm.max_children = 10 diff --git a/alpine/5/rootfs/usr/local/etc/php/conf.d/in-php.ini b/alpine/5/rootfs/usr/local/etc/php/conf.d/in-php.ini deleted file mode 100644 index 1ecaf93a..00000000 --- a/alpine/5/rootfs/usr/local/etc/php/conf.d/in-php.ini +++ /dev/null @@ -1,17 +0,0 @@ -; How often (in seconds) to check file timestamps for changes to the shared -; memory storage allocation. ("1" means validate once per second, but only -; once per request. "0" means always validate) -;opcache.revalidate_freq=2 -opcache.revalidate_freq=60 - -# http://symfony.com/doc/current/performance.html -; Duration of time, in seconds for which to cache realpath information for a given -; file or directory. For systems with rarely changing files, consider increasing this -; value. -; http://php.net/realpath-cache-ttl -;realpath_cache_ttl = 120 -realpath_cache_ttl = 600 - -; Maximum allowed size for uploaded files. -; http://php.net/upload-max-filesize -upload_max_filesize = 8M diff --git a/alpine/5/rootfs/usr/local/etc/php/conf.d/invoiceninja.ini b/alpine/5/rootfs/usr/local/etc/php/conf.d/invoiceninja.ini new file mode 100644 index 00000000..b9f3c58f --- /dev/null +++ b/alpine/5/rootfs/usr/local/etc/php/conf.d/invoiceninja.ini @@ -0,0 +1,22 @@ +[core] +; https://www.php.net/manual/en/ini.core.php +post_max_size=10M +upload_max_filesize=10M + +[opcache] +; https://www.php.net/manual/en/opcache.installation.php#opcache.installation.recommended +opcache.enable_cli=1 + +[jit] +; https://wiki.php.net/rfc/jit_config_defaults +opcache.jit=tracing +opcache.jit_buffer_size=64M + +[extra] +; http://symfony.com/doc/current/performance.html +opcache.memory_consumption=256 +opcache.max_accelerated_files=20000 +opcache.preload=/var/www/app/preload.php +opcache.validate_timestamps=0 +realpath_cache_size=4096K +realpath_cache_ttl=600 diff --git a/docker-compose.yml b/docker-compose.yml index 9dc3a49e..9eb33072 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -30,8 +30,8 @@ services: - ./config/hosts:/etc/hosts:ro - ./docker/app/public:/var/www/app/public:rw,delegated - ./docker/app/storage:/var/www/app/storage:rw,delegated - - ./config/php/php.ini:/usr/local/etc/php/conf.d/invoiceninja.ini - - ./config/php/php-fpm.conf:/usr/local/etc/php-fpm.d/invoiceninja.conf + # - ./config/php/php.ini:/usr/local/etc/php/conf.d/invoiceninja.ini + # - ./config/php/php-fpm.conf:/usr/local/etc/php-fpm.d/invoiceninja.conf depends_on: - db From 3a0d184fb272f03601dcaf46e4701eb7a8a62d97 Mon Sep 17 00:00:00 2001 From: Benjamin Brummer Date: Wed, 15 Jan 2025 09:52:00 +0000 Subject: [PATCH 12/16] remove network --- docker-compose.yml | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 9eb33072..f2a25076 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -15,8 +15,6 @@ services: ports: - "80:80" #- "443:443" - networks: - - invoiceninja extra_hosts: - "in5.localhost:192.168.0.124 " #host and ip @@ -36,8 +34,6 @@ services: depends_on: - db - valkey - networks: - - invoiceninja extra_hosts: - "in5.localhost:192.168.0.124 " #host and ip @@ -58,8 +54,6 @@ services: #- ./config/mysql/backup-script:/etc/cron.daily/daily:ro #- ./config/mysql/backup-script:/etc/cron.weekly/weekly:ro #- ./config/mysql/backup-script:/etc/cron.monthly/monthly:ro - networks: - - invoiceninja extra_hosts: - "in5.localhost:192.168.0.124 " #host and ip @@ -89,8 +83,3 @@ services: healthcheck: test: [ "CMD", "valkey-cli", "ping" ] start_period: 10s - networks: - - invoiceninja - -networks: - invoiceninja: From fe1ff5c49645024aec64d532ec55fcba35894209 Mon Sep 17 00:00:00 2001 From: Benjamin Brummer Date: Wed, 15 Jan 2025 09:53:08 +0000 Subject: [PATCH 13/16] remove hosts --- docker-compose.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index f2a25076..338facf5 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -15,8 +15,8 @@ services: ports: - "80:80" #- "443:443" - extra_hosts: - - "in5.localhost:192.168.0.124 " #host and ip + # extra_hosts: + # - "in5.localhost:192.168.0.124 " #host and ip app: build: @@ -25,7 +25,7 @@ services: env_file: env restart: always volumes: - - ./config/hosts:/etc/hosts:ro + # - ./config/hosts:/etc/hosts:ro - ./docker/app/public:/var/www/app/public:rw,delegated - ./docker/app/storage:/var/www/app/storage:rw,delegated # - ./config/php/php.ini:/usr/local/etc/php/conf.d/invoiceninja.ini @@ -34,8 +34,8 @@ services: depends_on: - db - valkey - extra_hosts: - - "in5.localhost:192.168.0.124 " #host and ip + # extra_hosts: + # - "in5.localhost:192.168.0.124 " #host and ip db: image: mysql:8 @@ -54,8 +54,8 @@ services: #- ./config/mysql/backup-script:/etc/cron.daily/daily:ro #- ./config/mysql/backup-script:/etc/cron.weekly/weekly:ro #- ./config/mysql/backup-script:/etc/cron.monthly/monthly:ro - extra_hosts: - - "in5.localhost:192.168.0.124 " #host and ip + # extra_hosts: + # - "in5.localhost:192.168.0.124 " #host and ip # THIS IS ONLY A VALID CONFIGURATION FOR IN 4. DO NOT USE FOR IN 5. # cron: From 4c9ae7e92f7ea0adf014a33ad50c2e2b9dd9f916 Mon Sep 17 00:00:00 2001 From: Benjamin Brummer Date: Wed, 15 Jan 2025 11:09:04 +0000 Subject: [PATCH 14/16] Align supervisor with debian --- alpine/5/rootfs/etc/supervisord.conf | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/alpine/5/rootfs/etc/supervisord.conf b/alpine/5/rootfs/etc/supervisord.conf index ddaefb84..2ecbf108 100644 --- a/alpine/5/rootfs/etc/supervisord.conf +++ b/alpine/5/rootfs/etc/supervisord.conf @@ -1,24 +1,24 @@ [supervisord] nodaemon=true -pidfile=/tmp/supervisord.pid -logfile=/dev/null ; nodaemon will cause logs to go to stdout +logfile=/dev/null logfile_maxbytes=0 -loglevel=info +pidfile=/var/run/supervisord.pid + +[rpcinterface:supervisor] +supervisor.rpcinterface_factory=supervisor.rpcinterface:make_main_rpcinterface [program:php-fpm] command=php-fpm -stdout_logfile=/dev/stdout +stdout_logfile=/dev/fd/1 stdout_logfile_maxbytes=0 -stderr_logfile=/dev/stderr -stderr_logfile_maxbytes=0 +redirect_stderr=true [program:scheduler] command=php artisan schedule:work autorestart=true -stdout_logfile=/dev/stdout +stdout_logfile=/dev/fd/1 stdout_logfile_maxbytes=0 -stderr_logfile=/dev/stderr -stderr_logfile_maxbytes=0 +redirect_stderr=true [program:queue-worker] process_name=%(program_name)s_%(process_num)02d @@ -28,10 +28,9 @@ autorestart=true stopasgroup=true killasgroup=true numprocs=2 -stdout_logfile=/dev/stdout +stdout_logfile=/dev/fd/1 stdout_logfile_maxbytes=0 -stderr_logfile=/dev/stderr -stderr_logfile_maxbytes=0 +redirect_stderr=true stopwaitsecs=3600 [eventlistener:shutdown] From 07a211bc1397d1c9a4584fa350db9d767a636b59 Mon Sep 17 00:00:00 2001 From: Benjamin Brummer Date: Wed, 15 Jan 2025 11:16:45 +0000 Subject: [PATCH 15/16] pidfile is not required --- alpine/5/rootfs/etc/supervisord.conf | 1 - 1 file changed, 1 deletion(-) diff --git a/alpine/5/rootfs/etc/supervisord.conf b/alpine/5/rootfs/etc/supervisord.conf index 2ecbf108..2ed26a75 100644 --- a/alpine/5/rootfs/etc/supervisord.conf +++ b/alpine/5/rootfs/etc/supervisord.conf @@ -2,7 +2,6 @@ nodaemon=true logfile=/dev/null logfile_maxbytes=0 -pidfile=/var/run/supervisord.pid [rpcinterface:supervisor] supervisor.rpcinterface_factory=supervisor.rpcinterface:make_main_rpcinterface From 018e0e7b2ad845164596f8fe0c650028e7f03b80 Mon Sep 17 00:00:00 2001 From: Benjamin Brummer Date: Wed, 15 Jan 2025 11:29:46 +0000 Subject: [PATCH 16/16] readded mariadb-connector-c --- alpine/5/Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/alpine/5/Dockerfile b/alpine/5/Dockerfile index 27ae8a38..d66a0862 100644 --- a/alpine/5/Dockerfile +++ b/alpine/5/Dockerfile @@ -43,6 +43,7 @@ RUN set -eux; \ font-isas-misc \ supervisor \ mariadb-client \ + mariadb-connector-c \ chromium \ # font-noto-cjk-extra \ # font-wqy-zenhei \