mirror of
https://github.com/invoiceninja/dockerfiles.git
synced 2026-01-06 22:47:26 +01:00
Compare commits
96 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9d99120693 | ||
|
|
a5204ccb7d | ||
|
|
995d70ab60 | ||
|
|
11855e0701 | ||
|
|
42816b6282 | ||
|
|
2ad607fa2d | ||
|
|
2c25caf627 | ||
|
|
a2b64d2060 | ||
|
|
b58d4e1259 | ||
|
|
a7683ada33 | ||
|
|
3e8a6c72a7 | ||
|
|
3b0f7c463a | ||
|
|
c00d44380c | ||
|
|
cb4120fc54 | ||
|
|
f2c5a1f842 | ||
|
|
029bc57fac | ||
|
|
d60bf39950 | ||
|
|
31eb278f0d | ||
|
|
44b460bf13 | ||
|
|
7bae300fd2 | ||
|
|
3394694ffc | ||
|
|
99f280319c | ||
|
|
470a3d036d | ||
|
|
514ebb74c6 | ||
|
|
dc3b87140f | ||
|
|
c0afd971e1 | ||
|
|
677cc44a15 | ||
|
|
91c7b1ea2a | ||
|
|
a508ccc41e | ||
|
|
d42f66617c | ||
|
|
8746015041 | ||
|
|
53c38b65f9 | ||
|
|
473e38259f | ||
|
|
d538666600 | ||
|
|
0ace427585 | ||
|
|
8c1357fc4c | ||
|
|
806a340a00 | ||
|
|
d437dab72c | ||
|
|
d64ed83abf | ||
|
|
337f38e0dc | ||
|
|
5d5c036175 | ||
|
|
d5ed1935f7 | ||
|
|
5e40e34943 | ||
|
|
c4e1d0e3a5 | ||
|
|
84dcb8caab | ||
|
|
733e72d5dd | ||
|
|
7eaf6968d2 | ||
|
|
66408fccb2 | ||
|
|
79647d4f8c | ||
|
|
067b5eb194 | ||
|
|
eed358c32b | ||
|
|
71909c73e0 | ||
|
|
fab57c9db3 | ||
|
|
e7bc565745 | ||
|
|
87092bb8bd | ||
|
|
5abd297c7f | ||
|
|
8be252781f | ||
|
|
f281b33ea1 | ||
|
|
22d170a4e5 | ||
|
|
f722c91d21 | ||
|
|
641b527702 | ||
|
|
d139a48303 | ||
|
|
a75b6f0a00 | ||
|
|
113c700754 | ||
|
|
b6be06c977 | ||
|
|
8c53895c97 | ||
|
|
8204465048 | ||
|
|
baad65c737 | ||
|
|
9fd35b874d | ||
|
|
fe4993f8a3 | ||
|
|
b83fb831b9 | ||
|
|
687e74c983 | ||
|
|
7644151370 | ||
|
|
c84f80f9a9 | ||
|
|
6cfdca078f | ||
|
|
74ed1b2432 | ||
|
|
b3b7f7b9f0 | ||
|
|
a6d8f663ae | ||
|
|
3024f11a31 | ||
|
|
6274c432d9 | ||
|
|
f5afd3f527 | ||
|
|
3ce5983131 | ||
|
|
bfc61fb64e | ||
|
|
535d6d4c06 | ||
|
|
24d49a4374 | ||
|
|
30ad63f306 | ||
|
|
60fd0aa79e | ||
|
|
d1786100ca | ||
|
|
f58ca724c9 | ||
|
|
53cadbf750 | ||
|
|
3fca330958 | ||
|
|
7d79b39bc2 | ||
|
|
aa271a1488 | ||
|
|
451c1b872f | ||
|
|
5c74753da2 | ||
|
|
83f17aa669 |
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
|
||||||
2
.github/workflows/build-image-debian.yaml
vendored
2
.github/workflows/build-image-debian.yaml
vendored
@@ -12,7 +12,7 @@ on:
|
|||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
docker:
|
docker:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-22.04
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|||||||
2
.github/workflows/publish-image.yaml
vendored
2
.github/workflows/publish-image.yaml
vendored
@@ -7,7 +7,7 @@ on:
|
|||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
docker:
|
docker:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-22.04
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
include:
|
include:
|
||||||
|
|||||||
2
.github/workflows/release-chart.yaml
vendored
2
.github/workflows/release-chart.yaml
vendored
@@ -12,7 +12,7 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|
||||||
|
|||||||
4
.github/workflows/test-charts.yaml
vendored
4
.github/workflows/test-charts.yaml
vendored
@@ -12,7 +12,7 @@ jobs:
|
|||||||
matrix: ${{ steps.set-matrix.outputs.matrix }}
|
matrix: ${{ steps.set-matrix.outputs.matrix }}
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|
||||||
@@ -55,7 +55,7 @@ jobs:
|
|||||||
- "1.23.15"
|
- "1.23.15"
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|
||||||
|
|||||||
11
debian/.env
vendored
11
debian/.env
vendored
@@ -8,10 +8,16 @@ PHANTOMJS_PDF_GENERATION=false
|
|||||||
PDF_GENERATOR=snappdf
|
PDF_GENERATOR=snappdf
|
||||||
TRUSTED_PROXIES='*'
|
TRUSTED_PROXIES='*'
|
||||||
|
|
||||||
|
|
||||||
|
CACHE_DRIVER=redis
|
||||||
QUEUE_CONNECTION=redis
|
QUEUE_CONNECTION=redis
|
||||||
|
SESSION_DRIVER=redis
|
||||||
|
|
||||||
|
REDIS_HOST=redis
|
||||||
|
REDIS_PASSWORD=null
|
||||||
|
REDIS_PORT=6379
|
||||||
|
|
||||||
# FILESYSTEM_DISK=local
|
FILESYSTEM_DISK=debian_docker
|
||||||
|
|
||||||
# DB connection
|
# DB connection
|
||||||
DB_HOST=mysql
|
DB_HOST=mysql
|
||||||
@@ -52,4 +58,5 @@ NORDIGEN_SECRET_KEY=
|
|||||||
IS_DOCKER=true
|
IS_DOCKER=true
|
||||||
SCOUT_DRIVER=null
|
SCOUT_DRIVER=null
|
||||||
SNAPPDF_CHROMIUM_PATH=/usr/bin/google-chrome-stable
|
SNAPPDF_CHROMIUM_PATH=/usr/bin/google-chrome-stable
|
||||||
#SNAPPDF_CHROMIUM_PATH=/usr/bin/google-chrome
|
|
||||||
|
|
||||||
|
|||||||
211
debian/Dockerfile
vendored
211
debian/Dockerfile
vendored
@@ -1,179 +1,88 @@
|
|||||||
FROM php:8.2-fpm AS base
|
ARG PHP=8.3
|
||||||
ARG saxon=12.5.0
|
|
||||||
|
FROM php:${PHP}-fpm AS prepare-app
|
||||||
|
|
||||||
|
USER www-data
|
||||||
|
|
||||||
|
RUN curl -s "https://api.github.com/repos/invoiceninja/invoiceninja/releases/latest" | \
|
||||||
|
grep -o '"browser_download_url": "[^"]*invoiceninja.tar.gz"' | \
|
||||||
|
cut -d '"' -f 4 | \
|
||||||
|
xargs curl -sL | \
|
||||||
|
tar -xz --strip-components=1 -C /var/www/html \
|
||||||
|
&& ln -s /var/www/html/resources/views/react/index.blade.php /var/www/html/public/index.html \
|
||||||
|
&& php -d opcache.preload='' 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 pdo_mysql zip mbstring"
|
||||||
|
ARG php_suggest="exif imagick intl pcntl soap saxon-12.5.0"
|
||||||
|
ARG php_extra="opcache"
|
||||||
|
|
||||||
# Install system dependencies
|
# Install system dependencies
|
||||||
RUN apt-get update && apt-get install -y \
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||||
git \
|
mariadb-client \
|
||||||
curl \
|
gpg \
|
||||||
libpng-dev \
|
|
||||||
libonig-dev \
|
|
||||||
libxml2-dev \
|
|
||||||
zip \
|
|
||||||
unzip \
|
|
||||||
gosu \
|
|
||||||
default-mysql-client \
|
|
||||||
supervisor \
|
supervisor \
|
||||||
fonts-liberation \
|
# Unicode support for PDF
|
||||||
libasound2 \
|
|
||||||
libatk-bridge2.0-0 \
|
|
||||||
libatk1.0-0 \
|
|
||||||
libatspi2.0-0 \
|
|
||||||
libcups2 \
|
|
||||||
libdbus-1-3 \
|
|
||||||
libdrm2 \
|
|
||||||
libgbm1 \
|
|
||||||
libgtk-3-0 \
|
|
||||||
libnspr4 \
|
|
||||||
libnss3 \
|
|
||||||
libwayland-client0 \
|
|
||||||
libxcomposite1 \
|
|
||||||
libxdamage1 \
|
|
||||||
libxfixes3 \
|
|
||||||
libxkbcommon0 \
|
|
||||||
libxrandr2 \
|
|
||||||
xdg-utils \
|
|
||||||
fonts-noto-cjk \
|
|
||||||
fonts-noto-cjk-extra \
|
fonts-noto-cjk-extra \
|
||||||
fonts-wqy-microhei \
|
fonts-wqy-microhei \
|
||||||
fonts-wqy-zenhei \
|
fonts-wqy-zenhei \
|
||||||
xfonts-wqy \
|
xfonts-wqy \
|
||||||
wget \
|
# Install google-chrome-stable(amd64)/chromium(arm64)
|
||||||
gnupg2 \
|
|
||||||
&& if [ "$(dpkg --print-architecture)" = "amd64" ]; then \
|
&& if [ "$(dpkg --print-architecture)" = "amd64" ]; then \
|
||||||
wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - \
|
mkdir -p /etc/apt/keyrings \
|
||||||
&& echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" > /etc/apt/sources.list.d/google-chrome.list \
|
&& curl -fsSL https://dl.google.com/linux/linux_signing_key.pub | \
|
||||||
&& apt-get update \
|
gpg --dearmor -o /etc/apt/keyrings/google.gpg \
|
||||||
&& apt-get install -y google-chrome-stable; \
|
&& 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; \
|
||||||
fi \
|
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 \
|
||||||
&& apt-get clean \
|
&& apt-get clean \
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
# Set permissions for www-data to execute
|
# Install PHP extensions
|
||||||
RUN mkdir -p /var/www/.chrome/chrome-profile \
|
COPY --from=ghcr.io/mlocati/php-extension-installer /usr/bin/install-php-extensions /usr/local/bin/
|
||||||
&& chown -R www-data:www-data /var/www/.chrome \
|
|
||||||
&& chmod -R 755 /var/www/.chrome \
|
|
||||||
&& if [ "$(dpkg --print-architecture)" = "amd64" ]; then \
|
|
||||||
chown root:root /usr/bin/google-chrome \
|
|
||||||
&& chmod 4755 /usr/bin/google-chrome \
|
|
||||||
&& chown -R root:root /opt/google/chrome \
|
|
||||||
&& chmod -R 755 /opt/google/chrome; \
|
|
||||||
fi \
|
|
||||||
&& chown -R www-data:www-data /var/www
|
|
||||||
|
|
||||||
# Create required directories with proper permissions
|
|
||||||
RUN mkdir -p /tmp/chrome \
|
|
||||||
&& if [ "$(dpkg --print-architecture)" = "amd64" ]; then \
|
|
||||||
chown -R www-data:www-data /tmp/chrome \
|
|
||||||
&& chmod -R 755 /tmp/chrome; \
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Copy Install PHP extensions installer
|
|
||||||
COPY --from=mlocati/php-extension-installer /usr/bin/install-php-extensions /usr/local/bin/
|
|
||||||
|
|
||||||
# Install Required PHP extensions.
|
|
||||||
RUN install-php-extensions \
|
RUN install-php-extensions \
|
||||||
pdo_mysql \
|
${php_require} \
|
||||||
mysqli \
|
${php_suggest} \
|
||||||
mbstring \
|
${php_extra}
|
||||||
exif \
|
|
||||||
pcntl \
|
|
||||||
bcmath \
|
|
||||||
gd \
|
|
||||||
opcache \
|
|
||||||
redis \
|
|
||||||
soap \
|
|
||||||
imagick \
|
|
||||||
curl \
|
|
||||||
gmp \
|
|
||||||
zip \
|
|
||||||
@composer
|
|
||||||
|
|
||||||
# Configure PHP
|
# Configure PHP
|
||||||
COPY php/php.ini /usr/local/etc/php/conf.d/app.ini
|
RUN ln -s "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini"
|
||||||
COPY php/php-fpm.conf /usr/local/etc/php-fpm.d/www.conf
|
|
||||||
|
|
||||||
# Configure Saxon
|
COPY php/php.ini /usr/local/etc/php/conf.d/invoiceninja.ini
|
||||||
WORKDIR /opt
|
|
||||||
|
|
||||||
RUN if [ "$(dpkg --print-architecture)" = "amd64" ]; then \
|
COPY php/php-fpm.conf /usr/local/etc/php-fpm.d/invoiceninja.conf
|
||||||
curl https://downloads.saxonica.com/SaxonC/HE/12/libsaxon-HEC-linux-x86_64-v${saxon}.zip --output saxon.zip \
|
|
||||||
&& unzip saxon.zip -d saxon \
|
|
||||||
&& cp saxon/libsaxon-HEC-linux-amd64-v${saxon}/libs/nix/libsaxon-hec-${saxon}.so /usr/lib/ \
|
|
||||||
&& cd /opt/saxon/libsaxon-HEC-linux-amd64-v${saxon}/Saxon.C.API \
|
|
||||||
&& phpize \
|
|
||||||
&& ./configure --enable-saxon \
|
|
||||||
&& make \
|
|
||||||
&& make install \
|
|
||||||
&& echo 'extension=saxon.so' > "/usr/local/etc/php/conf.d/app.ini"; \
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Copy scripts
|
|
||||||
COPY rootfs /
|
|
||||||
|
|
||||||
# Set working directory
|
|
||||||
WORKDIR /var/www/html
|
|
||||||
|
|
||||||
# Download and extract application
|
|
||||||
RUN set -eux; \
|
|
||||||
DOWNLOAD_URL=$(curl -s "https://api.github.com/repos/invoiceninja/invoiceninja/releases/latest" | \
|
|
||||||
grep -o '"browser_download_url": "[^"]*invoiceninja.tar"' | cut -d '"' -f 4) && \
|
|
||||||
curl -L "$DOWNLOAD_URL" | tar -xvz -C /var/www/html && \
|
|
||||||
chown -R www-data:www-data /var/www/html
|
|
||||||
|
|
||||||
# Install dependencies
|
|
||||||
RUN composer install --no-dev --no-scripts --no-autoloader
|
|
||||||
|
|
||||||
# Generate optimized autoloader and clear cache
|
|
||||||
RUN composer dump-autoload --optimize \
|
|
||||||
&& php artisan optimize \
|
|
||||||
&& php artisan view:cache \
|
|
||||||
&& php artisan config:cache \
|
|
||||||
&& php artisan route:cache \
|
|
||||||
&& php artisan storage:link
|
|
||||||
|
|
||||||
# Setup supervisor
|
# Setup supervisor
|
||||||
COPY supervisor/supervisord.conf /etc/supervisor/conf.d/supervisord.conf
|
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
|
# Add initialization script
|
||||||
COPY scripts/init.sh /usr/local/bin/init.sh
|
COPY --chmod=0755 scripts/init.sh /usr/local/bin/init.sh
|
||||||
|
|
||||||
# Make executable
|
|
||||||
RUN chmod +x /usr/local/bin/init.sh
|
|
||||||
|
|
||||||
# Configure PHP-FPM
|
|
||||||
RUN sed -i "s/user = www-data/user = www-data/g" /usr/local/etc/php-fpm.d/www.conf \
|
|
||||||
&& sed -i "s/group = www-data/group = www-data/g" /usr/local/etc/php-fpm.d/www.conf
|
|
||||||
|
|
||||||
# Create volume directories
|
|
||||||
RUN mkdir -p \
|
|
||||||
/var/www/html/storage/app/public \
|
|
||||||
/var/www/html/storage/framework/cache \
|
|
||||||
/var/www/html/storage/framework/sessions \
|
|
||||||
/var/www/html/storage/framework/views \
|
|
||||||
/var/www/html/storage/logs \
|
|
||||||
/var/www/html/public/uploads \
|
|
||||||
/var/run \
|
|
||||||
/var/log/supervisor
|
|
||||||
|
|
||||||
# Set permissions
|
|
||||||
RUN chown -R www-data:www-data \
|
|
||||||
/var/www/html/storage \
|
|
||||||
/var/www/html/bootstrap/cache \
|
|
||||||
/var/www/html/public/uploads \
|
|
||||||
/var/run \
|
|
||||||
/var/log/supervisor \
|
|
||||||
&& chmod -R 775 \
|
|
||||||
/var/www/html/public/uploads \
|
|
||||||
/var/www/html/storage \
|
|
||||||
/var/www/html/bootstrap/cache \
|
|
||||||
/var/run \
|
|
||||||
/var/log/supervisor
|
|
||||||
|
|
||||||
# Health check
|
# Health check
|
||||||
HEALTHCHECK --interval=30s --timeout=5s --start-period=30s --retries=3 \
|
HEALTHCHECK --interval=30s --timeout=5s --start-period=30s --retries=3 \
|
||||||
CMD php -v || exit 1
|
CMD pgrep -f "php-fpm: master process"
|
||||||
|
|
||||||
EXPOSE 9000
|
|
||||||
|
|
||||||
ENTRYPOINT ["/usr/local/bin/init.sh"]
|
ENTRYPOINT ["/usr/local/bin/init.sh"]
|
||||||
CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/conf.d/supervisord.conf"]
|
CMD ["supervisord", "-c", "/etc/supervisor/conf.d/supervisord.conf"]
|
||||||
|
|||||||
56
debian/docker-compose.yml
vendored
56
debian/docker-compose.yml
vendored
@@ -1,5 +1,3 @@
|
|||||||
version: '3.8'
|
|
||||||
|
|
||||||
x-logging: &default-logging
|
x-logging: &default-logging
|
||||||
options:
|
options:
|
||||||
max-size: "10m"
|
max-size: "10m"
|
||||||
@@ -8,16 +6,20 @@ x-logging: &default-logging
|
|||||||
|
|
||||||
services:
|
services:
|
||||||
app:
|
app:
|
||||||
image: invoiceninja/invoiceninja-debian:latest
|
build:
|
||||||
|
context: .
|
||||||
|
image: invoiceninja/invoiceninja-debian:${TAG:-latest}
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
env_file:
|
env_file:
|
||||||
- ./.env
|
- ./.env
|
||||||
volumes:
|
volumes:
|
||||||
- ./.env:/var/www/html/.env
|
- ./.env:/var/www/html/.env
|
||||||
- app_storage:/var/www/html/storage
|
# - ./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_cache:/var/www/html/bootstrap/cache
|
- app_cache:/var/www/html/bootstrap/cache
|
||||||
- public_storage:/var/www/html/public/storage
|
- app_public:/var/www/html/public
|
||||||
|
- app_storage:/var/www/html/storage
|
||||||
networks:
|
networks:
|
||||||
- app-network
|
- app-network
|
||||||
depends_on:
|
depends_on:
|
||||||
@@ -25,10 +27,6 @@ services:
|
|||||||
condition: service_healthy
|
condition: service_healthy
|
||||||
redis:
|
redis:
|
||||||
condition: service_healthy
|
condition: service_healthy
|
||||||
deploy:
|
|
||||||
resources:
|
|
||||||
limits:
|
|
||||||
memory: 512M
|
|
||||||
logging: *default-logging
|
logging: *default-logging
|
||||||
|
|
||||||
nginx:
|
nginx:
|
||||||
@@ -37,23 +35,17 @@ services:
|
|||||||
ports:
|
ports:
|
||||||
- "80:80"
|
- "80:80"
|
||||||
volumes:
|
volumes:
|
||||||
- ./nginx/conf.d:/etc/nginx/conf.d:ro
|
- ./nginx:/etc/nginx/conf.d:ro
|
||||||
- ./nginx/nginx.conf:/etc/nginx/nginx.conf:ro
|
- app_public:/var/www/html/public:ro
|
||||||
volumes_from:
|
- app_storage:/var/www/html/storage:ro
|
||||||
- app
|
|
||||||
|
|
||||||
networks:
|
networks:
|
||||||
- app-network
|
- app-network
|
||||||
depends_on:
|
depends_on:
|
||||||
- app
|
- app
|
||||||
deploy:
|
|
||||||
resources:
|
|
||||||
limits:
|
|
||||||
memory: 128M
|
|
||||||
logging: *default-logging
|
logging: *default-logging
|
||||||
|
|
||||||
mysql:
|
mysql:
|
||||||
image: mysql:8.0
|
image: mysql:8
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
env_file:
|
env_file:
|
||||||
- ./.env
|
- ./.env
|
||||||
@@ -67,14 +59,10 @@ services:
|
|||||||
networks:
|
networks:
|
||||||
- app-network
|
- 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
|
||||||
timeout: 5s
|
timeout: 5s
|
||||||
retries: 5
|
retries: 5
|
||||||
deploy:
|
|
||||||
resources:
|
|
||||||
limits:
|
|
||||||
memory: 1G
|
|
||||||
logging: *default-logging
|
logging: *default-logging
|
||||||
|
|
||||||
redis:
|
redis:
|
||||||
@@ -85,14 +73,10 @@ services:
|
|||||||
networks:
|
networks:
|
||||||
- app-network
|
- app-network
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test: ["CMD", "redis-cli", "ping"]
|
test: [ "CMD", "redis-cli", "ping" ]
|
||||||
interval: 10s
|
interval: 10s
|
||||||
timeout: 5s
|
timeout: 5s
|
||||||
retries: 5
|
retries: 5
|
||||||
deploy:
|
|
||||||
resources:
|
|
||||||
limits:
|
|
||||||
memory: 256M
|
|
||||||
logging: *default-logging
|
logging: *default-logging
|
||||||
|
|
||||||
networks:
|
networks:
|
||||||
@@ -100,13 +84,13 @@ networks:
|
|||||||
driver: bridge
|
driver: bridge
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
app_storage:
|
|
||||||
driver: local
|
|
||||||
app_cache:
|
app_cache:
|
||||||
driver: local
|
driver: local
|
||||||
public_storage:
|
app_public:
|
||||||
driver: local # Persistent storage for user files
|
driver: local
|
||||||
|
app_storage:
|
||||||
|
driver: local
|
||||||
mysql_data:
|
mysql_data:
|
||||||
driver: local
|
driver: local
|
||||||
redis_data:
|
redis_data:
|
||||||
driver: local
|
driver: local
|
||||||
|
|||||||
38
debian/nginx/conf.d/default.conf
vendored
38
debian/nginx/conf.d/default.conf
vendored
@@ -1,38 +0,0 @@
|
|||||||
server {
|
|
||||||
|
|
||||||
error_log /var/log/nginx/error.log debug;
|
|
||||||
access_log /var/log/nginx/access.log;
|
|
||||||
|
|
||||||
listen 80 default_server;
|
|
||||||
server_name _;
|
|
||||||
|
|
||||||
server_tokens off;
|
|
||||||
|
|
||||||
client_max_body_size 100M;
|
|
||||||
|
|
||||||
root /var/www/html/public;
|
|
||||||
index index.php;
|
|
||||||
|
|
||||||
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; }
|
|
||||||
|
|
||||||
|
|
||||||
location ~* /storage/.*\.php$ {
|
|
||||||
return 503;
|
|
||||||
}
|
|
||||||
|
|
||||||
location ~ \.php$ {
|
|
||||||
fastcgi_split_path_info ^(.+\.php)(/.+)$;
|
|
||||||
fastcgi_pass app:9000;
|
|
||||||
fastcgi_index index.php;
|
|
||||||
include fastcgi_params;
|
|
||||||
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
|
||||||
fastcgi_intercept_errors off;
|
|
||||||
fastcgi_buffer_size 16k;
|
|
||||||
fastcgi_buffers 4 16k;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
26
debian/nginx/nginx.conf
vendored
26
debian/nginx/nginx.conf
vendored
@@ -1,26 +0,0 @@
|
|||||||
user nginx;
|
|
||||||
worker_processes auto;
|
|
||||||
error_log /var/log/nginx/error.log notice;
|
|
||||||
pid /var/run/nginx.pid;
|
|
||||||
|
|
||||||
events {
|
|
||||||
worker_connections 1024;
|
|
||||||
}
|
|
||||||
|
|
||||||
http {
|
|
||||||
include /etc/nginx/mime.types;
|
|
||||||
default_type application/octet-stream;
|
|
||||||
|
|
||||||
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
|
|
||||||
'$status $body_bytes_sent "$http_referer" '
|
|
||||||
'"$http_user_agent" "$http_x_forwarded_for"';
|
|
||||||
|
|
||||||
access_log /var/log/nginx/access.log main;
|
|
||||||
error_log /var/log/nginx/error.log;
|
|
||||||
|
|
||||||
sendfile on;
|
|
||||||
keepalive_timeout 65;
|
|
||||||
gzip on;
|
|
||||||
|
|
||||||
include /etc/nginx/conf.d/*.conf;
|
|
||||||
}
|
|
||||||
8
debian/php/php-fpm.conf
vendored
8
debian/php/php-fpm.conf
vendored
@@ -1,9 +1 @@
|
|||||||
[www]
|
|
||||||
user = www-data
|
|
||||||
group = www-data
|
|
||||||
listen = 0.0.0.0:9000
|
|
||||||
pm = dynamic
|
|
||||||
pm.max_children = 10
|
pm.max_children = 10
|
||||||
pm.start_servers = 2
|
|
||||||
pm.min_spare_servers = 1
|
|
||||||
pm.max_spare_servers = 3
|
|
||||||
36
debian/php/php.ini
vendored
36
debian/php/php.ini
vendored
@@ -1,21 +1,23 @@
|
|||||||
session.auto_start = Off
|
[core]
|
||||||
short_open_tag = Off
|
; https://www.php.net/manual/en/ini.core.php
|
||||||
|
post_max_size=10M
|
||||||
|
upload_max_filesize=10M
|
||||||
|
|
||||||
error_reporting = E_ALL & ~E_NOTICE & ~E_WARNING & ~E_STRICT & ~E_DEPRECATED
|
[opcache]
|
||||||
|
; https://www.php.net/manual/en/opcache.installation.php#opcache.installation.recommended
|
||||||
|
opcache.enable_cli=1
|
||||||
|
|
||||||
opcache.enable=1
|
[jit]
|
||||||
|
; 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=/var/www/html/preload.php
|
||||||
opcache.preload_user=www-data
|
opcache.preload_user=www-data
|
||||||
|
opcache.validate_timestamps=0
|
||||||
; ; The OPcache shared memory storage size.
|
realpath_cache_size = 4096K
|
||||||
opcache.max_accelerated_files=300000
|
realpath_cache_ttl = 600
|
||||||
opcache.validate_timestamps=1
|
|
||||||
opcache.revalidate_freq=30
|
|
||||||
opcache.jit_buffer_size=256M
|
|
||||||
opcache.jit=1205
|
|
||||||
opcache.memory_consumption=1024M
|
|
||||||
|
|
||||||
|
|
||||||
post_max_size = 60M
|
|
||||||
upload_max_filesize = 50M
|
|
||||||
memory_limit=512M
|
|
||||||
|
|||||||
@@ -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
|
|
||||||
109
debian/scripts/init.sh
vendored
109
debian/scripts/init.sh
vendored
@@ -1,75 +1,54 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh -eu
|
||||||
set -e
|
|
||||||
|
|
||||||
|
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/
|
||||||
|
fi
|
||||||
|
echo "Public Folder is up to date"
|
||||||
|
|
||||||
in_log() {
|
# Ensure owner, file and directory permissions are correct
|
||||||
local type="$1"; shift
|
chown -R www-data:www-data \
|
||||||
printf '%s [%s] [Entrypoint]: %s\n' "$(date -u '+%Y-%m-%dT%H:%M:%SZ')" "$type" "$*"
|
/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 {} \;
|
||||||
|
|
||||||
docker_process_init_files() {
|
# Clear and cache config in production
|
||||||
echo
|
if [ "$APP_ENV" = "production" ]; then
|
||||||
local f
|
runuser -u www-data -- php artisan optimize
|
||||||
for f; do
|
runuser -u www-data -- php artisan package:discover
|
||||||
case "$f" in
|
runuser -u www-data -- php artisan migrate --force
|
||||||
*.sh)
|
|
||||||
# https://github.com/docker-library/postgres/issues/450#issuecomment-393167936
|
# If first IN run, it needs to be initialized
|
||||||
# https://github.com/docker-library/postgres/pull/452
|
if [ "$(php -d opcache.preload='' artisan tinker --execute='echo Schema::hasTable("accounts") && !App\Models\Account::all()->first();')" = "1" ]; then
|
||||||
if [ -x "$f" ]; then
|
echo "Running initialization..."
|
||||||
in_log INFO "$0: running $f"
|
|
||||||
"$f"
|
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
|
else
|
||||||
in_log INFO "$0: sourcing $f"
|
echo "Initialization failed - Set IN_USER_EMAIL and IN_PASSWORD in .env"
|
||||||
. "$f"
|
exit 1
|
||||||
fi
|
fi
|
||||||
;;
|
fi
|
||||||
*) in_log INFO "$0: ignoring $f" ;;
|
|
||||||
esac
|
|
||||||
echo
|
|
||||||
done
|
|
||||||
}
|
|
||||||
|
|
||||||
# Create directories if they don't exist
|
echo "Production setup completed"
|
||||||
mkdir -p \
|
|
||||||
/var/www/html/storage/app/public \
|
|
||||||
/var/www/html/storage/framework/cache \
|
|
||||||
/var/www/html/storage/framework/sessions \
|
|
||||||
/var/www/html/storage/framework/views \
|
|
||||||
/var/www/html/storage/logs \
|
|
||||||
/var/www/html/public/storage
|
|
||||||
|
|
||||||
# Set directory permissions without changing ownership
|
|
||||||
chmod -R 775 \
|
|
||||||
/var/www/html/storage \
|
|
||||||
/var/www/html/bootstrap/cache \
|
|
||||||
/var/www/html/public/storage
|
|
||||||
|
|
||||||
chown -R www-data:www-data /var/www/html/storage
|
|
||||||
|
|
||||||
# Clear and cache config in production
|
|
||||||
if [ "$APP_ENV" = "production" ]; then
|
|
||||||
gosu www-data php artisan config:cache
|
|
||||||
gosu www-data php artisan optimize
|
|
||||||
gosu www-data php artisan package:discover
|
|
||||||
gosu www-data php artisan migrate --force
|
|
||||||
|
|
||||||
echo "Checking initialization status..."
|
|
||||||
|
|
||||||
# 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 [ "$IN_INIT" = "1" ]; then
|
|
||||||
echo "Running initialization scripts..."
|
|
||||||
docker_process_init_files /docker-entrypoint-init.d/*
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Production setup completed"
|
echo "Starting supervisord..."
|
||||||
echo "IN_INIT value: $IN_INIT"
|
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Starting supervisord..."
|
exec "$@"
|
||||||
# Start supervisord in the foreground
|
|
||||||
exec /usr/bin/supervisord -n -c /etc/supervisor/conf.d/supervisord.conf
|
|
||||||
|
|||||||
32
debian/supervisor/supervisord.conf
vendored
32
debian/supervisor/supervisord.conf
vendored
@@ -1,52 +1,42 @@
|
|||||||
[unix_http_server]
|
|
||||||
file=/var/run/supervisor.sock
|
|
||||||
chmod=0700
|
|
||||||
|
|
||||||
[supervisord]
|
[supervisord]
|
||||||
nodaemon=true
|
nodaemon=true
|
||||||
user=root
|
user=root
|
||||||
logfile=/var/log/supervisor/supervisord.log
|
logfile=/dev/null
|
||||||
|
logfile_maxbytes=0
|
||||||
pidfile=/var/run/supervisord.pid
|
pidfile=/var/run/supervisord.pid
|
||||||
|
|
||||||
[rpcinterface:supervisor]
|
[rpcinterface:supervisor]
|
||||||
supervisor.rpcinterface_factory=supervisor.rpcinterface:make_main_rpcinterface
|
supervisor.rpcinterface_factory=supervisor.rpcinterface:make_main_rpcinterface
|
||||||
|
|
||||||
[supervisorctl]
|
|
||||||
serverurl=unix:///var/run/supervisor.sock
|
|
||||||
|
|
||||||
[program:php-fpm]
|
[program:php-fpm]
|
||||||
command=/usr/local/sbin/php-fpm -F
|
command=/usr/local/sbin/php-fpm -F
|
||||||
autostart=true
|
autostart=true
|
||||||
autorestart=true
|
autorestart=true
|
||||||
priority=5
|
priority=5
|
||||||
stdout_logfile=/dev/stdout
|
stdout_logfile=/dev/fd/1
|
||||||
stdout_logfile_maxbytes=0
|
stdout_logfile_maxbytes=0
|
||||||
stderr_logfile=/dev/stderr
|
redirect_stderr=true
|
||||||
stderr_logfile_maxbytes=0
|
|
||||||
|
|
||||||
[program:queue-worker]
|
[program:queue-worker]
|
||||||
process_name=%(program_name)s_%(process_num)02d
|
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
|
autostart=true
|
||||||
autorestart=true
|
autorestart=true
|
||||||
stopasgroup=true
|
stopasgroup=true
|
||||||
killasgroup=true
|
killasgroup=true
|
||||||
user=www-data
|
user=www-data
|
||||||
numprocs=2
|
numprocs=2
|
||||||
redirect_stderr=true
|
environment=HOME="/var/www"
|
||||||
stdout_logfile=/dev/stdout
|
stdout_logfile=/dev/fd/1
|
||||||
stdout_logfile_maxbytes=0
|
stdout_logfile_maxbytes=0
|
||||||
stderr_logfile=/dev/stderr
|
redirect_stderr=true
|
||||||
stderr_logfile_maxbytes=0
|
|
||||||
stopwaitsecs=3600
|
stopwaitsecs=3600
|
||||||
|
|
||||||
[program:scheduler]
|
[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
|
autostart=true
|
||||||
autorestart=true
|
autorestart=true
|
||||||
user=www-data
|
user=www-data
|
||||||
redirect_stderr=true
|
stdout_logfile=/dev/fd/1
|
||||||
stdout_logfile=/dev/stdout
|
|
||||||
stdout_logfile_maxbytes=0
|
stdout_logfile_maxbytes=0
|
||||||
stderr_logfile=/dev/stderr
|
redirect_stderr=true
|
||||||
stderr_logfile_maxbytes=0
|
|
||||||
|
|||||||
Reference in New Issue
Block a user