mirror of
https://github.com/invoiceninja/dockerfiles.git
synced 2026-01-06 22:47:26 +01:00
Compare commits
132 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
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 | ||
|
|
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
|
||||||
16
.github/workflows/build-image-debian.yaml
vendored
16
.github/workflows/build-image-debian.yaml
vendored
@@ -12,15 +12,14 @@ on:
|
|||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
docker:
|
docker:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ${{ startsWith(matrix.platforms, 'linux/arm') && 'ubuntu-24.04-arm' || 'ubuntu-latest' }}
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
platform: ["linux/amd64", "linux/arm64"]
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v5
|
||||||
|
|
||||||
- name: Set up QEMU
|
|
||||||
uses: docker/setup-qemu-action@v3
|
|
||||||
with:
|
|
||||||
platforms: all
|
|
||||||
|
|
||||||
- name: Set up Docker Buildx
|
- name: Set up Docker Buildx
|
||||||
id: buildx
|
id: buildx
|
||||||
@@ -28,10 +27,9 @@ jobs:
|
|||||||
|
|
||||||
- name: Build
|
- name: Build
|
||||||
id: docker_build
|
id: docker_build
|
||||||
uses: docker/build-push-action@v5
|
uses: docker/build-push-action@v6
|
||||||
with:
|
with:
|
||||||
context: debian
|
context: debian
|
||||||
file: debian/Dockerfile
|
|
||||||
load: true
|
load: true
|
||||||
tags: invoiceninja/invoiceninja-debian:test
|
tags: invoiceninja/invoiceninja-debian:test
|
||||||
cache-from: type=gha
|
cache-from: type=gha
|
||||||
|
|||||||
24
.github/workflows/publish-image.yaml
vendored
24
.github/workflows/publish-image.yaml
vendored
@@ -7,16 +7,18 @@ on:
|
|||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
docker:
|
docker:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ${{ startsWith(matrix.platforms, 'linux/arm') && 'ubuntu-24.04-arm' || 'ubuntu-latest' }}
|
||||||
strategy:
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
|
platform: ["linux/amd64", "linux/arm64"]
|
||||||
include:
|
include:
|
||||||
- image: invoiceninja/invoiceninja-debian
|
- image: invoiceninja/invoiceninja-debian
|
||||||
context: ./debian
|
context: debian
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4 # Updated from v2
|
uses: actions/checkout@v5
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|
||||||
@@ -43,33 +45,27 @@ jobs:
|
|||||||
echo "version=${VERSION}" >> $GITHUB_OUTPUT
|
echo "version=${VERSION}" >> $GITHUB_OUTPUT
|
||||||
echo "major=${MAJOR}" >> $GITHUB_OUTPUT
|
echo "major=${MAJOR}" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
- name: Set up QEMU
|
|
||||||
uses: docker/setup-qemu-action@v3 # Updated from v1
|
|
||||||
with:
|
|
||||||
platforms: all
|
|
||||||
|
|
||||||
- name: Set up Docker Buildx
|
- name: Set up Docker Buildx
|
||||||
id: buildx
|
id: buildx
|
||||||
uses: docker/setup-buildx-action@v3 # Updated from v1
|
uses: docker/setup-buildx-action@v3
|
||||||
|
|
||||||
- name: Login to DockerHub
|
- name: Login to DockerHub
|
||||||
if: github.event_name != 'pull_request'
|
if: github.event_name != 'pull_request'
|
||||||
uses: docker/login-action@v3 # Updated from v1
|
uses: docker/login-action@v3
|
||||||
with:
|
with:
|
||||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||||
password: ${{ secrets.DOCKERHUB_PASSWORD }}
|
password: ${{ secrets.DOCKERHUB_PASSWORD }}
|
||||||
|
|
||||||
- name: Build and push
|
- name: Build and push
|
||||||
id: docker_build
|
id: docker_build
|
||||||
uses: docker/build-push-action@v5 # Updated from v2
|
uses: docker/build-push-action@v6
|
||||||
with:
|
with:
|
||||||
context: ${{ matrix.context }}
|
context: ${{ matrix.context }}
|
||||||
build-args: INVOICENINJA_VERSION=${{ steps.prep.outputs.version }}
|
build-args: INVOICENINJA_VERSION=${{ steps.prep.outputs.version }}
|
||||||
platforms: linux/amd64,linux/arm64
|
|
||||||
push: ${{ github.event_name != 'pull_request' }}
|
push: ${{ github.event_name != 'pull_request' }}
|
||||||
tags: ${{ steps.prep.outputs.tags }}
|
tags: ${{ steps.prep.outputs.tags }}
|
||||||
cache-from: type=gha # Updated cache type
|
cache-from: type=gha
|
||||||
cache-to: type=gha,mode=max
|
cache-to: type=gha,mode=max
|
||||||
|
|
||||||
- name: Image digest
|
- name: Image digest
|
||||||
run: echo ${{ steps.docker_build.outputs.digest }}
|
run: echo ${{ steps.docker_build.outputs.digest }}
|
||||||
|
|||||||
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
README.md
11
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,8 @@ 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 pull
|
||||||
docker-compose pull
|
docker compose up -d
|
||||||
docker-compose up
|
|
||||||
```
|
```
|
||||||
|
|
||||||
It is recommended to perform a backup before updating.
|
It is recommended to perform a backup before updating.
|
||||||
@@ -92,4 +91,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
|
||||||
|
|||||||
13
debian/.env
vendored
13
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
|
||||||
@@ -51,5 +57,6 @@ 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
|
|
||||||
|
|
||||||
|
|||||||
212
debian/Dockerfile
vendored
212
debian/Dockerfile
vendored
@@ -1,179 +1,89 @@
|
|||||||
FROM php:8.2-fpm AS base
|
ARG PHP=8.4
|
||||||
ARG saxon=12.5.0
|
|
||||||
|
FROM php:${PHP}-fpm AS prepare-app
|
||||||
|
|
||||||
|
USER www-data
|
||||||
|
|
||||||
|
RUN curl -sL "https://github.com/invoiceninja/invoiceninja/releases/latest/download/invoiceninja.tar.gz" | \
|
||||||
|
tar -xz -C /var/www/html \
|
||||||
|
&& ln -s /var/www/html/resources/views/react/index.blade.php /var/www/html/public/index.html \
|
||||||
|
&& php artisan storage:link \
|
||||||
|
# Workaround for application updates
|
||||||
|
&& mv /var/www/html/public /tmp/public
|
||||||
|
|
||||||
|
# ==================
|
||||||
|
# InvoiceNinja image
|
||||||
|
# ==================
|
||||||
|
FROM php:${PHP}-fpm
|
||||||
|
|
||||||
|
# PHP modules
|
||||||
|
ARG php_require="bcmath gd mbstring pdo_mysql zip"
|
||||||
|
ARG php_suggest="exif imagick intl pcntl saxon soap"
|
||||||
|
ARG php_extra="opcache"
|
||||||
|
|
||||||
# Install system dependencies
|
# Install system dependencies
|
||||||
RUN apt-get update && apt-get install -y \
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||||
git \
|
libfcgi-bin \
|
||||||
curl \
|
mariadb-client \
|
||||||
libpng-dev \
|
gpg \
|
||||||
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
|
# Workaround: Disable SSL for mariadb-client for compatibility with MySQL
|
||||||
COPY rootfs /
|
RUN echo "skip-ssl = true" >> /etc/mysql/mariadb.conf.d/50-client.cnf
|
||||||
|
|
||||||
# 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 --start-period=100s \
|
||||||
CMD php -v || exit 1
|
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"}'
|
||||||
|
|
||||||
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/supervisord.conf"]
|
||||||
|
|||||||
58
debian/docker-compose.yml
vendored
58
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,19 @@ 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
|
||||||
|
# - ./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
|
- app_storage:/var/www/html/storage
|
||||||
- app_cache:/var/www/html/bootstrap/cache
|
|
||||||
- public_storage:/var/www/html/public/storage
|
|
||||||
|
|
||||||
networks:
|
networks:
|
||||||
- app-network
|
- app-network
|
||||||
depends_on:
|
depends_on:
|
||||||
@@ -25,10 +26,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 +34,18 @@ 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:
|
condition: service_healthy
|
||||||
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,11 @@ networks:
|
|||||||
driver: bridge
|
driver: bridge
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
|
app_public:
|
||||||
|
driver: local
|
||||||
app_storage:
|
app_storage:
|
||||||
driver: local
|
driver: local
|
||||||
app_cache:
|
|
||||||
driver: local
|
|
||||||
public_storage:
|
|
||||||
driver: local # Persistent storage for user files
|
|
||||||
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
|
|
||||||
138
debian/scripts/init.sh
vendored
138
debian/scripts/init.sh
vendored
@@ -1,75 +1,69 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh -eu
|
||||||
set -e
|
|
||||||
|
|
||||||
|
|
||||||
in_log() {
|
|
||||||
local type="$1"; shift
|
|
||||||
printf '%s [%s] [Entrypoint]: %s\n' "$(date -u '+%Y-%m-%dT%H:%M:%SZ')" "$type" "$*"
|
|
||||||
}
|
|
||||||
|
|
||||||
docker_process_init_files() {
|
|
||||||
echo
|
|
||||||
local f
|
|
||||||
for f; do
|
|
||||||
case "$f" in
|
|
||||||
*.sh)
|
|
||||||
# https://github.com/docker-library/postgres/issues/450#issuecomment-393167936
|
|
||||||
# https://github.com/docker-library/postgres/pull/452
|
|
||||||
if [ -x "$f" ]; then
|
|
||||||
in_log INFO "$0: running $f"
|
|
||||||
"$f"
|
|
||||||
else
|
|
||||||
in_log INFO "$0: sourcing $f"
|
|
||||||
. "$f"
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
*) in_log INFO "$0: ignoring $f" ;;
|
|
||||||
esac
|
|
||||||
echo
|
|
||||||
done
|
|
||||||
}
|
|
||||||
|
|
||||||
# Create directories if they don't exist
|
|
||||||
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
|
|
||||||
|
|
||||||
echo "Production setup completed"
|
|
||||||
echo "IN_INIT value: $IN_INIT"
|
|
||||||
|
|
||||||
|
# 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
|
fi
|
||||||
|
|
||||||
echo "Starting supervisord..."
|
if [ "$*" = 'supervisord -c /etc/supervisor/supervisord.conf' ]; then
|
||||||
# Start supervisord in the foreground
|
|
||||||
exec /usr/bin/supervisord -n -c /etc/supervisor/conf.d/supervisord.conf
|
# Check for required folders and create if needed
|
||||||
|
[ -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/*
|
||||||
|
mv /tmp/public/* \
|
||||||
|
/tmp/public/.htaccess \
|
||||||
|
/tmp/public/.well-known \
|
||||||
|
/var/www/html/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 "$@"
|
||||||
|
|||||||
35
debian/supervisor/supervisord.conf
vendored
35
debian/supervisor/supervisord.conf
vendored
@@ -1,52 +1,39 @@
|
|||||||
[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]
|
|
||||||
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
|
|
||||||
|
|||||||
@@ -1 +0,0 @@
|
|||||||
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
|
|
||||||
Reference in New Issue
Block a user