From dfc392580e7a03127229881aec72aa01af6b4b64 Mon Sep 17 00:00:00 2001 From: Benjamin Brummer Date: Thu, 9 Jan 2025 10:15:37 +0000 Subject: [PATCH 1/6] healthcheck for scheduler and worker --- debian/docker-compose.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/debian/docker-compose.yml b/debian/docker-compose.yml index d8811bc..99ec2b6 100644 --- a/debian/docker-compose.yml +++ b/debian/docker-compose.yml @@ -59,6 +59,9 @@ services: environment: LARAVEL_ROLE: worker <<: *volumes + healthcheck: + test: ["CMD", "pgrep", "-f", "queue:work"] + start_period: 10s depends_on: app: condition: service_healthy @@ -74,6 +77,9 @@ services: environment: LARAVEL_ROLE: scheduler <<: *volumes + healthcheck: + test: ["CMD", "pgrep", "-f", "schedule:work"] + start_period: 10s depends_on: app: condition: service_healthy From 2e22177b20379684b55a69d385df321728c2d1ea Mon Sep 17 00:00:00 2001 From: Benjamin Brummer Date: Thu, 9 Jan 2025 12:43:05 +0000 Subject: [PATCH 2/6] permissions are already correct in the release artifact tar/tar.gz --- debian/Dockerfile | 2 -- 1 file changed, 2 deletions(-) diff --git a/debian/Dockerfile b/debian/Dockerfile index 8e306d5..71ae5fb 100644 --- a/debian/Dockerfile +++ b/debian/Dockerfile @@ -6,8 +6,6 @@ RUN curl -s "https://api.github.com/repos/invoiceninja/invoiceninja/releases/lat xargs curl -sL | \ tar -xz \ && ln -s ./resources/views/react/index.blade.php ./public/index.html \ - # Set permissions: directories 755, files 644 - && chmod -R a=r,u+w,a+X . \ # Symlink && php artisan storage:link \ # Octane From 4c50bbad19eac19eb7335dfda1977936c32a8882 Mon Sep 17 00:00:00 2001 From: Benjamin Brummer Date: Thu, 9 Jan 2025 13:23:29 +0000 Subject: [PATCH 3/6] H3_GENERAL_PROTOCOL_ERROR only happens on Firefox --- debian/docker-compose.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debian/docker-compose.yml b/debian/docker-compose.yml index 99ec2b6..7c73124 100644 --- a/debian/docker-compose.yml +++ b/debian/docker-compose.yml @@ -26,7 +26,7 @@ services: ports: - "80:80" # HTTP # - "443:443" # HTTPS - # - "443:443/udp" # HTTP/3, causes an error for pdf preview H3_GENERAL_PROTOCOL_ERROR + # - "443:443/udp" # HTTP/3, Works for chromium based browser, but causes H3_GENERAL_PROTOCOL_ERROR for pdf previews in Firefox env_file: - ./.env environment: From 247f9464227093684ead77b5ef3b637132024284 Mon Sep 17 00:00:00 2001 From: Benjamin Brummer Date: Fri, 10 Jan 2025 07:31:03 +0000 Subject: [PATCH 4/6] include minimal php settings in the image --- debian/Dockerfile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/debian/Dockerfile b/debian/Dockerfile index 71ae5fb..bd1293b 100644 --- a/debian/Dockerfile +++ b/debian/Dockerfile @@ -67,7 +67,9 @@ RUN install-php-extensions \ ${php_extra} # Configure PHP -RUN mv "${PHP_INI_DIR}/php.ini-production" "${PHP_INI_DIR}/php.ini" +RUN ln -s "${PHP_INI_DIR}/php.ini-production" "${PHP_INI_DIR}/php.ini" + +COPY php/php.ini /usr/local/etc/php/conf.d/invoiceninja.ini # Create directory for artisan tinker (init.sh) RUN mkdir /config/psysh \ From ff636077d46275e1bd03420e847693be0d820277 Mon Sep 17 00:00:00 2001 From: Benjamin Brummer Date: Fri, 10 Jan 2025 07:31:35 +0000 Subject: [PATCH 5/6] --help flag for usage instructions --- debian/scripts/init.sh | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/debian/scripts/init.sh b/debian/scripts/init.sh index bb6ab65..40a3ed5 100755 --- a/debian/scripts/init.sh +++ b/debian/scripts/init.sh @@ -6,6 +6,34 @@ role=${LARAVEL_ROLE:-app} # Check for default CMD, flag(s) or empty CMD if [ "$*" = 'frankenphp php-cli artisan octane:frankenphp' ] || [ "${1#-}" != "$1" ] || [ "$#" -eq "0" ]; then + if [ "--help" = "$1" ]; then + echo [CMD] + echo "This image will execute specific CMDs based on the environment variable LARAVEL_ROLE" + echo + echo "LARAVEL_ROLE=app: frankenphp php-cli artisan octane:frankenphp (default)" + echo "LARAVEL_ROLE=worker: frankenphp php-cli artisan queue:work" + echo "LARAVEL_ROLE=scheduler: frankenphp php-cli artisan schedule:work" + echo + echo [FLAGS] + echo To the CMD defined by LARAVEL_ROLE can be extended with flags for artisan commands + echo + echo Available flags can be displaced: + echo docker run --rm invoiceninja/invoiceninja-debian frankenphp php-cli artisan help octane:frankenphp + echo docker run --rm invoiceninja/invoiceninja-debian frankenphp php-cli artisan queue:work + echo docker run --rm invoiceninja/invoiceninja-debian frankenphp php-cli artisan schedule:work + echo + echo Example: + echo docker run -e LARAVEL_ROLE=worker invoiceninja/invoiceninja-debian --verbose --sleep=3 --tries=3 --max-time=3600 + echo + echo [Deployment] + echo Docker compose is recommended + echo + echo Example: + echo https://github.com/invoiceninja/dockerfiles/blob/octane/debian/docker-compose.yml + echo + exit 0 + fi + # Run app if [ "${role}" = "app" ]; then cmd="frankenphp php-cli artisan octane:frankenphp" From 295bb6268bc03a5809ce611ab62439a6a921d1cc Mon Sep 17 00:00:00 2001 From: Benjamin Brummer Date: Fri, 10 Jan 2025 07:32:58 +0000 Subject: [PATCH 6/6] remove moiunt for php.ini --- debian/docker-compose.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/debian/docker-compose.yml b/debian/docker-compose.yml index 7c73124..73160b9 100644 --- a/debian/docker-compose.yml +++ b/debian/docker-compose.yml @@ -9,7 +9,6 @@ x-logging: &default-logging x-app-volumes: &volumes volumes: - ./.env:/app/.env - - ./php/php.ini:/usr/local/etc/php/conf.d/zzz-php.ini:ro - app_cache:/var/www/html/bootstrap/cache - app_storage:/app/storage - caddy_data:/data