mirror of
https://github.com/invoiceninja/dockerfiles.git
synced 2026-01-27 17:27:12 +01:00
Compare commits
34 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
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 |
21
.github/workflows/auto-close-issues.yml
vendored
Normal file
21
.github/workflows/auto-close-issues.yml
vendored
Normal 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
|
||||||
4
.github/workflows/build-image-debian.yaml
vendored
4
.github/workflows/build-image-debian.yaml
vendored
@@ -1,4 +1,4 @@
|
|||||||
name: Build Debian Octane Container Image
|
name: Build Debian Container Image
|
||||||
|
|
||||||
on:
|
on:
|
||||||
pull_request:
|
pull_request:
|
||||||
@@ -33,6 +33,6 @@ jobs:
|
|||||||
context: debian
|
context: debian
|
||||||
file: debian/Dockerfile
|
file: debian/Dockerfile
|
||||||
load: true
|
load: true
|
||||||
tags: invoiceninja/invoiceninja-octane:test
|
tags: invoiceninja/invoiceninja-debian:test
|
||||||
cache-from: type=gha
|
cache-from: type=gha
|
||||||
cache-to: type=gha,mode=max
|
cache-to: type=gha,mode=max
|
||||||
|
|||||||
6
.github/workflows/publish-image.yaml
vendored
6
.github/workflows/publish-image.yaml
vendored
@@ -11,12 +11,12 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
include:
|
include:
|
||||||
- image: invoiceninja/invoiceninja-octane
|
- image: invoiceninja/invoiceninja-debian
|
||||||
context: debian
|
context: ./debian
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4 # Updated from v2
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|
||||||
|
|||||||
12
README.md
12
README.md
@@ -54,7 +54,7 @@ The `APP_KEY` can be generated by running:
|
|||||||
docker run --rm -it invoiceninja/invoiceninja-debian php artisan key:generate --show
|
docker run --rm -it invoiceninja/invoiceninja-debian php artisan key:generate --show
|
||||||
|
|
||||||
# Or if your containers are already running:
|
# 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....`
|
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:
|
Start the container with:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
docker-compose up -d
|
docker compose up -d
|
||||||
```
|
```
|
||||||
|
|
||||||
**Note: When performing the setup, the Database host is ```mysql```
|
**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:
|
To upgrade to a newer release image, update your docker-compose.yml first by running:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
docker-compose down
|
docker compose down
|
||||||
docker-compose pull
|
docker compose pull
|
||||||
docker-compose up
|
docker compose up
|
||||||
```
|
```
|
||||||
|
|
||||||
It is recommended to perform a backup before updating.
|
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
|
- [ ] Backup script
|
||||||
- [ ] Integrate soketi server
|
- [ ] Integrate soketi server
|
||||||
- [ ] Add elastic search for site wide search
|
- [ ] Add elastic search for site wide search
|
||||||
|
|||||||
67
debian/Dockerfile
vendored
67
debian/Dockerfile
vendored
@@ -1,39 +1,31 @@
|
|||||||
ARG PHP_VERSION=8.3
|
ARG PHP=8.3
|
||||||
ARG FRANKENPHP_VERSION=1
|
|
||||||
ARG DEBIAN_VERSION=bookworm
|
|
||||||
|
|
||||||
FROM dunglas/frankenphp:${FRANKENPHP_VERSION}-php${PHP_VERSION}-${DEBIAN_VERSION} AS prepare-app
|
FROM php:${PHP}-fpm AS prepare-app
|
||||||
|
|
||||||
|
USER www-data
|
||||||
|
|
||||||
RUN curl -sL "https://github.com/invoiceninja/invoiceninja/releases/latest/download/invoiceninja.tar.gz" | \
|
RUN curl -sL "https://github.com/invoiceninja/invoiceninja/releases/latest/download/invoiceninja.tar.gz" | \
|
||||||
tar -xz \
|
tar -xz -C /var/www/html \
|
||||||
&& ln -s ./resources/views/react/index.blade.php ./public/index.html \
|
&& ln -s /var/www/html/resources/views/react/index.blade.php /var/www/html/public/index.html \
|
||||||
# Symlink
|
|
||||||
&& php artisan storage:link \
|
&& php artisan storage:link \
|
||||||
# Octane
|
# Workaround for application updates
|
||||||
&& php artisan octane:install --server=frankenphp
|
&& mv /var/www/html/public /tmp/public
|
||||||
|
|
||||||
# ==================
|
# ==================
|
||||||
# InvoiceNinja image
|
# InvoiceNinja image
|
||||||
# ==================
|
# ==================
|
||||||
FROM dunglas/frankenphp:${FRANKENPHP_VERSION}-php${PHP_VERSION}-${DEBIAN_VERSION}
|
FROM php:${PHP}-fpm
|
||||||
|
|
||||||
ARG user=ninja
|
|
||||||
|
|
||||||
# PHP modules
|
# PHP modules
|
||||||
ARG php_require="bcmath gd mbstring pdo_mysql zip"
|
ARG php_require="bcmath gd mbstring pdo_mysql zip"
|
||||||
ARG php_suggest="exif imagick intl pcntl saxon soap"
|
ARG php_suggest="exif imagick intl pcntl saxon soap"
|
||||||
ARG php_extra="opcache"
|
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
|
# Install system dependencies
|
||||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||||
mariadb-client \
|
mariadb-client \
|
||||||
gpg \
|
gpg \
|
||||||
|
supervisor \
|
||||||
# Unicode support for PDF
|
# Unicode support for PDF
|
||||||
fonts-noto-cjk-extra \
|
fonts-noto-cjk-extra \
|
||||||
fonts-wqy-microhei \
|
fonts-wqy-microhei \
|
||||||
@@ -46,15 +38,14 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
|
|||||||
gpg --dearmor -o /etc/apt/keyrings/google.gpg \
|
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 \
|
&& 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 update \
|
||||||
&& apt-get install -y --no-install-recommends google-chrome-stable \
|
&& 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 \
|
elif [ "$(dpkg --print-architecture)" = "arm64" ]; then \
|
||||||
apt-get install -y --no-install-recommends \
|
apt-get install -y --no-install-recommends \
|
||||||
chromium \
|
chromium; \
|
||||||
&& mkdir /config/chromium \
|
|
||||||
&& chown ${user}: /config/chromium; \
|
|
||||||
fi \
|
fi \
|
||||||
|
# Create config directory for chromium/google-chrome-stable
|
||||||
|
&& mkdir /var/www/.config \
|
||||||
|
&& chown www-data:www-data /var/www/.config \
|
||||||
# Cleanup
|
# Cleanup
|
||||||
&& apt-get purge -y gpg \
|
&& apt-get purge -y gpg \
|
||||||
&& apt-get autoremove -y \
|
&& apt-get autoremove -y \
|
||||||
@@ -62,35 +53,33 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
|
|||||||
&& rm -rf /var/lib/apt/lists/*
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
# Install PHP extensions
|
# Install PHP extensions
|
||||||
|
COPY --from=ghcr.io/mlocati/php-extension-installer /usr/bin/install-php-extensions /usr/local/bin/
|
||||||
|
|
||||||
RUN install-php-extensions \
|
RUN install-php-extensions \
|
||||||
${php_require} \
|
${php_require} \
|
||||||
${php_suggest} \
|
${php_suggest} \
|
||||||
${php_extra}
|
${php_extra}
|
||||||
|
|
||||||
# Configure PHP
|
# 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.ini /usr/local/etc/php/conf.d/invoiceninja.ini
|
||||||
|
|
||||||
# Create directory for artisan tinker (init.sh)
|
COPY php/php-fpm.conf /usr/local/etc/php-fpm.d/invoiceninja.conf
|
||||||
RUN mkdir /config/psysh \
|
|
||||||
&& chown ${user}: /config/psysh
|
|
||||||
|
|
||||||
# Change owner for caddy directories
|
# Setup supervisor
|
||||||
RUN chown -R ${user}: \
|
COPY supervisor/supervisord.conf /etc/supervisor/conf.d/supervisord.conf
|
||||||
/data/caddy \
|
|
||||||
/config/caddy
|
|
||||||
|
|
||||||
# InvoiceNinja
|
# Setup InvoiceNinja
|
||||||
COPY --from=prepare-app --chown=${user}:${user} /app /app
|
COPY --from=prepare-app /var/www/html /var/www/html
|
||||||
|
COPY --from=prepare-app /tmp/public /tmp/public
|
||||||
|
|
||||||
# Add initialization script
|
# Add initialization script
|
||||||
COPY --chmod=0755 scripts/init.sh /usr/local/bin/init.sh
|
COPY --chmod=0755 scripts/init.sh /usr/local/bin/init.sh
|
||||||
|
|
||||||
USER ${user}
|
# Health check
|
||||||
|
HEALTHCHECK --interval=30s --timeout=5s --start-period=30s --retries=3 \
|
||||||
HEALTHCHECK --start-period=10s CMD curl -f http://localhost/health
|
CMD pgrep -f "php-fpm: master process"
|
||||||
|
|
||||||
ENTRYPOINT ["/usr/local/bin/init.sh"]
|
ENTRYPOINT ["/usr/local/bin/init.sh"]
|
||||||
|
CMD ["supervisord", "-c", "/etc/supervisor/conf.d/supervisord.conf"]
|
||||||
CMD ["frankenphp", "php-cli", "artisan", "octane:frankenphp"]
|
|
||||||
|
|||||||
118
debian/docker-compose.yml
vendored
118
debian/docker-compose.yml
vendored
@@ -1,83 +1,46 @@
|
|||||||
# name: invoiceninja
|
|
||||||
|
|
||||||
x-logging: &default-logging
|
x-logging: &default-logging
|
||||||
options:
|
options:
|
||||||
max-size: "10m"
|
max-size: "10m"
|
||||||
max-file: "3"
|
max-file: "3"
|
||||||
driver: json-file
|
driver: json-file
|
||||||
|
|
||||||
x-app-volumes: &volumes
|
|
||||||
volumes:
|
|
||||||
- ./.env:/app/.env
|
|
||||||
- app_storage:/app/storage
|
|
||||||
- caddy_data:/data
|
|
||||||
|
|
||||||
services:
|
services:
|
||||||
app:
|
app:
|
||||||
build:
|
build:
|
||||||
context: .
|
context: .
|
||||||
image: invoiceninja/invoiceninja-debian:${TAG:-latest}
|
image: invoiceninja/invoiceninja-debian:${TAG:-latest}
|
||||||
restart: unless-stopped
|
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_file:
|
||||||
- ./.env
|
- ./.env
|
||||||
environment:
|
volumes:
|
||||||
LARAVEL_ROLE: app
|
- ./.env:/var/www/html/.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
|
||||||
|
networks:
|
||||||
|
- app-network
|
||||||
depends_on:
|
depends_on:
|
||||||
mysql:
|
mysql:
|
||||||
condition: service_healthy
|
condition: service_healthy
|
||||||
redis:
|
redis:
|
||||||
condition: service_healthy
|
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
|
logging: *default-logging
|
||||||
|
|
||||||
app-scheduler:
|
nginx:
|
||||||
image: invoiceninja/invoiceninja-debian:${TAG:-latest}
|
image: nginx:alpine
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
# php artisan help schedule:work
|
ports:
|
||||||
command: --verbose
|
- "80:80"
|
||||||
env_file:
|
volumes:
|
||||||
- ./.env
|
- ./nginx:/etc/nginx/conf.d:ro
|
||||||
environment:
|
- app_public:/var/www/html/public:ro
|
||||||
LARAVEL_ROLE: scheduler
|
- app_storage:/var/www/html/storage:ro
|
||||||
<<: *volumes
|
networks:
|
||||||
healthcheck:
|
- app-network
|
||||||
test: ["CMD", "pgrep", "-f", "schedule:work"]
|
|
||||||
start_period: 10s
|
|
||||||
depends_on:
|
depends_on:
|
||||||
app:
|
- app
|
||||||
condition: service_healthy
|
|
||||||
logging: *default-logging
|
logging: *default-logging
|
||||||
|
|
||||||
mysql:
|
mysql:
|
||||||
@@ -92,6 +55,8 @@ services:
|
|||||||
MYSQL_ROOT_PASSWORD: ${DB_ROOT_PASSWORD}
|
MYSQL_ROOT_PASSWORD: ${DB_ROOT_PASSWORD}
|
||||||
volumes:
|
volumes:
|
||||||
- mysql_data:/var/lib/mysql
|
- mysql_data:/var/lib/mysql
|
||||||
|
networks:
|
||||||
|
- app-network
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test: [ "CMD", "mysqladmin", "ping", "-h", "localhost", "-u${MYSQL_USER}", "-p${MYSQL_PASSWORD}" ]
|
test: [ "CMD", "mysqladmin", "ping", "-h", "localhost", "-u${MYSQL_USER}", "-p${MYSQL_PASSWORD}" ]
|
||||||
interval: 10s
|
interval: 10s
|
||||||
@@ -104,6 +69,8 @@ services:
|
|||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
volumes:
|
volumes:
|
||||||
- redis_data:/data
|
- redis_data:/data
|
||||||
|
networks:
|
||||||
|
- app-network
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test: [ "CMD", "redis-cli", "ping" ]
|
test: [ "CMD", "redis-cli", "ping" ]
|
||||||
interval: 10s
|
interval: 10s
|
||||||
@@ -111,37 +78,16 @@ services:
|
|||||||
retries: 5
|
retries: 5
|
||||||
logging: *default-logging
|
logging: *default-logging
|
||||||
|
|
||||||
# mariadb:
|
networks:
|
||||||
# image: mariadb:11.4
|
app-network:
|
||||||
# restart: unless-stopped
|
driver: bridge
|
||||||
# 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:
|
volumes:
|
||||||
|
app_public:
|
||||||
|
driver: local
|
||||||
app_storage:
|
app_storage:
|
||||||
caddy_data:
|
driver: local
|
||||||
mysql_data:
|
mysql_data:
|
||||||
|
driver: local
|
||||||
redis_data:
|
redis_data:
|
||||||
# mariadb:
|
driver: local
|
||||||
# valkey:
|
|
||||||
|
|||||||
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
|
||||||
4
debian/php/php.ini
vendored
4
debian/php/php.ini
vendored
@@ -13,11 +13,11 @@ opcache.jit=tracing
|
|||||||
opcache.jit_buffer_size=64M
|
opcache.jit_buffer_size=64M
|
||||||
|
|
||||||
[extra]
|
[extra]
|
||||||
; https://frankenphp.dev/docs/performance/#php-performance
|
|
||||||
; http://symfony.com/doc/current/performance.html
|
; http://symfony.com/doc/current/performance.html
|
||||||
opcache.memory_consumption=256
|
opcache.memory_consumption=256
|
||||||
opcache.max_accelerated_files=20000
|
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
|
opcache.validate_timestamps=0
|
||||||
realpath_cache_size = 4096K
|
realpath_cache_size = 4096K
|
||||||
realpath_cache_ttl = 600
|
realpath_cache_ttl = 600
|
||||||
|
|||||||
110
debian/scripts/init.sh
vendored
110
debian/scripts/init.sh
vendored
@@ -1,72 +1,57 @@
|
|||||||
#!/bin/sh -eu
|
#!/bin/sh -eu
|
||||||
|
|
||||||
# Fallback to app
|
|
||||||
role=${LARAVEL_ROLE:-app}
|
|
||||||
|
|
||||||
# Set PDF generation browser path based on architecture
|
# Set PDF generation browser path based on architecture
|
||||||
export SNAPPDF_CHROMIUM_PATH=/usr/bin/google-chrome-stable
|
if [ "$(dpkg --print-architecture)" = "amd64" ]; then
|
||||||
if [ "$(dpkg --print-architecture)" = "arm64" ]; then
|
export SNAPPDF_CHROMIUM_PATH=/usr/bin/google-chrome-stable
|
||||||
|
elif [ "$(dpkg --print-architecture)" = "arm64" ]; then
|
||||||
export SNAPPDF_CHROMIUM_PATH=/usr/bin/chromium
|
export SNAPPDF_CHROMIUM_PATH=/usr/bin/chromium
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Check for default CMD, flag(s) or empty CMD
|
if [ "$*" = 'supervisord -c /etc/supervisor/conf.d/supervisord.conf' ]; then
|
||||||
if [ "$*" = 'frankenphp php-cli artisan octane:frankenphp' ] || [ "${1#-}" != "$1" ] || [ "$#" -eq "0" ]; then
|
|
||||||
|
|
||||||
if [ "--help" = "$1" ]; then
|
# Check for required folders and create if needed
|
||||||
echo [CMD]
|
[ -d /var/www/html/storage/framework/sessions ] || mkdir -p /var/www/html/storage/framework/sessions
|
||||||
echo "This image will execute specific CMDs based on the environment variable LARAVEL_ROLE"
|
[ -d /var/www/html/storage/framework/views ] || mkdir -p /var/www/html/storage/framework/views
|
||||||
echo
|
[ -d /var/www/html/storage/framework/cache ] || mkdir -p /var/www/html/storage/framework/cache
|
||||||
echo "LARAVEL_ROLE=app: frankenphp php-cli artisan octane:frankenphp (default)"
|
|
||||||
echo "LARAVEL_ROLE=worker: frankenphp php-cli artisan queue:work"
|
# Workaround for application updates
|
||||||
echo "LARAVEL_ROLE=scheduler: frankenphp php-cli artisan schedule:work"
|
if [ "$(ls -A /tmp/public)" ]; then
|
||||||
echo
|
echo "Updating public folder..."
|
||||||
echo [FLAGS]
|
rm -rf /var/www/html/public/.htaccess \
|
||||||
echo To the CMD defined by LARAVEL_ROLE can be extended with flags for artisan commands
|
/var/www/html/public/.well-known \
|
||||||
echo
|
/var/www/html/public/*
|
||||||
echo Available flags can be displaced:
|
mv /tmp/public/* \
|
||||||
echo docker run --rm invoiceninja/invoiceninja-debian frankenphp php-cli artisan help octane:frankenphp
|
/tmp/public/.htaccess \
|
||||||
echo docker run --rm invoiceninja/invoiceninja-debian frankenphp php-cli artisan queue:work
|
/tmp/public/.well-known \
|
||||||
echo docker run --rm invoiceninja/invoiceninja-debian frankenphp php-cli artisan schedule:work
|
/var/www/html/public/
|
||||||
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
|
fi
|
||||||
|
echo "Public Folder is up to date"
|
||||||
|
|
||||||
# Run app
|
# Ensure owner, file and directory permissions are correct
|
||||||
if [ "${role}" = "app" ]; then
|
chown -R www-data:www-data \
|
||||||
cmd="frankenphp php-cli artisan octane:frankenphp"
|
/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 {} \;
|
||||||
|
|
||||||
# Check for required folders and create if needed, relevant for bind mounts
|
# Clear and cache config in production
|
||||||
# It is not possible to chown, as we are not executing this script as root
|
if [ "$APP_ENV" = "production" ]; then
|
||||||
[ -d /var/www/html/storage/framework/sessions ] || mkdir -p /var/www/html/storage/framework/sessions
|
runuser -u www-data -- php artisan optimize
|
||||||
[ -d /var/www/html/storage/framework/views ] || mkdir -p /var/www/html/storage/framework/views
|
runuser -u www-data -- php artisan package:discover
|
||||||
[ -d /var/www/html/storage/framework/cache ] || mkdir -p /var/www/html/storage/framework/cache
|
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
|
# 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
|
if [ "$(php -d opcache.preload='' artisan tinker --execute='echo Schema::hasTable("accounts") && !App\Models\Account::all()->first();')" = "1" ]; then
|
||||||
echo "Running initialization..."
|
echo "Running initialization..."
|
||||||
|
|
||||||
frankenphp php-cli artisan db:seed --force
|
php artisan db:seed --force
|
||||||
|
|
||||||
if [ -n "${IN_USER_EMAIL}" ] && [ -n "${IN_PASSWORD}" ]; then
|
if [ -n "${IN_USER_EMAIL}" ] && [ -n "${IN_PASSWORD}" ]; then
|
||||||
frankenphp php-cli artisan ninja:create-account --email "${IN_USER_EMAIL}" --password "${IN_PASSWORD}"
|
php artisan ninja:create-account --email "${IN_USER_EMAIL}" --password "${IN_PASSWORD}"
|
||||||
else
|
else
|
||||||
echo "Initialization failed - Set IN_USER_EMAIL and IN_PASSWORD in .env"
|
echo "Initialization failed - Set IN_USER_EMAIL and IN_PASSWORD in .env"
|
||||||
exit 1
|
exit 1
|
||||||
@@ -74,24 +59,9 @@ if [ "$*" = 'frankenphp php-cli artisan octane:frankenphp' ] || [ "${1#-}" != "$
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Production setup completed"
|
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
|
fi
|
||||||
|
|
||||||
# Append flag(s) to role cmd
|
echo "Starting supervisord..."
|
||||||
if [ "${1#-}" != "$1" ]; then
|
|
||||||
set -- ${cmd} "$@"
|
|
||||||
else
|
|
||||||
set -- ${cmd}
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
exec "$@"
|
exec "$@"
|
||||||
42
debian/supervisor/supervisord.conf
vendored
Normal file
42
debian/supervisor/supervisord.conf
vendored
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
[supervisord]
|
||||||
|
nodaemon=true
|
||||||
|
user=root
|
||||||
|
logfile=/dev/null
|
||||||
|
logfile_maxbytes=0
|
||||||
|
pidfile=/var/run/supervisord.pid
|
||||||
|
|
||||||
|
[rpcinterface:supervisor]
|
||||||
|
supervisor.rpcinterface_factory=supervisor.rpcinterface:make_main_rpcinterface
|
||||||
|
|
||||||
|
[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
|
||||||
Reference in New Issue
Block a user