mirror of
https://github.com/invoiceninja/dockerfiles.git
synced 2025-12-31 19:47:25 +01:00
Compare commits
115 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b599ca5905 | ||
|
|
d222163f82 | ||
|
|
d81eb48e55 | ||
|
|
a7f9ed049c | ||
|
|
aec886c9eb | ||
|
|
84efa573f0 | ||
|
|
849fc2365d | ||
|
|
adfa143861 | ||
|
|
b80e842ad7 | ||
|
|
f8550e7e0d | ||
|
|
f775866abf | ||
|
|
85fad200a0 | ||
|
|
16022da2ac | ||
|
|
40817ae28c | ||
|
|
af5e8d6b4f | ||
|
|
cf822e0de9 | ||
|
|
79dde723bd | ||
|
|
c90298d29c | ||
|
|
b9ba364665 | ||
|
|
77807f94f4 | ||
|
|
854b104915 | ||
|
|
192c59d596 | ||
|
|
fc6d89b9ef | ||
|
|
b572bccd0e | ||
|
|
b9bef3e436 | ||
|
|
475335244f | ||
|
|
0a774f9283 | ||
|
|
d639f649a3 | ||
|
|
b40a60a12d | ||
|
|
e1ed2f0eab | ||
|
|
f9d8cf1fee | ||
|
|
7ab9653a2a | ||
|
|
82a9c8ae19 | ||
|
|
182b600da3 | ||
|
|
279bb447a5 | ||
|
|
f6173f458b | ||
|
|
c000f42e61 | ||
|
|
c348f92aa9 | ||
|
|
d8d8415771 | ||
|
|
f897dc3b2d | ||
|
|
98f60d721c | ||
|
|
ea252c7891 | ||
|
|
abeae7fb64 | ||
|
|
fbb4bd29f7 | ||
|
|
7bb84355df | ||
|
|
3509d03cf5 | ||
|
|
3ea9b66fde | ||
|
|
15feba28e5 | ||
|
|
b1ee5a8e98 | ||
|
|
daccb15073 | ||
|
|
5970556335 | ||
|
|
e1cf8751db | ||
|
|
1ef35c361c | ||
|
|
47b370601c | ||
|
|
c72b175630 | ||
|
|
303c34665b | ||
|
|
094762fcc1 | ||
|
|
fac0ae1798 | ||
|
|
8eee7f9a1a | ||
|
|
7238c8fab4 | ||
|
|
6e24faee43 | ||
|
|
1895f822f5 | ||
|
|
7a985b4d0d | ||
|
|
6c8a692c5e | ||
|
|
91a2a106e0 | ||
|
|
7bd0a56260 | ||
|
|
32e59e289b | ||
|
|
bafea492a9 | ||
|
|
9a56657aa4 | ||
|
|
f36968c788 | ||
|
|
ee060b45fd | ||
|
|
430955d43f | ||
|
|
abc66d2491 | ||
|
|
d75b8e3616 | ||
|
|
085df042c1 | ||
|
|
b67f49b9ba | ||
|
|
d1621f0fe5 | ||
|
|
61728ec89b | ||
|
|
1bda3e5809 | ||
|
|
6a16f6f4de | ||
|
|
68cfe612ee | ||
|
|
ed9c23d9c7 | ||
|
|
f6fa32f606 | ||
|
|
a0454d3998 | ||
|
|
04f4dbe248 | ||
|
|
a7822987b2 | ||
|
|
7b7f3df710 | ||
|
|
a9b3a8a8a4 | ||
|
|
a53b702c45 | ||
|
|
39c546e270 | ||
|
|
9c0e00edb3 | ||
|
|
1f28106e43 | ||
|
|
c4513a868a | ||
|
|
856d47217e | ||
|
|
be0ec204d4 | ||
|
|
9d99120693 | ||
|
|
a5204ccb7d | ||
|
|
995d70ab60 | ||
|
|
11855e0701 | ||
|
|
42816b6282 | ||
|
|
2ad607fa2d | ||
|
|
2c25caf627 | ||
|
|
a2b64d2060 | ||
|
|
b58d4e1259 | ||
|
|
a7683ada33 | ||
|
|
3e8a6c72a7 | ||
|
|
3b0f7c463a | ||
|
|
c00d44380c | ||
|
|
cb4120fc54 | ||
|
|
f2c5a1f842 | ||
|
|
029bc57fac | ||
|
|
d60bf39950 | ||
|
|
31eb278f0d | ||
|
|
44b460bf13 | ||
|
|
7bae300fd2 |
24
.editorconfig
Normal file
24
.editorconfig
Normal file
@@ -0,0 +1,24 @@
|
||||
# EditorConfig is awesome: https://EditorConfig.org
|
||||
|
||||
# top-most EditorConfig file
|
||||
root = true
|
||||
|
||||
# Unix-style newlines with a newline ending every file
|
||||
[*]
|
||||
end_of_line = lf
|
||||
insert_final_newline = true
|
||||
|
||||
# Matches multiple files with brace expansion notation
|
||||
# Set default charset
|
||||
[*.*]
|
||||
charset = utf-8
|
||||
|
||||
# Tab indentation (no size specified)
|
||||
[Makefile]
|
||||
indent_style = tab
|
||||
|
||||
# Matches the files *.yml
|
||||
[*.yml]
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
|
||||
19
.github/workflows/auto-close-issues.yml
vendored
Normal file
19
.github/workflows/auto-close-issues.yml
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
name: Close stale issues after 5 days
|
||||
on:
|
||||
schedule:
|
||||
- cron: "0 0 * * *"
|
||||
|
||||
jobs:
|
||||
close-issues:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
issues: write
|
||||
steps:
|
||||
- uses: actions/stale@v10
|
||||
with:
|
||||
days-before-issue-stale: 4
|
||||
days-before-issue-close: 1
|
||||
stale-issue-label: "stale"
|
||||
close-issue-message: "This issue has been automatically closed due to inactivity for 5 days."
|
||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
exempt-issue-labels: "keep-open,triage,bug"
|
||||
@@ -1,17 +1,17 @@
|
||||
name: Build Octane Container Image
|
||||
name: Build Debian Container Image
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
paths:
|
||||
- ".github/**"
|
||||
- "octane/**"
|
||||
- "debian/**"
|
||||
push:
|
||||
paths:
|
||||
- ".github/**"
|
||||
- "octane/**"
|
||||
- "debian/**"
|
||||
|
||||
env:
|
||||
REGISTRY_IMAGE: invoiceninja/invoiceninja-octane
|
||||
REGISTRY_IMAGE: invoiceninja/invoiceninja-debian
|
||||
|
||||
jobs:
|
||||
build:
|
||||
@@ -40,8 +40,9 @@ jobs:
|
||||
id: build
|
||||
uses: docker/build-push-action@v6
|
||||
with:
|
||||
context: octane
|
||||
context: debian
|
||||
platforms: ${{ matrix.platform }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
tags: ${{ env.REGISTRY_IMAGE }}
|
||||
outputs: type=image,push-by-digest=true,name-canonical=true
|
||||
cache-from: type=gha
|
||||
@@ -1,4 +1,4 @@
|
||||
name: Publish Octane Container Images
|
||||
name: Publish Debian Container Images
|
||||
|
||||
on:
|
||||
push:
|
||||
@@ -6,7 +6,7 @@ on:
|
||||
- "invoiceninja-*"
|
||||
|
||||
env:
|
||||
REGISTRY_IMAGE: invoiceninja/invoiceninja-octane
|
||||
REGISTRY_IMAGE: invoiceninja/invoiceninja-debian
|
||||
|
||||
jobs:
|
||||
version:
|
||||
@@ -79,7 +79,7 @@ jobs:
|
||||
id: build
|
||||
uses: docker/build-push-action@v6
|
||||
with:
|
||||
context: octane
|
||||
context: debian
|
||||
build-args: URL=${{ needs.version.outputs.url }}
|
||||
platforms: ${{ matrix.platform }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
14
.gitignore
vendored
Normal file
14
.gitignore
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
# OS files
|
||||
.DS_Store
|
||||
.DS_Store?
|
||||
._*
|
||||
.Spotlight-V100
|
||||
.Trashes
|
||||
ehthumbs.db
|
||||
Thumbs.db
|
||||
|
||||
# Helm
|
||||
charts/**/charts/
|
||||
|
||||
# Compose filesystem
|
||||
/docker
|
||||
22
README.md
22
README.md
@@ -1,13 +1,13 @@
|
||||
[](https://hub.docker.com/r/invoiceninja/invoiceninja-octane)
|
||||
[](https://hub.docker.com/r/invoiceninja/invoiceninja-octane)
|
||||
[](https://github.com/invoiceninja/dockerfiles/actions/workflows/publish-image-octane.yaml)
|
||||
[](https://github.com/invoiceninja/dockerfiles/actions/workflows/build-image-octane.yaml)
|
||||
[](https://hub.docker.com/r/invoiceninja/invoiceninja-debian)
|
||||
[](https://hub.docker.com/r/invoiceninja/invoiceninja-debian)
|
||||
[](https://github.com/invoiceninja/dockerfiles/actions/workflows/publish-image-debian.yaml)
|
||||
[](https://github.com/invoiceninja/dockerfiles/actions/workflows/build-image-debian.yaml)
|
||||
|
||||
# Octane Docker for [Invoice Ninja](https://www.invoiceninja.com/)
|
||||
# Debian Docker for [Invoice Ninja](https://www.invoiceninja.com/)
|
||||
|
||||
👑 **Features**
|
||||
|
||||
[FRANKENPHP](https://frankenphp.dev/)
|
||||
NGINX webserver support [NGINX](https://nginx.org/)
|
||||
Built-in Chrome for PDF generation and other features
|
||||
Saxon XLST 2 engine
|
||||
OPcache
|
||||
@@ -18,8 +18,8 @@ Multi language support
|
||||
This Debian-based image includes Chrome for enhanced PDF generation and other features. To get started:
|
||||
|
||||
```bash
|
||||
git clone https://github.com/invoiceninja/dockerfiles.git -b octane
|
||||
cd dockerfiles/octane
|
||||
git clone https://github.com/invoiceninja/dockerfiles.git -b debian
|
||||
cd dockerfiles/debian
|
||||
```
|
||||
|
||||
Instead of defining our environment variables inside our docker-compose.yml file we now define this in the `.env` file, open this file up and insert your `APP_URL`, `APP_KEY` and update the rest of the variables as required.
|
||||
@@ -51,10 +51,10 @@ The `APP_KEY` can be generated by running:
|
||||
|
||||
```bash
|
||||
# If you haven't started the containers yet:
|
||||
docker run --rm -it invoiceninja/invoiceninja-octane frankenphp php-cli artisan key:generate --show
|
||||
docker run --rm -it invoiceninja/invoiceninja-debian php artisan key:generate --show
|
||||
|
||||
# Or if your containers are already running:
|
||||
docker compose exec app frankenphp php-cli 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....`
|
||||
@@ -91,4 +91,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
octane/.env → debian/.env
vendored
2
octane/.env → debian/.env
vendored
@@ -1,5 +1,5 @@
|
||||
# IN application vars
|
||||
APP_URL=http://localhost
|
||||
APP_URL=http://localhost:8012
|
||||
APP_KEY=base64:RR++yx2rJ9kdxbdh3+AmbHLDQu+Q76i++co9Y8ybbno=
|
||||
APP_ENV=production
|
||||
APP_DEBUG=true
|
||||
68
octane/Dockerfile → debian/Dockerfile
vendored
68
octane/Dockerfile → debian/Dockerfile
vendored
@@ -1,42 +1,33 @@
|
||||
ARG PHP_VERSION=8.4
|
||||
ARG FRANKENPHP_VERSION=1
|
||||
ARG DEBIAN_VERSION=trixie
|
||||
ARG PHP=8.4
|
||||
|
||||
FROM dunglas/frankenphp:${FRANKENPHP_VERSION}-php${PHP_VERSION}-${DEBIAN_VERSION} AS prepare-app
|
||||
FROM php:${PHP}-fpm AS prepare-app
|
||||
|
||||
ARG URL=https://github.com/invoiceninja/invoiceninja/releases/latest/download/invoiceninja.tar.gz
|
||||
|
||||
ADD ${URL} /tmp/invoiceninja.tar.gz
|
||||
|
||||
RUN tar -xf /tmp/invoiceninja.tar.gz \
|
||||
&& ln -s ./resources/views/react/index.blade.php ./public/index.html \
|
||||
# Symlink
|
||||
RUN tar -xzf /tmp/invoiceninja.tar.gz -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 \
|
||||
# Octane
|
||||
&& php artisan octane:install --server=frankenphp
|
||||
# Workaround for application updates
|
||||
&& mv /var/www/html/public /tmp/public
|
||||
|
||||
# ==================
|
||||
# InvoiceNinja image
|
||||
# ==================
|
||||
FROM dunglas/frankenphp:${FRANKENPHP_VERSION}-php${PHP_VERSION}-${DEBIAN_VERSION}
|
||||
|
||||
ARG user=ninja
|
||||
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"
|
||||
|
||||
# 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 \
|
||||
libfcgi-bin \
|
||||
mariadb-client \
|
||||
gpg \
|
||||
supervisor \
|
||||
# Unicode support for PDF
|
||||
fonts-noto-cjk-extra \
|
||||
fonts-wqy-microhei \
|
||||
@@ -49,15 +40,14 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
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; \
|
||||
&& apt-get install -y --no-install-recommends google-chrome-stable; \
|
||||
elif [ "$(dpkg --print-architecture)" = "arm64" ]; then \
|
||||
apt-get install -y --no-install-recommends \
|
||||
chromium \
|
||||
&& mkdir /config/chromium \
|
||||
&& chown ${user}: /config/chromium; \
|
||||
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 \
|
||||
@@ -65,38 +55,36 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Install PHP extensions
|
||||
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 ln -s "${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
|
||||
|
||||
COPY php/php-fpm.conf /usr/local/etc/php-fpm.d/invoiceninja.conf
|
||||
|
||||
# Workaround: Disable SSL for mariadb-client for compatibility with MySQL
|
||||
RUN echo "skip-ssl = true" >> /etc/mysql/mariadb.conf.d/50-client.cnf
|
||||
|
||||
# Create directory for artisan tinker (init.sh)
|
||||
RUN mkdir /config/psysh \
|
||||
&& chown ${user}: /config/psysh
|
||||
# Setup supervisor
|
||||
COPY supervisor/supervisord.conf /etc/supervisor/conf.d/supervisord.conf
|
||||
|
||||
# Change owner for caddy directories
|
||||
RUN chown -R ${user}: \
|
||||
/data/caddy \
|
||||
/config/caddy
|
||||
|
||||
# InvoiceNinja
|
||||
COPY --from=prepare-app --chown=${user}:${user} /app /app
|
||||
# Setup InvoiceNinja
|
||||
COPY --from=prepare-app --chown=www-data:www-data /var/www/html /var/www/html
|
||||
COPY --from=prepare-app --chown=www-data:www-data /tmp/public /tmp/public
|
||||
|
||||
# Add initialization script
|
||||
COPY --chmod=0755 scripts/init.sh /usr/local/bin/init.sh
|
||||
|
||||
USER ${user}
|
||||
|
||||
HEALTHCHECK --start-period=100s CMD curl -f http://localhost/health
|
||||
# Health check
|
||||
HEALTHCHECK --start-period=100s \
|
||||
CMD REMOTE_ADDR=127.0.0.1 REQUEST_URI=/health REQUEST_METHOD=GET SCRIPT_FILENAME=/var/www/html/public/index.php cgi-fcgi -bind -connect 127.0.0.1:9000 | grep '{"status":"ok","message":"API is healthy"}'
|
||||
|
||||
ENTRYPOINT ["/usr/local/bin/init.sh"]
|
||||
|
||||
CMD ["frankenphp", "php-cli", "artisan", "octane:frankenphp"]
|
||||
CMD ["supervisord", "-c", "/etc/supervisor/supervisord.conf"]
|
||||
72
debian/docker-compose.yml
vendored
Normal file
72
debian/docker-compose.yml
vendored
Normal file
@@ -0,0 +1,72 @@
|
||||
services:
|
||||
app:
|
||||
build:
|
||||
context: .
|
||||
image: invoiceninja/invoiceninja-debian:${TAG:-latest}
|
||||
restart: unless-stopped
|
||||
env_file:
|
||||
- ./.env
|
||||
volumes:
|
||||
# - ./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
|
||||
depends_on:
|
||||
mysql:
|
||||
condition: service_healthy
|
||||
redis:
|
||||
condition: service_healthy
|
||||
|
||||
nginx:
|
||||
image: nginx:alpine
|
||||
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
|
||||
depends_on:
|
||||
app:
|
||||
condition: service_healthy
|
||||
|
||||
mysql:
|
||||
image: mysql:8
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
MYSQL_DATABASE: ${DB_DATABASE}
|
||||
MYSQL_USER: ${DB_USERNAME}
|
||||
MYSQL_PASSWORD: ${DB_PASSWORD}
|
||||
MYSQL_ROOT_PASSWORD: ${DB_ROOT_PASSWORD}
|
||||
volumes:
|
||||
- mysql_data:/var/lib/mysql
|
||||
healthcheck:
|
||||
test:
|
||||
[
|
||||
"CMD",
|
||||
"mysqladmin",
|
||||
"ping",
|
||||
"-h",
|
||||
"localhost",
|
||||
"-u${MYSQL_USER}",
|
||||
"-p${MYSQL_PASSWORD}",
|
||||
]
|
||||
|
||||
redis:
|
||||
image: redis:alpine
|
||||
restart: unless-stopped
|
||||
volumes:
|
||||
- redis_data:/data
|
||||
healthcheck:
|
||||
test: ["CMD", "redis-cli", "ping"]
|
||||
|
||||
volumes:
|
||||
app_public:
|
||||
driver: local
|
||||
app_storage:
|
||||
driver: local
|
||||
mysql_data:
|
||||
driver: local
|
||||
redis_data:
|
||||
driver: local
|
||||
14
debian/nginx/invoiceninja.conf
vendored
Normal file
14
debian/nginx/invoiceninja.conf
vendored
Normal file
@@ -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 *;
|
||||
32
debian/nginx/laravel.conf
vendored
Normal file
32
debian/nginx/laravel.conf
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
# 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;
|
||||
}
|
||||
}
|
||||
1
debian/php/php-fpm.conf
vendored
Normal file
1
debian/php/php-fpm.conf
vendored
Normal file
@@ -0,0 +1 @@
|
||||
pm.max_children = 10
|
||||
5
octane/php/php.ini → debian/php/php.ini
vendored
5
octane/php/php.ini → debian/php/php.ini
vendored
@@ -2,6 +2,7 @@
|
||||
; https://www.php.net/manual/en/ini.core.php
|
||||
post_max_size=10M
|
||||
upload_max_filesize=10M
|
||||
memory_limit=512M
|
||||
|
||||
[opcache]
|
||||
; https://www.php.net/manual/en/opcache.installation.php#opcache.installation.recommended
|
||||
@@ -13,11 +14,11 @@ 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.preload=/var/www/html/preload.php
|
||||
opcache.preload_user=www-data
|
||||
opcache.validate_timestamps=0
|
||||
realpath_cache_size = 4096K
|
||||
realpath_cache_ttl = 600
|
||||
71
debian/scripts/init.sh
vendored
Executable file
71
debian/scripts/init.sh
vendored
Executable file
@@ -0,0 +1,71 @@
|
||||
#!/bin/sh -eu
|
||||
|
||||
# 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/supervisord.conf' ]; then
|
||||
|
||||
# Check for required folders and create if needed
|
||||
[ -d /var/www/html/public] || mkdir -p /var/www/html/public
|
||||
[ -d /var/www/html/storage/app/public ] || mkdir -p /var/www/html/storage/app/public
|
||||
[ -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..."
|
||||
rm -rf /var/www/html/public/.htaccess \
|
||||
/var/www/html/public/.well-known \
|
||||
/var/www/html/public/*
|
||||
cp -r /tmp/public/* \
|
||||
/tmp/public/.htaccess \
|
||||
/tmp/public/.well-known \
|
||||
/var/www/html/public/ && \
|
||||
rm -rf /tmp/public/*
|
||||
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 {} \;
|
||||
|
||||
# Clear and cache config in production
|
||||
if [ "$APP_ENV" = "production" ]; then
|
||||
runuser -u www-data -- php artisan migrate --force
|
||||
runuser -u www-data -- php artisan cache:clear # Clear after the migration
|
||||
runuser -u www-data -- php artisan ninja:design-update
|
||||
runuser -u www-data -- php artisan optimize
|
||||
|
||||
# If first IN run, it needs to be initialized
|
||||
if [ "$(runuser -u www-data -- php artisan tinker --execute='echo Schema::hasTable("accounts") && !App\Models\Account::all()->first();')" = "1" ]; then
|
||||
echo "Running initialization..."
|
||||
|
||||
runuser -u www-data -- php artisan db:seed --force
|
||||
|
||||
if [ -n "${IN_USER_EMAIL}" ] && [ -n "${IN_PASSWORD}" ]; then
|
||||
runuser -u www-data -- 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"
|
||||
fi
|
||||
|
||||
echo "Starting supervisord..."
|
||||
fi
|
||||
|
||||
exec "$@"
|
||||
39
debian/supervisor/supervisord.conf
vendored
Normal file
39
debian/supervisor/supervisord.conf
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
[supervisord]
|
||||
nodaemon=true
|
||||
user=root
|
||||
logfile=/dev/null
|
||||
logfile_maxbytes=0
|
||||
pidfile=/var/run/supervisord.pid
|
||||
|
||||
[program:php-fpm]
|
||||
command=/usr/local/sbin/php-fpm -F
|
||||
autostart=true
|
||||
autorestart=true
|
||||
priority=5
|
||||
stdout_logfile=/dev/fd/1
|
||||
stdout_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 --verbose
|
||||
autostart=true
|
||||
autorestart=true
|
||||
stopasgroup=true
|
||||
killasgroup=true
|
||||
user=www-data
|
||||
numprocs=2
|
||||
environment=HOME="/var/www"
|
||||
stdout_logfile=/dev/fd/1
|
||||
stdout_logfile_maxbytes=0
|
||||
redirect_stderr=true
|
||||
stopwaitsecs=3600
|
||||
|
||||
[program:scheduler]
|
||||
command=php /var/www/html/artisan schedule:work --verbose
|
||||
autostart=true
|
||||
autorestart=true
|
||||
user=www-data
|
||||
stdout_logfile=/dev/fd/1
|
||||
stdout_logfile_maxbytes=0
|
||||
redirect_stderr=true
|
||||
@@ -1,129 +0,0 @@
|
||||
# name: invoiceninja
|
||||
|
||||
x-app-volumes: &volumes
|
||||
volumes:
|
||||
- app_storage:/app/storage
|
||||
- caddy_data:/data
|
||||
|
||||
services:
|
||||
app:
|
||||
build:
|
||||
context: .
|
||||
image: invoiceninja/invoiceninja-octane:${TAG:-latest}
|
||||
restart: unless-stopped
|
||||
# php artisan help octane:frankenphp
|
||||
command: --port=80 --workers=2
|
||||
# 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
|
||||
environment:
|
||||
LARAVEL_ROLE: app
|
||||
<<: *volumes
|
||||
depends_on:
|
||||
mysql:
|
||||
condition: service_healthy
|
||||
redis:
|
||||
condition: service_healthy
|
||||
# mariadb:
|
||||
# condition: service_healthy
|
||||
# valkey:
|
||||
# condition: service_healthy
|
||||
|
||||
app-worker:
|
||||
image: invoiceninja/invoiceninja-octane:${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"]
|
||||
depends_on:
|
||||
app:
|
||||
condition: service_healthy
|
||||
|
||||
app-scheduler:
|
||||
image: invoiceninja/invoiceninja-octane:${TAG:-latest}
|
||||
restart: unless-stopped
|
||||
# php artisan help schedule:work
|
||||
command: --verbose
|
||||
env_file:
|
||||
- ./.env
|
||||
environment:
|
||||
LARAVEL_ROLE: scheduler
|
||||
<<: *volumes
|
||||
healthcheck:
|
||||
test: ["CMD", "pgrep", "-f", "schedule:work"]
|
||||
depends_on:
|
||||
app:
|
||||
condition: service_healthy
|
||||
|
||||
mysql:
|
||||
image: mysql:8
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
MYSQL_DATABASE: ${DB_DATABASE}
|
||||
MYSQL_USER: ${DB_USERNAME}
|
||||
MYSQL_PASSWORD: ${DB_PASSWORD}
|
||||
MYSQL_ROOT_PASSWORD: ${DB_ROOT_PASSWORD}
|
||||
volumes:
|
||||
- mysql_data:/var/lib/mysql
|
||||
healthcheck:
|
||||
test:
|
||||
[
|
||||
"CMD",
|
||||
"mysqladmin",
|
||||
"ping",
|
||||
"-h",
|
||||
"localhost",
|
||||
"-u${MYSQL_USER}",
|
||||
"-p${MYSQL_PASSWORD}",
|
||||
]
|
||||
|
||||
redis:
|
||||
image: redis:alpine
|
||||
restart: unless-stopped
|
||||
volumes:
|
||||
- redis_data:/data
|
||||
healthcheck:
|
||||
test: ["CMD", "redis-cli", "ping"]
|
||||
|
||||
# mariadb:
|
||||
# image: mariadb:11.8
|
||||
# restart: unless-stopped
|
||||
# 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"]
|
||||
|
||||
# valkey:
|
||||
# image: valkey/valkey:8
|
||||
# restart: unless-stopped
|
||||
# volumes:
|
||||
# - valkey:/data
|
||||
# healthcheck:
|
||||
# test: [ "CMD", "valkey-cli", "ping" ]
|
||||
|
||||
|
||||
volumes:
|
||||
app_storage:
|
||||
caddy_data:
|
||||
mysql_data:
|
||||
redis_data:
|
||||
# mariadb:
|
||||
# valkey:
|
||||
@@ -1,97 +0,0 @@
|
||||
#!/bin/sh -eu
|
||||
|
||||
# Fallback to app
|
||||
role=${LARAVEL_ROLE:-app}
|
||||
|
||||
# Set PDF generation browser path based on architecture
|
||||
export SNAPPDF_CHROMIUM_PATH=/usr/bin/google-chrome-stable
|
||||
if [ "$(dpkg --print-architecture)" = "arm64" ]; then
|
||||
export SNAPPDF_CHROMIUM_PATH=/usr/bin/chromium
|
||||
fi
|
||||
|
||||
# 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"
|
||||
|
||||
# Check for required folders and create if needed, relevant for bind mounts
|
||||
# It is not possible to chown, as we are not executing this script as root
|
||||
[ -d /var/www/html/storage/app/public ] || mkdir -p /var/www/html/storage/app/public
|
||||
[ -d /app/storage/framework/sessions ] || mkdir -p /app/storage/framework/sessions
|
||||
[ -d /app/storage/framework/views ] || mkdir -p /app/storage/framework/views
|
||||
[ -d /app/storage/framework/cache ] || mkdir -p /app/storage/framework/cache
|
||||
[ -d /app/storage/logs ] || mkdir -p /app/storage/logs
|
||||
|
||||
if [ "$APP_ENV" = "production" ]; then
|
||||
frankenphp php-cli artisan migrate --force
|
||||
frankenphp php-cli artisan cache:clear # Clear after the migration
|
||||
frankenphp php-cli artisan ninja:design-update
|
||||
frankenphp php-cli artisan optimize
|
||||
|
||||
# If first IN run, it needs to be initialized
|
||||
if [ "$(frankenphp php-cli artisan tinker --execute='echo Schema::hasTable("accounts") && !App\Models\Account::all()->first();')" = "1" ]; then
|
||||
echo "Running initialization..."
|
||||
|
||||
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
|
||||
fi
|
||||
|
||||
echo "Production setup completed"
|
||||
# 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
|
||||
|
||||
# Append flag(s) to role cmd
|
||||
if [ "${1#-}" != "$1" ]; then
|
||||
set -- ${cmd} "$@"
|
||||
else
|
||||
set -- ${cmd}
|
||||
fi
|
||||
fi
|
||||
|
||||
exec "$@"
|
||||
Reference in New Issue
Block a user