Compare commits

...

34 Commits

Author SHA1 Message Date
David Bomba
ed9c23d9c7 Merge pull request #753 from benbrummer/debian
saxon defaults now to 12.5.0
2025-05-11 09:44:26 +10:00
benbrummer
f6fa32f606 saxon defaults now to 12.5.0
Signed-off-by: benbrummer <info@benjamin-brummer.de>
2025-05-10 10:59:13 +02:00
David Bomba
a0454d3998 Merge pull request #745 from benbrummer/debian
remove bootstrap/cache volume
2025-04-05 06:49:13 +11:00
benbrummer
04f4dbe248 remove bootstrap/cache volume
align with docker hub tutorial about laravel
* https://docs.docker.com/guides/frameworks/laravel/
* https://github.com/dockersamples/laravel-docker-examples/blob/main/compose.prod.yaml#L14

Signed-off-by: benbrummer <info@benjamin-brummer.de>
2025-04-04 11:43:33 +02:00
benbrummer
a7822987b2 Merge pull request #744 from gianluigitrontini/debian
Fixes #743: Move conditionals for chromium/google chrome before artisan optimize
2025-04-03 16:47:12 +02:00
Gianluigi Trontini
7b7f3df710 Fixes #743: Move conditionals for chromium/google chrome at the top of the file 2025-04-03 15:37:52 +02:00
benbrummer
a9b3a8a8a4 Merge pull request #737 from RichyHBM/patch-1
Create required dirs if missing
2025-03-29 09:55:16 +01:00
Richy HBM
a53b702c45 Create required dirs if missing
Signed-off-by: Richy HBM <RichyHBM@users.noreply.github.com>
2025-03-27 16:04:35 +00:00
David Bomba
39c546e270 remove default prop for snappdf pay 2025-03-25 12:03:04 +11:00
David Bomba
9c0e00edb3 Add conditionals for chromium/google chrome 2025-03-25 12:02:47 +11:00
David Bomba
1f28106e43 Merge pull request #731 from benbrummer/debian
use github latest url, tar.gz without top level repository
2025-03-19 10:05:15 +11:00
David Bomba
c4513a868a Merge pull request #733 from fabiomanz/patch-1
Upgrade from old docker-compose syntax to v2 docker compose syntax
2025-03-18 02:54:22 +11:00
Fabio
856d47217e Upgrade from old docker-compose syntax to v2 docker compose syntax
Signed-off-by: Fabio <fabio.manz@t-online.de>
2025-03-17 13:57:36 +01:00
Benjamin Brummer
be0ec204d4 use github latest url, tar.gz without top level repository 2025-03-15 06:35:12 +00:00
David Bomba
9d99120693 Merge pull request #713 from turbo124/debian
Fixes for publish image regression - force 22.04
2025-01-24 16:12:59 +11:00
David Bomba
a5204ccb7d Fixes for publish image regression - force 22.04 2025-01-24 16:12:25 +11:00
David Bomba
995d70ab60 Merge pull request #706 from turbo124/debian
Fixes for php extension installer
2025-01-24 12:59:21 +11:00
David Bomba
11855e0701 Fixes for php extension installer 2025-01-24 12:58:04 +11:00
David Bomba
42816b6282 Require mbstring 2025-01-24 09:23:10 +11:00
David Bomba
2ad607fa2d Create auto-close-issues.yml
Signed-off-by: David Bomba <turbo124@gmail.com>
2025-01-21 13:47:56 +11:00
David Bomba
2c25caf627 Merge pull request #694 from benbrummer/debian
Fix for reap logging
2025-01-15 08:56:09 +11:00
benbrummer
a2b64d2060 Merge branch 'invoiceninja:debian' into debian 2025-01-14 22:32:43 +01:00
Benjamin Brummer
b58d4e1259 fix for reaps 2025-01-14 21:31:50 +00:00
Benjamin Brummer
a7683ada33 log to stdout 2025-01-14 21:19:38 +00:00
Benjamin Brummer
3e8a6c72a7 healthcheck for php-fpm master process 2025-01-14 21:19:25 +00:00
David Bomba
3b0f7c463a Merge pull request #691 from benbrummer/debian
php optimization
2025-01-15 08:18:25 +11:00
Benjamin Brummer
c00d44380c log worker to stdout/stderr 2025-01-13 16:34:49 +00:00
Benjamin Brummer
cb4120fc54 Multistage, single init.sh 2025-01-13 16:31:39 +00:00
Benjamin Brummer
f2c5a1f842 composer is not needed, permissions are already correct in the image 2025-01-13 13:11:50 +00:00
Benjamin Brummer
029bc57fac download invoiceninja.tar.gz 2025-01-13 13:09:33 +00:00
Benjamin Brummer
d60bf39950 set correct file-extension 2025-01-13 12:52:28 +00:00
Benjamin Brummer
31eb278f0d prefer files from image 2025-01-13 12:30:06 +00:00
Benjamin Brummer
44b460bf13 php optimization opcache and realpath 2025-01-13 12:22:01 +00:00
Benjamin Brummer
7bae300fd2 disable preload for artisan tinker 2025-01-13 12:20:03 +00:00
11 changed files with 125 additions and 136 deletions

