summarylogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--PKGBUILD185
-rw-r--r--immich-machine-learning.service21
-rw-r--r--immich-microservices.service12
-rw-r--r--immich-server.service9
-rw-r--r--immich-web.service5
-rw-r--r--immich.conf96
-rw-r--r--immich.install27
-rw-r--r--immich.sysusers2
-rw-r--r--immich.tmpfiles8
-rw-r--r--media.util.ts.patch15
-rw-r--r--nginx.immich.conf155
11 files changed, 300 insertions, 235 deletions
diff --git a/PKGBUILD b/PKGBUILD
index 65598d7090bb..a380309d696b 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -1,71 +1,162 @@
pkgname=immich
-pkgrel=0
-pkgver=1.75.2
+pkgrel=7
+pkgver=1.87.0
pkgdesc='Self-hosted photos and videos backup tool'
url='https://github.com/immich-app/immich'
license=('MIT')
arch=(x86_64)
-makedepends=('npm' 'nodejs-lts-hydrogen')
-depends=('redis' 'postgresql' 'nodejs')
-source=("https://github.com/immich-app/immich/archive/refs/tags/v${pkgver}.tar.gz"
+makedepends=('npm' 'jq' 'python-poetry')
+# dependencies generated from base-images repository
+# https://github.com/immich-app/base-images/blob/main/server/Dockerfile
+depends=('redis' 'postgresql' 'nodejs' 'nginx'
+ 'typesense'
+ 'zlib'
+ 'glib2'
+ 'expat'
+ 'librsvg'
+ 'libexif'
+ 'libwebp'
+ 'orc'
+ 'libjpeg-turbo'
+ 'libgsf'
+ 'libpng'
+ 'libjxl'
+ 'libheif'
+ 'lcms2'
+ 'mimalloc'
+ 'openjpeg2'
+ 'openexr'
+ 'liblqr'
+ 'libtool'
+ 'ffmpeg'
+ # need to ensure this matches sharp depend version
+ # because otherwise a local copy will be built
+ # breaking heif conversion
+ 'libvips>=8.14.3'
+ 'imagemagick'
+ 'libraw'
+)
+optdepends=(
+ 'libva-mesa-driver: GPU acceleration'
+)
+source=("${pkgname}-${pkgver}.tar.gz::https://github.com/immich-app/immich/archive/refs/tags/v${pkgver}.tar.gz"
"${pkgname}-server.service"
"${pkgname}-microservices.service"
"${pkgname}-web.service"
+ "${pkgname}-machine-learning.service"
"${pkgname}.sysusers"
- "immich.conf"
- "nginx.immich.conf"
- "immich.tmpfiles"
+ "${pkgname}.tmpfiles"
+ 'immich.conf'
+ 'nginx.immich.conf'
+ 'media.util.ts.patch'
)
-sha256sums=('fd6edefed28031601cce3eb012aea8e478313073a24f70dabb3e118c2210fa35'
- 'e1989ebeb442e2415931467f50c0923325e5bac7944dc91a1e34a8c214424fbd'
- '91d9bbe2bb28f568586ae8b9aa51ebd2e2be36cbefa45b59d4eee368c3552987'
- '64fd6dcbe66ffb47805221a4122da3defe421bcb636a4ce0fdaa64bd2c7e8bc0'
- 'c7db0e5e2eb50bd48892a7e669a2ced65988af43fb82ad67d8e2cc607a6aeb47'
- '1910a5317f6ef3a5720b2e96c7f2d32220a8e674ba5864751591afc425a8ef0b'
- 'a56e17b6bcde900a4abc6e0b04fa9363979d3e2cda21f27421b3727a7e9320e9'
- '198dad8ae127ddc586a1b56d3b6136fc0a5f521d8026e2437e493833aad4aad0')
+sha256sums=('f9196aa5567415d2b71cd50ce9ec8830adc8a2dfac65acea9287fcf470cb91c5'
+ '46a7ace4f315e0a69a0da49a9a54d442baa6573092572f1e4323d1373a0cabb5'
+ '08df269485ebea360dc1156409d148c959ba28040017cd02be2606c5d28be5b0'
+ '64da5f28147c40a2285ed2295d85951c932d155069295a692a25995e6e56028e'
+ 'd20455349cdb9409adb42cdbde48c30a176d2a5337ad148c6d2227ecc523c88a'
+ '01707746e8718fe169b729b7b3d9e26e870bf2dbc4d1f6cdc7ed7d3839e92c0e'
+ '23894fe92e02f8d69d045ece73d68ba5122549a39c60475780a5b03bebcab3aa'
+ '89819defe1108056f1bf876a6e0c1d6ecc10382a931fb832fccc132eaeaece1b'
+ '00827701798731c13fbd2d37f8ffb14816bfab579c0f75d532ab119295c4148c'
+ 'd38cdaa031f741998f2d31504381bce4db1a8771c774a2c2bac547d7d2b3c70b')
backup=("etc/immich.conf")
+options=("!strip")
+install=${pkgname}.install
+_installdir=/opt/immich-machine-learning
+_venvdir="${_installdir}/venv"
+
+prepare() {
+ cd "${srcdir}/${pkgname}-${pkgver}"
+ # required to prefer /dev/dri/renderD128 over /dev/dri/card0 for ffmpeg accel (VAAPI)
+ patch -p0 -i "${srcdir}/media.util.ts.patch"
+}
build() {
- #Build web frontend
- cd "${srcdir}/${pkgname}-${pkgver}/web"
- npm ci
- npm run build
- npm prune --omit=dev
+
+ # build web frontend
+ # from: web/Dockerfile RUN npm commands
+ cd "${srcdir}/${pkgname}-${pkgver}/web"
+ npm ci
+ npm run build
+ npm prune --omit=dev
- #Build Server
- cd "${srcdir}/${pkgname}-${pkgver}/server"
- npm ci
- npm run build
- npm prune --omit=dev --omit=optional
+ # build server
+ # from: server/Dockerfile RUN npm commands
+ # * npm link / and cache clean not required
+ cd "${srcdir}/${pkgname}-${pkgver}/server"
+ npm ci
+ npm run build
+ npm prune --omit=dev --omit=optional
+
+ # build machine learning (python)
+ # from: ENV and RUN commands in machine-learning/Dockerfile
+ # * later ENV commands picked up in systemd service files
+ cd "${srcdir}/${pkgname}-${pkgver}/machine-learning"
+ sed -i 's|cache_folder: str = ".*"|cache_folder: str = "/var/lib/immich/.cache"|' app/config.py
+ # pip install of poetry not required because poetry is a makedep
+ export PYTHONDONTWRITEBYTECODE=1
+ export PYTHONUNBUFFERED=1
+ export PIP_NO_CACHE_DIR=true
+ poetry config installer.max-workers 10
+ poetry config virtualenvs.create false
+ python -m venv "${srcdir}/venv"
+ export VIRTUAL_ENV="${srcdir}/venv"
+ export PATH="${srcdir}/venv/bin:${PATH}"
+ poetry install --sync --no-interaction --no-ansi --no-root --only main
+ # delete any python bytecode
+ find "${srcdir}/venv" -type f -name "*.py[co]" -delete
+ find "${srcdir}/venv" -type d -name "__pycache__" -delete
+ # relocate without breaking
+ sed -i "s|${srcdir}/venv|${_venvdir}|g" "${srcdir}/venv/bin/"* "${srcdir}/venv/pyvenv.cfg"
}
package() {
- #install server
- install -Dm755 "${srcdir}/${pkgname}-${pkgver}/server/package.json" "${pkgdir}/var/lib/immich/app/server/package.json"
- install -Dm755 "${srcdir}/${pkgname}-${pkgver}/server/package-lock.json" "${pkgdir}/var/lib/immich/app/server/package-lock.json"
- cp -r "${srcdir}/${pkgname}-${pkgver}/server/node_modules" "${pkgdir}/var/lib/immich/app/server/node_modules"
- cp -r "${srcdir}/${pkgname}-${pkgver}/server/dist" "${pkgdir}/var/lib/immich/app/server/dist"
- cp -r "${srcdir}/${pkgname}-${pkgver}/server/bin" "${pkgdir}/var/lib/immich/app/server/bin"
- mkdir "${pkgdir}/var/lib/immich/app/server/.reverse-geocoding-dump"
- #install web frontend
- cp -r "${srcdir}/${pkgname}-${pkgver}/web" "${pkgdir}/var/lib/immich/app/web"
+ cd "${srcdir}/${pkgname}-${pkgver}"
+
+ # install server
+ # from: server/Dockerfile COPY commands after build
+ # * start*.sh not required
+ # * setting NODE_ENV=production picked up in systemd service file
+ install -dm755 "${pkgdir}/usr/lib/immich/app/server"
+ cp -r server/node_modules "${pkgdir}/usr/lib/immich/app/server/node_modules"
+ cp -r server/dist "${pkgdir}/usr/lib/immich/app/server/dist"
+ cp -r server/bin "${pkgdir}/usr/lib/immich/app/server/bin"
+ install -Dm644 server/package.json "${pkgdir}/usr/lib/immich/app/server/package.json"
+ install -Dm644 server/package-lock.json "${pkgdir}/usr/lib/immich/app/server/package-lock.json"
+ install -Dm644 server/LICENSE "${pkgdir}/usr/lib/immich/app/server/LICENSE"
+ cp -r server/assets "${pkgdir}/usr/lib/immich/app/server/assets"
- #install systemd service files
- install -Dm644 "${srcdir}/immich-server.service" "${pkgdir}/usr/lib/systemd/system/immich-server.service"
- install -Dm644 "${srcdir}/immich-web.service" "${pkgdir}/usr/lib/systemd/system/immich-web.service"
- install -Dm644 "${srcdir}/immich-microservices.service" "${pkgdir}/usr/lib/systemd/system/immich-microservices.service"
+ # install web frontend
+ # from: web/Dockerfile COPY commands (entrypoint.sh not required)
+ # * setting NODE_ENV=production picked up in systemd service file
+ install -dm755 "${pkgdir}/usr/lib/immich/app/web"
+ cp -r web/node_modules "${pkgdir}/usr/lib/immich/app/web/node_modules"
+ cp -r web/build "${pkgdir}/usr/lib/immich/app/web/build"
+ install -Dm644 web/package.json "${pkgdir}/usr/lib/immich/app/web/package.json"
+ install -Dm644 web/package-lock.json "${pkgdir}/usr/lib/immich/app/web/package-lock.json"
- #install configuration files
- install -Dm644 "${srcdir}/immich.sysusers" "${pkgdir}/usr/lib/sysusers.d/immich.conf"
- install -Dm644 "${srcdir}/immich.conf" "${pkgdir}/etc/immich.conf"
- install -Dm644 "${srcdir}/nginx.immich.conf" "${pkgdir}/etc/nginx/sites-available/immich.conf"
+ # install machine-learning
+ # from: machine-learning/Dockerfile COPY commands
+ # * setting NODE_ENV=production and others picked up in systemd service file
+ install -dm755 "${pkgdir}${_installdir}"
+ cp -r "${srcdir}/venv" "${pkgdir}${_installdir}"
+ cp -r "machine-learning/app" "${pkgdir}${_installdir}"
+ install -Dm644 "machine-learning/log_conf.json" "${pkgdir}${_installdir}/log_conf.json"
+
+ cd "${srcdir}"
- #adjust access rights for user immich
- install -Dm644 "${srcdir}/immich.tmpfiles" "${pkgdir}/usr/lib/tmpfiles.d/immich.conf"
+ # install systemd service files
+ install -Dm644 immich-server.service "${pkgdir}/usr/lib/systemd/system/immich-server.service"
+ install -Dm644 immich-web.service "${pkgdir}/usr/lib/systemd/system/immich-web.service"
+ install -Dm644 immich-microservices.service "${pkgdir}/usr/lib/systemd/system/immich-microservices.service"
+ install -Dm644 immich-machine-learning.service "${pkgdir}/usr/lib/systemd/system/immich-machine-learning.service"
- #link directories
- ln -s /var/lib/immich/upload "${pkgdir}/var/lib/immich/app/server/upload"
+ # install configuration files
+ install -Dm644 immich.sysusers "${pkgdir}/usr/lib/sysusers.d/immich.conf"
+ install -Dm644 immich.tmpfiles "${pkgdir}/usr/lib/tmpfiles.d/immich.conf"
+ install -Dm644 immich.conf "${pkgdir}/etc/immich.conf"
+ install -Dm644 nginx.immich.conf "${pkgdir}/etc/nginx/sites-available/immich.conf"
}
diff --git a/immich-machine-learning.service b/immich-machine-learning.service
index 7b9fbc5d5e43..5754ddaedb80 100644
--- a/immich-machine-learning.service
+++ b/immich-machine-learning.service
@@ -1,7 +1,6 @@
[Unit]
-Description=immich machine learning
+Description=Immich machine learning
Documentation=https://github.com/immich-app/immich
-Requires=postgresql.service
After=network.target
Wants=network-online.target
After=network-online.target
@@ -13,9 +12,21 @@ Type=simple
Restart=on-failure
EnvironmentFile=/etc/immich.conf
+
+# environment variables
+# from: machine-learning/Dockerfile
Environment=NODE_ENV=production
+Environment=TRANSFORMERS_CACHE=/var/lib/immich/.cache
+Environment=VIRTUAL_ENV=/opt/immich-machine-learning/venv
+Environment=PYTHONDONTWRITEBYTECODE=1
+Environment=PYTHONUNBUFFERED=1
+
SyslogIdentifier=immich-machine-learning
-ExecStart=python main.py
+#ExecStart=/opt/immich-machine-learning/venv/bin/python -m app.main
+ExecStart=/opt/immich-machine-learning/venv/bin/gunicorn app.main:app \
+ -k uvicorn.workers.UvicornWorker \
+ -w 1 -b 0.0.0.0:3003 -t 120 \
+ --log-config-json log_conf.json
PrivateDevices=true
ProtectHome=true
@@ -31,8 +42,8 @@ AmbientCapabilities=
CapabilityBoundingSet=
NoNewPrivileges=yes
-WorkingDirectory=/var/lib/immich/app/machine-learning
-ReadWritePaths=/tmp /var/tmp /var/lib/immich/upload /var/lib/immich/.cache
+WorkingDirectory=/opt/immich-machine-learning
+ReadWritePaths=/tmp /var/tmp /var/lib/immich/.cache /var/lib/immich/.config
[Install]
WantedBy=multi-user.target
diff --git a/immich-microservices.service b/immich-microservices.service
index 3782336b744c..740d0b1406d5 100644
--- a/immich-microservices.service
+++ b/immich-microservices.service
@@ -1,8 +1,9 @@
[Unit]
-Description=immich microservices
+Description=Immich microservices
Documentation=https://github.com/immich-app/immich
-Requires=redis.service
+Requires=typesense-server.service
Requires=postgresql.service
+Requires=immich-server.service
After=network.target
Wants=network-online.target
After=network-online.target
@@ -18,7 +19,8 @@ Environment=NODE_ENV=production
SyslogIdentifier=immich-microservices
ExecStart=node dist/main microservices
-PrivateDevices=true
+#needed for vaapi acceleration
+#PrivateDevices=true
ProtectHome=true
ProtectSystem=strict
ProtectKernelTunables=yes
@@ -32,8 +34,8 @@ AmbientCapabilities=
CapabilityBoundingSet=
NoNewPrivileges=yes
-WorkingDirectory=/var/lib/immich/app/server
-ReadWritePaths=/tmp /var/tmp /var/lib/immich/upload /var/lib/immich/app/server/.reverse-geocoding-dump
+WorkingDirectory=/usr/lib/immich/app/server
+ReadWritePaths=/tmp /var/tmp /var/lib/immich/upload /var/lib/immich/.reverse-geocoding-dump
[Install]
WantedBy=multi-user.target
diff --git a/immich-server.service b/immich-server.service
index 977f0c8e5d7f..76a66331821a 100644
--- a/immich-server.service
+++ b/immich-server.service
@@ -1,12 +1,17 @@
[Unit]
-Description=immich server
+Description=Immich server
Documentation=https://github.com/immich-app/immich
Requires=redis.service
Requires=postgresql.service
+Requires=typesense-server.service
After=network.target
Wants=network-online.target
After=network-online.target
+# for convenience, all services start with immich-server
+BindsTo=immich-microservices.service immich-web.service immich-machine-learning.service
+After=immich-microservices.service immich-web.service immich-machine-learning.service
+
[Service]
User=immich
Group=immich
@@ -32,7 +37,7 @@ AmbientCapabilities=
CapabilityBoundingSet=
NoNewPrivileges=yes
-WorkingDirectory=/var/lib/immich/app/server
+WorkingDirectory=/usr/lib/immich/app/server
ReadWritePaths=/tmp /var/tmp /var/lib/immich/upload
[Install]
diff --git a/immich-web.service b/immich-web.service
index df0dd5c7ec97..5ce98b63c0da 100644
--- a/immich-web.service
+++ b/immich-web.service
@@ -1,6 +1,7 @@
[Unit]
-Description=immich web
+Description=Immich web
Documentation=https://github.com/immich-app/immich
+Requires=immich-server.service
After=network.target
Wants=network-online.target
After=network-online.target
@@ -30,7 +31,7 @@ AmbientCapabilities=
CapabilityBoundingSet=
NoNewPrivileges=yes
-WorkingDirectory=/var/lib/immich/app/web
+WorkingDirectory=/usr/lib/immich/app/web
ReadWritePaths=/tmp /var/tmp
[Install]
diff --git a/immich.conf b/immich.conf
index f4dc4b6b711d..5a765cdc1b93 100644
--- a/immich.conf
+++ b/immich.conf
@@ -1,99 +1,21 @@
-###################################################################################
-# Database
-###################################################################################
-
-DB_HOSTNAME='/run/postgresql'
DB_USERNAME=postgres
DB_PASSWORD=postgres
DB_DATABASE_NAME=immich
-# Optional Database settings:
-# DB_PORT=5432
-
-###################################################################################
-# Redis
-###################################################################################
-
-REDIS_HOSTNAME=immich_redis
-
-# Optional Redis settings:
-# REDIS_PORT=6379
-# REDIS_DBINDEX=0
-# REDIS_PASSWORD=
-REDIS_SOCKET=/run/redis/redis.sock
+REDIS_HOSTNAME=localhost
-###################################################################################
-# Upload File Location
-# This is the location where uploaded files are stored.
-###################################################################################
+REVERSE_GEOCODING_DUMP_DIRECTORY=/var/lib/immich/.reverse-geocoding-dump
-UPLOAD_LOCATION=/var/lib/immich/upload
+IMMICH_MEDIA_LOCATION=/var/lib/immich/upload
-###################################################################################
-# Machine Learning
-###################################################################################
+TYPESENSE_API_KEY=xyz
+TYPESENSE_ENABLED=true
+TYPESENSE_HOST=localhost
+TYPESENSE_DATA_DIR=/var/lib/typesense
-IMMICH_MACHINE_LEARNING_ENABLED=false
-
-###################################################################################
-# Typesense
-###################################################################################
-#TYPESENSE_API_KEY=
-TYPESENSE_ENABLED=false
-
-###################################################################################
-# Reverse Geocoding
-#
-# Reverse geocoding is done locally which has a small impact on memory usage
-# This memory usage can be altered by changing the REVERSE_GEOCODING_PRECISION variable
-# This ranges from 0-3 with 3 being the most precise
-# 3 - Cities > 500 population: ~200MB RAM
-# 2 - Cities > 1000 population: ~150MB RAM
-# 1 - Cities > 5000 population: ~80MB RAM
-# 0 - Cities > 15000 population: ~40MB RAM
-####################################################################################
+IMMICH_MACHINE_LEARNING_ENABLED=true
# DISABLE_REVERSE_GEOCODING=false
# REVERSE_GEOCODING_PRECISION=3
-####################################################################################
-# WEB - Optional
-#
-# Custom message on the login page, should be written in HTML form.
-# For example:
-# PUBLIC_LOGIN_PAGE_MESSAGE="This is a demo instance of Immich.<br><br>Email: <i>demo@demo.de</i><br>Password: <i>demo</i>"
-####################################################################################
-
-PUBLIC_LOGIN_PAGE_MESSAGE=
-
-####################################################################################
-# Alternative Service Addresses - Optional
-#
-# This is an advanced feature for users who may be running their immich services on different hosts.
-# It will not change which address or port that services bind to within their containers, but it will change where other services look for their peers.
-# Note: immich-microservices is bound to 3002, but no references are made
-####################################################################################
-
-# IMMICH_WEB_URL=http://immich-web:3000
-# IMMICH_SERVER_URL=http://immich-server:3001
-# IMMICH_MACHINE_LEARNING_URL=http://immich-machine-learning:3003
-# PUBLIC_IMMICH_SERVER_URL=http://immich-server:3001
-
-####################################################################################
-# Alternative API's External Address - Optional
-#
-# This is an advanced feature used to control the public server endpoint returned to clients during Well-known discovery.
-# You should only use this if you want mobile apps to access the immich API over a custom URL. Do not include trailing slash.
-# NOTE: At this time, the web app will not be affected by this setting and will continue to use the relative path: /api
-# Examples: http://localhost:3001, http://immich-api.example.com, etc
-####################################################################################
-
-#IMMICH_API_URL_EXTERNAL=http://localhost:3001
-
-
-####################################################################################
-# Debug
-####################################################################################
-
-#LOG_LEVEL=debug
-# Log Level (verbose, debug, log, warn, error)
+IMMICH_MACHINE_LEARNING_URL=http://localhost:3003
diff --git a/immich.install b/immich.install
new file mode 100644
index 000000000000..5230240a124a
--- /dev/null
+++ b/immich.install
@@ -0,0 +1,27 @@
+pre_install() {
+ :
+}
+
+post_install() {
+ echo -e "\033[1;34mINFO\033[0m\033[1m: Final steps to have a working immich instance:"
+ echo -e "\033[1;34mINFO\033[0m\033[1m: * initialise postgres and create a database called 'immich' (https://wiki.archlinux.org/title/PostgreSQL)\033[0m"
+ echo -e "\033[1;34mINFO\033[0m\033[1m: * enable an nginx config then start nginx.service, an example that servers immich on port 8080 is given in /etc/nginx/sites-available\033[0m"
+ echo -e "\033[1;34mINFO\033[0m\033[1m: * ensure immich-server resolves to 127.0.0.1 and/or ::1, e.g. through /etc/hosts\033[0m"
+ echo -e "\033[1;34mINFO\033[0m\033[1m: * start/enable immich-server.service\033[0m"
+}
+
+pre_upgrade() {
+ :
+}
+
+post_upgrade() {
+ :
+}
+
+pre_remove() {
+ :
+}
+
+post_remove() {
+ :
+}
diff --git a/immich.sysusers b/immich.sysusers
index ae6b93af2ed5..7a9464e2a53e 100644
--- a/immich.sysusers
+++ b/immich.sysusers
@@ -1,2 +1,2 @@
-u immich - "immich user" /var/lib/immich /usr/bin/bash
+u immich - "immich user" /var/lib/immich /usr/bin/nologin
m immich redis
diff --git a/immich.tmpfiles b/immich.tmpfiles
index f7fb270216b2..70c1d1a2fcce 100644
--- a/immich.tmpfiles
+++ b/immich.tmpfiles
@@ -1,2 +1,6 @@
-d /var/lib/immich 0700 immich immich -
-d /var/lib/immich/upload 0700 immich immich -
+d /var/lib/immich/.cache 0750 immich immich
+d /var/lib/immich/.config 0750 immich immich
+d /var/lib/immich/.reverse-geocoding-dump 0750 immich immich
+d /var/lib/immich/upload 0750 immich immich
+L /usr/lib/immich/app/server/upload - - - - /var/lib/immich/upload
+Z /var/lib/immich ~0750 immich immich
diff --git a/media.util.ts.patch b/media.util.ts.patch
new file mode 100644
index 000000000000..8e968a3b0654
--- /dev/null
+++ b/media.util.ts.patch
@@ -0,0 +1,15 @@
+--- server/src/domain/media/media.util.ts 2023-08-27 15:26:34.362052942 +0100
++++ server/src/domain/media/media.util.ts_patched 2023-08-27 15:27:30.806096774 +0100
+@@ -248,10 +248,10 @@
+ .sort((a, b) => {
+ // order GPU devices first
+ if (a.startsWith('card') && b.startsWith('renderD')) {
+- return -1;
++ return 1;
+ }
+ if (a.startsWith('renderD') && b.startsWith('card')) {
+- return 1;
++ return -1;
+ }
+ return -a.localeCompare(b);
+ });
diff --git a/nginx.immich.conf b/nginx.immich.conf
index d6a1cd74ff03..a4af11b62912 100644
--- a/nginx.immich.conf
+++ b/nginx.immich.conf
@@ -1,92 +1,79 @@
-# NOTE: This file is generated on startup. See /start.sh
-worker_processes auto;
-error_log /var/log/nginx/error.log;
-pid /tmp/nginx.pid;
+# adapted from https://github.com/immich-app/immich/blob/main/nginx/templates/default.conf.template
-# Load dynamic modules. See /usr/share/doc/nginx/README.dynamic.
-include /usr/share/nginx/modules/*.conf;
+map $http_upgrade $connection_upgrade {
+ default upgrade;
+ '' close;
+}
+
+map $http_x_forwarded_proto $forwarded_protocol {
+ default $scheme;
+
+ # Only allow the values 'http' and 'https' for the X-Forwarded-Proto header.
+ http http;
+ https https;
+}
-events {
- worker_connections 1024;
+upstream server {
+ server localhost:3001;
+ # server ${IMMICH_SERVER_HOST};
+ keepalive 2;
}
-http {
- map $http_upgrade $connection_upgrade {
- default upgrade;
- '' close;
+upstream web {
+ server localhost:3000;
+ # server ${IMMICH_WEB_HOST};
+ keepalive 2;
+}
+
+server {
+
+ listen 8080;
+
+ access_log off;
+ client_max_body_size 50000M;
+
+ # Compression
+ gzip on;
+ gzip_comp_level 2;
+ gzip_min_length 1000;
+ gzip_proxied any;
+ gzip_vary on;
+ gunzip on;
+
+ # text/html is included by default
+ gzip_types
+ application/javascript
+ application/json
+ font/ttf
+ image/svg+xml
+ text/css;
+
+ proxy_buffering off;
+ proxy_request_buffering off;
+ proxy_buffer_size 16k;
+ proxy_busy_buffers_size 24k;
+ proxy_buffers 64 4k;
+ proxy_force_ranges on;
+
+ proxy_http_version 1.1;
+ proxy_set_header Host $http_host;
+ proxy_set_header X-Forwarded-Host $http_host;
+ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
+ proxy_set_header X-Forwarded-Proto $forwarded_protocol;
+ proxy_set_header Upgrade $http_upgrade;
+ proxy_set_header Connection $connection_upgrade;
+
+ location /api {
+
+ rewrite /api/(.*) /$1 break;
+
+ proxy_pass http://server;
+ # proxy_pass ${IMMICH_SERVER_SCHEME}server;
}
- client_body_temp_path /tmp/client_temp;
- proxy_temp_path /tmp/proxy_temp_path;
- fastcgi_temp_path /tmp/fastcgi_temp;
- uwsgi_temp_path /tmp/uwsgi_temp;
- scgi_temp_path /tmp/scgi_temp;
-
- # events {
- # worker_connections 1000;
- # }
-
- server {
-
- gzip on;
- gzip_min_length 1000;
- gunzip on;
-
- client_max_body_size 50000M;
-
- listen 8080;
- access_log off;
-
- location /api {
-
- # Compression
- gzip_static on;
- gzip_min_length 1000;
- gzip_comp_level 2;
-
- proxy_buffering off;
- proxy_buffer_size 16k;
- proxy_busy_buffers_size 24k;
- proxy_buffers 64 4k;
- proxy_force_ranges on;
-
- proxy_http_version 1.1;
- proxy_set_header Host $host;
- proxy_set_header X-Real-IP $remote_addr;
- proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
- proxy_set_header X-Forwarded-Proto $scheme;
- proxy_set_header Upgrade $http_upgrade;
- proxy_set_header Connection "upgrade";
- proxy_set_header Host $host;
-
- rewrite /api/(.*) /$1 break;
-
- proxy_pass http://localhost:3001;
- }
-
- location / {
-
- # Compression
- gzip_static on;
- gzip_min_length 1000;
- gzip_comp_level 2;
-
- proxy_buffering off;
- proxy_buffer_size 16k;
- proxy_busy_buffers_size 24k;
- proxy_buffers 64 4k;
- proxy_force_ranges on;
-
- proxy_http_version 1.1;
- proxy_set_header Host $host;
- proxy_set_header X-Real-IP $remote_addr;
- proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
- proxy_set_header X-Forwarded-Proto $scheme;
- proxy_set_header Upgrade $http_upgrade;
- proxy_set_header Connection "upgrade";
- proxy_set_header Host $host;
-
- proxy_pass http://localhost:3000;
- }
+ location / {
+
+ proxy_pass http://web;
+ # proxy_pass ${IMMICH_WEB_SCHEME}web;
}
}