Compare commits

...

43 Commits

Author SHA1 Message Date
David Bomba
ec35498159 set conditional for chrome / chromium path 2025-03-25 12:04:11 +11:00
David Bomba
4bff59808e Merge pull request #730 from benbrummer/octane
use github latest url, tar.gz without top level repository, mbstring
2025-03-19 10:05:07 +11:00
benbrummer
217c05bd1f use github latest url, tar.gz without top level repository, mbstring
Signed-off-by: benbrummer <info@benjamin-brummer.de>
2025-03-15 07:41:00 +01:00
David Bomba
24d1f9cd2e Merge pull request #714 from turbo124/octane
Fixes for publish image regression - force 22.04
2025-01-24 16:15:58 +11:00
David Bomba
9a3603b709 Fixes for publish image regression - force 22.04 2025-01-24 16:15:09 +11:00
David Bomba
c2bf3ca8d9 Merge pull request #709 from turbo124/octane
Change context dir from ./debian to debian
2025-01-24 14:28:42 +11:00
David Bomba
1c3f96e723 Change context dir from ./debian to debian 2025-01-24 14:28:11 +11:00
David Bomba
2364f53777 Merge pull request #708 from turbo124/octane
Debug php extension installer
2025-01-24 13:57:28 +11:00
David Bomba
7bfbe9ee03 Install each extension individually to identify the root cause 2025-01-24 13:56:44 +11:00
David Bomba
afd597456f Minor fixes for build files 2025-01-24 13:36:58 +11:00
David Bomba
243f46bd23 Merge pull request #707 from turbo124/octane
Fixes for php extension installer
2025-01-24 13:35:26 +11:00
David Bomba
6dfaa3b441 Fixes for php extension installer 2025-01-24 13:34:52 +11:00
David Bomba
6d0e0648e3 Fixes for php extension installer 2025-01-24 12:58:47 +11:00
David Bomba
85979fdcf2 Require mbstring 2025-01-24 09:22:36 +11:00
David Bomba
377c068667 Merge pull request #690 from benbrummer/octane
Octane
2025-01-15 08:18:57 +11:00
benbrummer
da7f8d93b0 Merge branch 'invoiceninja:octane' into octane 2025-01-13 13:40:31 +01:00
Benjamin Brummer
1d475a5218 php.ini with frankenphp/symfony recommendations 2025-01-12 00:57:51 +00:00
Benjamin Brummer
3a8184df73 fix for initialization with opcache.preload enabled 2025-01-12 00:56:21 +00:00
Benjamin Brummer
0c796fee5f use invoiceninja.tar.gz 2025-01-12 00:54:53 +00:00
David Bomba
bc5aa2e844 Merge pull request #686 from benbrummer/frankenphp
healthcheck for scheduler and worker
2025-01-11 16:40:22 +11:00
Benjamin Brummer
295bb6268b remove moiunt for php.ini 2025-01-10 07:32:58 +00:00
Benjamin Brummer
ff636077d4 --help flag for usage instructions 2025-01-10 07:31:35 +00:00
Benjamin Brummer
247f946422 include minimal php settings in the image 2025-01-10 07:31:03 +00:00
Benjamin Brummer
4c50bbad19 H3_GENERAL_PROTOCOL_ERROR only happens on Firefox 2025-01-09 13:23:29 +00:00
Benjamin Brummer
2e22177b20 permissions are already correct in the release artifact tar/tar.gz 2025-01-09 12:43:05 +00:00
Benjamin Brummer
dfc392580e healthcheck for scheduler and worker 2025-01-09 10:15:37 +00:00
David Bomba
260980f2a3 Merge pull request #685 from benbrummer/frankenphp
https for octane
2025-01-08 13:47:46 +11:00
Benjamin Brummer
57724b7d93 Single RUN for first stage to avoid insane build times 2025-01-07 11:51:09 +00:00
Benjamin Brummer
39b6680f0b added example command for https and caddy_data volume for persistent certificates 2025-01-07 10:04:24 +00:00
David Bomba
768df3c1dd Merge pull request #682 from benbrummer/frankenphp
Cleanup
2025-01-07 13:01:02 +11:00
Benjamin Brummer
7870b345ed composer is not needed 2025-01-05 16:57:56 +00:00
Benjamin Brummer
3c6ed5cda1 remove octane installation 2025-01-04 19:41:05 +00:00
Benjamin Brummer
2f43d4b45a php.ini refactoring 2025-01-04 18:52:36 +00:00
David Bomba
a71af868d2 Add build pipe for octane 2025-01-04 19:36:30 +11:00
David Bomba
237abe4aa8 Merge pull request #678 from benbrummer/frankenphp
Frankenphp
2025-01-03 13:47:40 +11:00
Benjamin Brummer
f680c8a59a require laravel/octane 2024-12-31 17:57:54 +01:00
Benjamin Brummer
8f51f3bc51 octane and multistage 2024-12-31 17:52:48 +01:00
Benjamin Brummer
e4c26dde5d Merge branch 'frankenphp' of https://github.com/benbrummer/dockerfiles into frankenphp 2024-12-28 09:25:43 +01:00
Benjamin Brummer
9c96e9d261 make mysql and redis available/default again 2024-12-28 09:25:25 +01:00
benbrummer
e1cde6b6be Merge branch 'invoiceninja:debian' into frankenphp 2024-12-28 08:58:49 +01:00
Benjamin Brummer
068acdd097 remove nginx, php-fpm and supervisord configuration 2024-12-28 08:36:19 +01:00
Benjamin Brummer
95aec27c65 Merge init scripts 2024-12-28 08:35:19 +01:00
Benjamin Brummer
6c6950d298 frankenphp, mariadb and valkey 2024-12-28 08:33:39 +01:00
12 changed files with 242 additions and 274 deletions