21
.github/workflows/auto-close-issues.yml vendored Normal file
View File

@@ -0,0 +1,21 @@
name: Close stale issues after 5 days
on:
schedule:
# Run this workflow every day at midnight
- cron: '0 0 * * *'
jobs:
close-stale-issues:
runs-on: ubuntu-latest
steps:
- name: Close stale issues
uses: actions/stale@v7
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
stale-issue-message: "This issue has been automatically closed due to inactivity for 5 days."
days-before-stale: 4 # Number of days before marking an issue as stale
days-before-close: 1 # Number of days after being marked stale before closing
stale-label: "stale" # Label to add to stale issues
exempt-issue-labels: "keep-open,triage,bug" # Prevents issues with this label from being closed
only-issues: true # Only affects issues, not pull requests

View File

@@ -12,7 +12,7 @@ on:
jobs:
docker:
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v4

View File

@@ -7,7 +7,7 @@ on:
jobs:
docker:
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
strategy:
matrix:
include:

View File

@@ -54,7 +54,7 @@ The `APP_KEY` can be generated by running:
docker run --rm -it invoiceninja/invoiceninja-debian php artisan key:generate --show
# Or if your containers are already running:
docker-compose exec app php artisan key:generate --show
docker compose exec app php artisan key:generate --show
```
Copy the entire string and insert in the .env file at `APP_KEY=base64....`
@@ -64,7 +64,7 @@ Copy the entire string and insert in the .env file at `APP_KEY=base64....`
Start the container with:
```bash
docker-compose up -d
docker compose up -d
```
**Note: When performing the setup, the Database host is ```mysql```
@@ -74,9 +74,9 @@ docker-compose up -d
To upgrade to a newer release image, update your docker-compose.yml first by running:
```bash
docker-compose down
docker-compose pull
docker-compose up
docker compose down
docker compose pull
docker compose up
```
It is recommended to perform a backup before updating.
@@ -92,4 +92,4 @@ This is a new image which should provide much better support for all users, howe
- [ ] Backup script
- [ ] Integrate soketi server
- [ ] Add elastic search for site wide search
- [ ] Add elastic search for site wide search

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

86
debian/Dockerfile vendored
View File

@@ -1,7 +1,24 @@
FROM php:8.3-fpm AS base
ARG PHP=8.3
ARG php_require="bcmath gd pdo_mysql zip"
ARG php_suggest="exif imagick intl pcntl soap saxon-12.5.0"
FROM php:${PHP}-fpm AS prepare-app
USER www-data
RUN curl -sL "https://github.com/invoiceninja/invoiceninja/releases/latest/download/invoiceninja.tar.gz" | \
tar -xz -C /var/www/html \
&& ln -s /var/www/html/resources/views/react/index.blade.php /var/www/html/public/index.html \
&& php artisan storage:link \
# Workaround for application updates
&& mv /var/www/html/public /tmp/public
# ==================
# InvoiceNinja image
# ==================
FROM php:${PHP}-fpm
# PHP modules
ARG php_require="bcmath gd mbstring pdo_mysql zip"
ARG php_suggest="exif imagick intl pcntl saxon soap"
ARG php_extra="opcache"
# Install system dependencies
@@ -16,15 +33,15 @@ 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; \
elif [ "$(dpkg --print-architecture)" = "arm64" ]; then \
apt-get install -y --no-install-recommends \
chromium; \
apt-get install -y --no-install-recommends \
chromium; \
fi \
# Create config directory for chromium/google-chrome-stable
&& mkdir /var/www/.config \
@@ -36,52 +53,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
COPY --from=ghcr.io/mlocati/php-extension-installer /usr/bin/install-php-extensions /usr/local/bin/
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
WORKDIR /var/www/html
# 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
COPY php/php-fpm.conf /usr/local/etc/php-fpm.d/invoiceninja.conf
# Setup supervisor
COPY supervisor/supervisord.conf /etc/supervisor/conf.d/supervisord.conf
# Setup InvoiceNinja
COPY --from=prepare-app /var/www/html /var/www/html
COPY --from=prepare-app /tmp/public /tmp/public
# 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
CMD pgrep -f "php-fpm: master process"
ENTRYPOINT ["/usr/local/bin/init.sh"]
CMD ["supervisord", "-c", "/etc/supervisor/conf.d/supervisord.conf"]

View File

@@ -14,10 +14,9 @@ services:
- ./.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
# - ./php/php.ini:/usr/local/etc/php/conf.d/invoiceninja.ini:ro
# - ./php/php-fpm.conf:/usr/local/etc/php-fpm.d/invoiceninja.conf:ro
# - ./supervisor/supervisord.conf:/etc/supervisor/conf.d/supervisord.conf:ro
- app_public:/var/www/html/public
- app_storage:/var/www/html/storage
networks:
@@ -84,8 +83,6 @@ networks:
driver: bridge
volumes:
app_cache:
driver: local
app_public:
driver: local
app_storage:

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]
; http://symfony.com/doc/current/performance.html
opcache.memory_consumption=256
opcache.max_accelerated_files=20000
opcache.preload=/var/www/html/preload.php
opcache.preload_user=www-data
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

View File

@@ -1,35 +1,19 @@
#!/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" "$*"
}
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
echo
done
}
# 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
if [ "$*" = 'supervisord -c /etc/supervisor/conf.d/supervisord.conf' ]; then
# Check for required folders and create if needed
[ -d /var/www/html/storage/framework/sessions ] || mkdir -p /var/www/html/storage/framework/sessions
[ -d /var/www/html/storage/framework/views ] || mkdir -p /var/www/html/storage/framework/views
[ -d /var/www/html/storage/framework/cache ] || mkdir -p /var/www/html/storage/framework/cache
# Workaround for application updates
if [ "$(ls -A /tmp/public)" ]; then
echo "Updating public folder..."
@@ -61,21 +45,23 @@ if [ "$*" = 'supervisord -c /etc/supervisor/conf.d/supervisord.conf' ]; then
runuser -u www-data -- php 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/*
php artisan db:seed --force
if [ -n "${IN_USER_EMAIL}" ] && [ -n "${IN_PASSWORD}" ]; then
php 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"
fi
echo "Starting supervisord..."
fi
exec "$@"
exec "$@"

View File

@@ -1,32 +1,25 @@
[unix_http_server]
file=/var/run/supervisor.sock
chmod=0700
[supervisord]
nodaemon=true
user=root
logfile=/var/log/supervisor/supervisord.log
logfile=/dev/null
logfile_maxbytes=0
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=/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
command=php /var/www/html/artisan queue:work --sleep=3 --tries=3 --max-time=3600
command=php /var/www/html/artisan queue:work --sleep=3 --tries=3 --max-time=3600 --verbose
autostart=true
autorestart=true
stopasgroup=true
@@ -34,16 +27,16 @@ 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
stdout_logfile=/dev/fd/1
stdout_logfile_maxbytes=0
redirect_stderr=true
stopwaitsecs=3600
[program:scheduler]
command=/bin/sh -c "while [ true ]; do (php /var/www/html/artisan schedule:run --verbose --no-interaction &); sleep 60; done"
command=php /var/www/html/artisan schedule:work --verbose
autostart=true
autorestart=true
user=www-data
stdout_logfile=/dev/stdout
stdout_logfile=/dev/fd/1
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0
redirect_stderr=true