View File

@@ -1,4 +1,4 @@
name: Build Debian Container Image
name: Build Debian Octane Container Image
on:
pull_request:
@@ -12,7 +12,7 @@ on:
jobs:
docker:
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v4
@@ -33,6 +33,6 @@ jobs:
context: debian
file: debian/Dockerfile
load: true
tags: invoiceninja/invoiceninja-debian:test
tags: invoiceninja/invoiceninja-octane:test
cache-from: type=gha
cache-to: type=gha,mode=max

View File

@@ -7,16 +7,16 @@ on:
jobs:
docker:
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
strategy:
matrix:
include:
- image: invoiceninja/invoiceninja-debian
context: ./debian
- image: invoiceninja/invoiceninja-octane
context: debian
steps:
- name: Checkout
uses: actions/checkout@v4 # Updated from v2
uses: actions/checkout@v4
with:
fetch-depth: 0

2
debian/.env vendored
View File

@@ -57,6 +57,6 @@ NORDIGEN_SECRET_KEY=
IS_DOCKER=true
SCOUT_DRIVER=null
SNAPPDF_CHROMIUM_PATH=/usr/bin/google-chrome-stable
#SNAPPDF_CHROMIUM_PATH=/usr/bin/google-chrome-stable

105
debian/Dockerfile vendored
View File

@@ -1,14 +1,35 @@
FROM php:8.3-fpm AS base
FROM dunglas/frankenphp:1-php8.3-bookworm AS prepare-app
ARG php_require="bcmath gd pdo_mysql zip"
RUN curl -sL "https://github.com/invoiceninja/invoiceninja/releases/latest/download/invoiceninja.tar.gz" | \
tar -xz \
&& ln -s ./resources/views/react/index.blade.php ./public/index.html \
# Symlink
&& php artisan storage:link \
# Octane
&& php artisan octane:install --server=frankenphp
# ==================
# InvoiceNinja image
# ==================
FROM dunglas/frankenphp:1-php8.3-bookworm
ARG user=ninja
# PHP modules
ARG php_require="bcmath gd mbstring pdo_mysql zip"
ARG php_suggest="exif imagick intl pcntl soap saxon-12.5.0"
ARG php_extra="opcache"
# Create a system user UID/GID=999
RUN useradd -r ${user}
# Allow to bind to privileged ports
RUN setcap CAP_NET_BIND_SERVICE=+eip /usr/local/bin/frankenphp
# Install system dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
mariadb-client \
gpg \
supervisor \
# Unicode support for PDF
fonts-noto-cjk-extra \
fonts-wqy-microhei \
@@ -16,19 +37,20 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
xfonts-wqy \
# Install google-chrome-stable(amd64)/chromium(arm64)
&& if [ "$(dpkg --print-architecture)" = "amd64" ]; then \
mkdir -p /etc/apt/keyrings \
&& curl -fsSL https://dl.google.com/linux/linux_signing_key.pub | \
gpg --dearmor -o /etc/apt/keyrings/google.gpg \
&& echo "deb [arch=amd64 signed-by=/etc/apt/keyrings/google.gpg] https://dl.google.com/linux/chrome/deb/ stable main" > /etc/apt/sources.list.d/google-chrome.list \
&& apt-get update \
&& apt-get install -y --no-install-recommends google-chrome-stable; \
mkdir -p /etc/apt/keyrings \
&& curl -fsSL https://dl.google.com/linux/linux_signing_key.pub | \
gpg --dearmor -o /etc/apt/keyrings/google.gpg \
&& echo "deb [arch=amd64 signed-by=/etc/apt/keyrings/google.gpg] https://dl.google.com/linux/chrome/deb/ stable main" > /etc/apt/sources.list.d/google-chrome.list \
&& apt-get update \
&& apt-get install -y --no-install-recommends google-chrome-stable \
&& mkdir /config/google-chrome \
&& chown ${user}: /config/google-chrome; \
elif [ "$(dpkg --print-architecture)" = "arm64" ]; then \
apt-get install -y --no-install-recommends \
chromium; \
apt-get install -y --no-install-recommends \
chromium \
&& mkdir /config/chromium \
&& chown ${user}: /config/chromium; \
fi \
# Create config directory for chromium/google-chrome-stable
&& mkdir /var/www/.config \
&& chown www-data:www-data /var/www/.config \
# Cleanup
&& apt-get purge -y gpg \
&& apt-get autoremove -y \
@@ -36,52 +58,33 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
&& rm -rf /var/lib/apt/lists/*
# 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} \
@composer
RUN install-php-extensions \
${php_require} \
${php_suggest} \
${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 scripts
COPY rootfs /
COPY php/php.ini /usr/local/etc/php/conf.d/invoiceninja.ini
USER www-data
# Create directory for artisan tinker (init.sh)
RUN mkdir /config/psysh \
&& chown ${user}: /config/psysh
WORKDIR /var/www/html
# Change owner for caddy directories
RUN chown -R ${user}: \
/data/caddy \
/config/caddy
# Setup InvoiceNinja
RUN curl -s "https://api.github.com/repos/invoiceninja/invoiceninja/releases/latest" | \
grep -o '"browser_download_url": "[^"]*invoiceninja.tar"' | \
cut -d '"' -f 4 | \
xargs curl -sL | \
tar -oxz -C /var/www/html \
&& cp /var/www/html/resources/views/react/index.blade.php /var/www/html/public/index.html \
# File permissions
&& find /var/www/html/ -type f -exec chmod 644 {} \; \
# Directory permissions
&& find /var/www/html/ -type d -exec chmod 755 {} \; \
# Install dependencies
&& composer install --no-dev --no-scripts --no-autoloader \
&& composer dump-autoload --optimize \
&& php artisan optimize \
&& php artisan storage:link \
# Workaround for application updates
&& mv /var/www/html/public /tmp/public
USER root
# Setup supervisor
COPY supervisor/supervisord.conf /etc/supervisor/conf.d/supervisord.conf
# InvoiceNinja
COPY --from=prepare-app --chown=${user}:${user} /app /app
# Add initialization script
COPY --chmod=0755 scripts/init.sh /usr/local/bin/init.sh
# Health check
HEALTHCHECK --interval=30s --timeout=5s --start-period=30s --retries=3 \
CMD php -v || exit 1
USER ${user}
ENTRYPOINT ["/usr/local/bin/init.sh"]
CMD ["supervisord", "-c", "/etc/supervisor/conf.d/supervisord.conf"]
CMD ["frankenphp", "php-cli", "artisan", "octane:frankenphp"]

View File

@@ -1,47 +1,87 @@
# name: invoiceninja
x-logging: &default-logging
options:
max-size: "10m"
max-file: "3"
driver: json-file
x-app-volumes: &volumes
volumes:
- ./.env:/app/.env
- app_cache:/var/www/html/bootstrap/cache
- app_storage:/app/storage
- caddy_data:/data
services:
app:
build:
context: .
image: invoiceninja/invoiceninja-debian:${TAG:-latest}
restart: unless-stopped
# php artisan help octane:frankenphp
command: --port=80 --workers=2 --log-level=info
# command: --host=example.com --port=443 --workers=2 --https --http-redirect --log-level=info
ports:
- "80:80" # HTTP
# - "443:443" # HTTPS
# - "443:443/udp" # HTTP/3, Works for chromium based browser, but causes H3_GENERAL_PROTOCOL_ERROR for pdf previews in Firefox
env_file:
- ./.env
volumes:
- ./.env:/var/www/html/.env
- ./php/php.ini:/usr/local/etc/php/conf.d/zzz-php.ini:ro
- ./php/php-fpm.conf:/usr/local/etc/php-fpm.d/zzz-php-fpm.conf:ro
- ./supervisor/supervisord.conf:/etc/supervisor/conf.d/supervisord.conf:ro
- app_cache:/var/www/html/bootstrap/cache
- app_public:/var/www/html/public
- app_storage:/var/www/html/storage
networks:
- app-network
environment:
LARAVEL_ROLE: app
<<: *volumes
# HEALTHCHECK from frankenphp image
healthcheck:
start_period: 180s
depends_on:
mysql:
condition: service_healthy
redis:
condition: service_healthy
# mariadb:
# condition: service_healthy
# valkey:
# condition: service_healthy
logging: *default-logging
app-worker:
image: invoiceninja/invoiceninja-debian:${TAG:-latest}
restart: unless-stopped
# php artisan help queue:work
command: --verbose --sleep=3 --tries=3 --max-time=3600
deploy:
mode: replicated
replicas: 2
env_file:
- ./.env
environment:
LARAVEL_ROLE: worker
<<: *volumes
healthcheck:
test: ["CMD", "pgrep", "-f", "queue:work"]
start_period: 10s
depends_on:
app:
condition: service_healthy
logging: *default-logging
nginx:
image: nginx:alpine
app-scheduler:
image: invoiceninja/invoiceninja-debian:${TAG:-latest}
restart: unless-stopped
ports:
- "80:80"
volumes:
- ./nginx:/etc/nginx/conf.d:ro
- app_public:/var/www/html/public:ro
- app_storage:/var/www/html/storage:ro
networks:
- app-network
# php artisan help schedule:work
command: --verbose
env_file:
- ./.env
environment:
LARAVEL_ROLE: scheduler
<<: *volumes
healthcheck:
test: ["CMD", "pgrep", "-f", "schedule:work"]
start_period: 10s
depends_on:
- app
app:
condition: service_healthy
logging: *default-logging
mysql:
@@ -56,8 +96,6 @@ services:
MYSQL_ROOT_PASSWORD: ${DB_ROOT_PASSWORD}
volumes:
- mysql_data:/var/lib/mysql
networks:
- app-network
healthcheck:
test: [ "CMD", "mysqladmin", "ping", "-h", "localhost", "-u${MYSQL_USER}", "-p${MYSQL_PASSWORD}" ]
interval: 10s
@@ -70,8 +108,6 @@ services:
restart: unless-stopped
volumes:
- redis_data:/data
networks:
- app-network
healthcheck:
test: [ "CMD", "redis-cli", "ping" ]
interval: 10s
@@ -79,18 +115,38 @@ services:
retries: 5
logging: *default-logging
networks:
app-network:
driver: bridge
# mariadb:
# image: mariadb:11.4
# restart: unless-stopped
# env_file:
# - ./.env
# environment:
# MARIADB_DATABASE: ${DB_DATABASE}
# MARIADB_USER: ${DB_USERNAME}
# MARIADB_PASSWORD: ${DB_PASSWORD}
# MARIADB_ROOT_PASSWORD: ${DB_ROOT_PASSWORD}
# volumes:
# - mariadb:/var/lib/mysql
# healthcheck:
# test: ["CMD", "healthcheck.sh", "--connect", "--innodb_initialized"]
# start_period: 60s
# logging: *default-logging
# valkey:
# image: valkey/valkey:8
# restart: unless-stopped
# volumes:
# - valkey:/data
# healthcheck:
# test: [ "CMD", "valkey-cli", "ping" ]
# start_period: 10s
# logging: *default-logging
volumes:
app_cache:
driver: local
app_public:
driver: local
app_storage:
driver: local
caddy_data:
mysql_data:
driver: local
redis_data:
driver: local
# mariadb:
# valkey:

View File

@@ -1,14 +0,0 @@
# 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 *;

View File

@@ -1,32 +0,0 @@
# https://laravel.com/docs/master/deployment#nginx
server {
listen 80 default_server;
server_name _;
root /var/www/html/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;
}
}

View File

@@ -1 +0,0 @@
pm.max_children = 10

22
debian/php/php.ini vendored
View File

@@ -1,15 +1,23 @@
[core]
# https://www.php.net/manual/en/ini.core.php
post_max_size = 10M
upload_max_filesize = 10M
; 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
; https://www.php.net/manual/en/opcache.installation.php#opcache.installation.recommended
opcache.enable_cli=1
opcache.max_accelerated_files=4000
opcache.revalidate_freq=60
[jit]
# https://wiki.php.net/rfc/jit_config_defaults
; https://wiki.php.net/rfc/jit_config_defaults
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=/app/preload.php
opcache.validate_timestamps=0
realpath_cache_size = 4096K
realpath_cache_ttl = 600

View File

@@ -1,14 +0,0 @@
#!/bin/sh
php artisan db:seed --force
# Build up array of arguments...
if [ ! -z "${IN_USER_EMAIL}" ]; then
email="--email ${IN_USER_EMAIL}"
fi
if [ ! -z "${IN_PASSWORD}" ]; then
password="--password ${IN_PASSWORD}"
fi
php artisan ninja:create-account $email $password

139
debian/scripts/init.sh vendored
View File

@@ -1,81 +1,92 @@
#!/bin/sh
set -e
#!/bin/sh -eu
in_log() {
local type="$1"
shift
printf '%s [%s] [Entrypoint]: %s\n' "$(date -u '+%Y-%m-%dT%H:%M:%SZ')" "$type" "$*"
}
# Fallback to app
role=${LARAVEL_ROLE:-app}
docker_process_init_files() {
echo
local f
for f; do
case "$f" in
*.sh)
# https://github.com/docker-library/postgres/issues/450#issuecomment-393167936
# https://github.com/docker-library/postgres/pull/452
if [ -x "$f" ]; then
in_log INFO "$0: running $f"
"$f"
else
in_log INFO "$0: sourcing $f"
. "$f"
fi
;;
*) in_log INFO "$0: ignoring $f" ;;
esac
# 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
done
}
if [ "$*" = 'supervisord -c /etc/supervisor/conf.d/supervisord.conf' ]; then
# Workaround for application updates
if [ "$(ls -A /tmp/public)" ]; then
echo "Updating public folder..."
rm -rf /var/www/html/public/.htaccess \
/var/www/html/public/.well-known \
/var/www/html/public/*
mv /tmp/public/* \
/tmp/public/.htaccess \
/tmp/public/.well-known \
/var/www/html/public/
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
echo "Public Folder is up to date"
# Ensure owner, file and directory permissions are correct
chown -R www-data:www-data \
/var/www/html/public \
/var/www/html/storage
find /var/www/html/public \
/var/www/html/storage \
-type f -exec chmod 644 {} \;
find /var/www/html/public \
/var/www/html/storage \
-type d -exec chmod 755 {} \;
# Run app
if [ "${role}" = "app" ]; then
cmd="frankenphp php-cli artisan octane:frankenphp"
# Clear and cache config in production
if [ "$APP_ENV" = "production" ]; then
runuser -u www-data -- php artisan optimize
runuser -u www-data -- php artisan package:discover
runuser -u www-data -- php artisan migrate --force
if [ "$APP_ENV" = "production" ]; then
frankenphp php-cli artisan optimize
fi
frankenphp php-cli artisan package:discover
# Run migrations (if any)
frankenphp php-cli artisan migrate --force
# If first IN run, it needs to be initialized
echo "Checking initialization status..."
IN_INIT=$(php artisan tinker --execute='echo Schema::hasTable("accounts") && !App\Models\Account::all()->first();')
echo "IN_INIT value: $IN_INIT"
if [ "$(php -d opcache.preload='' artisan tinker --execute='echo Schema::hasTable("accounts") && !App\Models\Account::all()->first();')" = "1" ]; then
echo "Running initialization..."
if [ "$IN_INIT" = "1" ]; then
echo "Running initialization scripts..."
docker_process_init_files /docker-entrypoint-init.d/*
frankenphp php-cli artisan db:seed --force
if [ -n "${IN_USER_EMAIL}" ] && [ -n "${IN_PASSWORD}" ]; then
frankenphp php-cli artisan ninja:create-account --email "${IN_USER_EMAIL}" --password "${IN_PASSWORD}"
else
echo "Initialization failed - Set IN_USER_EMAIL and IN_PASSWORD in .env"
exit 1
fi
fi
echo "Production setup completed"
echo "IN_INIT value: $IN_INIT"
# Run worker
elif [ "${role}" = "worker" ]; then
cmd="frankenphp php-cli artisan queue:work"
# Run scheduler
elif [ "${role}" = "scheduler" ]; then
cmd="frankenphp php-cli artisan schedule:work"
# Invalid role
else
echo "Invalid role: ${role}"
exit 1
fi
echo "Starting supervisord..."
# Append flag(s) to role cmd
if [ "${1#-}" != "$1" ]; then
set -- ${cmd} "$@"
else
set -- ${cmd}
fi
fi
# Set PDF generation browser path based on architecture
if [ "$(dpkg --print-architecture)" = "amd64" ]; then
export SNAPPDF_CHROMIUM_PATH=/usr/bin/google-chrome-stable
elif [ "$(dpkg --print-architecture)" = "arm64" ]; then
export SNAPPDF_CHROMIUM_PATH=/usr/bin/chromium
fi
exec "$@"

View File

@@ -1,49 +0,0 @@
[unix_http_server]
file=/var/run/supervisor.sock
chmod=0700
[supervisord]
nodaemon=true
user=root
logfile=/var/log/supervisor/supervisord.log
pidfile=/var/run/supervisord.pid
[rpcinterface:supervisor]
supervisor.rpcinterface_factory=supervisor.rpcinterface:make_main_rpcinterface
[supervisorctl]
serverurl=unix:///var/run/supervisor.sock
[program:php-fpm]
command=/usr/local/sbin/php-fpm -F
autostart=true
autorestart=true
priority=5
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0
[program:queue-worker]
process_name=%(program_name)s_%(process_num)02d
command=php /var/www/html/artisan queue:work --sleep=3 --tries=3 --max-time=3600
autostart=true
autorestart=true
stopasgroup=true
killasgroup=true
user=www-data
numprocs=2
environment=HOME="/var/www"
stdout_logfile=/var/log/php-worker.log
stderr_logfile=/var/log/php-worker.err.log
stopwaitsecs=3600
[program:scheduler]
command=/bin/sh -c "while [ true ]; do (php /var/www/html/artisan schedule:run --verbose --no-interaction &); sleep 60; done"
autostart=true
autorestart=true
user=www-data
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0