Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
services:immich [2024/02/22 15:59] – [NGINX reverse proxy] willy | services:immich [2025/03/13 14:41] (current) – [Installation] willy | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== Immich ====== | ====== Immich ====== | ||
- | [[https:// | + | [[https:// |
- | Immich | + | Immich |
- | Immich | + | Immich, at this time, still does not support |
+ | |||
+ | While installing Immich overall is not a huge task, you should really read carefully this page **and** all the very good documentation on Immich website itself. | ||
- | Immich, at this time, does not support // | ||
===== Installation ===== | ===== Installation ===== | ||
- | I tried to install | + | I will assume you will store all Immich |
+ | * / | ||
+ | * / | ||
- | So, let's get going. Create an **immich** user: | + | Immich needs to be installed using a docker compose file. This is the official and only supported installation method. I will show you, of course, how to run it rootless with podman. Immich installation is detailed [[https://immich.app/ |
+ | |||
+ | I assume you have already created the photo user and group (see [[selfhost: | ||
<code bash> | <code bash> | ||
- | useradd -d /data/damons/immich immich | + | useradd -d /data/daemons/photos photos |
+ | mkdir / | ||
+ | mkdir / | ||
+ | mkdir / | ||
</ | </ | ||
- | And download the standard | + | And download the standard |
<code bash> | <code bash> | ||
- | su - immich | + | su - photos |
wget https:// | wget https:// | ||
- | wget https:// | + | # |
- | wget https:// | + | # |
wget -O .env https:// | wget -O .env https:// | ||
</ | </ | ||
(enabling hardware acceleration is optional and i will not cover it here, as it's not needed in my use-case) | (enabling hardware acceleration is optional and i will not cover it here, as it's not needed in my use-case) | ||
- | Since you are going to use podman instead of docker, you need to add a specific network to the docker compose file. Also, you want to add support | + | I will __not__ give you a full docker-compose file, because Immich sometimes ships with backward incompatibilities, you **must** start from the one linked above and do the following modifications: |
+ | * Specify a network | ||
+ | * Add any specific volumes | ||
+ | * Remove the //restart// and // | ||
+ | |||
+ | This is the specific code for the network: | ||
< | < | ||
- | # Set the following locations to immich-server, | + | # Add these two lines to each one of the services (immich-server, |
- | volumes: | + | |
- | - ${UPLOAD_LOCATION}:/ | + | |
- | - / | + | |
- | - ${EXTERNAL_PATH}:/ | + | |
- | + | ||
- | # Add these two lines to each one of the services (immich-server, | + | |
networks: | networks: | ||
- immich-net | - immich-net | ||
Line 45: | Line 52: | ||
</ | </ | ||
- | Please note that you can have more than one mount, ideally one for each folder tree that contains photos you want to add as external library to Immich. | + | Please note that you can have more than one mount, ideally one for each folder tree that contains photos you want to add as //external library// to Immich. |
edit the **/ | edit the **/ | ||
< | < | ||
- | UPLOAD_LOCATION=/ | + | # The location where your uploaded files are stored |
- | EXTERNAL_PATH=/path/ | + | UPLOAD_LOCATION=/ |
- | IMMICH_VERSION=release | + | # The location where your database files are stored |
+ | DB_DATA_LOCATION=/data/photos/immich_database | ||
</ | </ | ||
- | then fire up the containers: | + | You can fine-tune the rest of the env file to your needs. |
- | <code bash> | + | |
- | su - immich | + | |
- | podman compose up -d | + | |
- | </ | + | |
- | When you want to update | + | |
- | < | + | ===== Configuration ===== |
- | su - immich | + | |
- | podman compose down | + | You should follow all the steps below before starting using Immich for real, as they have some implications and it's better to sort out stuff before, than reorganize everything later. Immich does a pretty great job of ensuring it's consistent and changeable at a later point in time tough. Still better to dedicate a little time to think stuff out before than later. |
- | podman compose pull | + | |
- | podman compose up -d | + | |
+ | ==== External Library setup ==== | ||
+ | |||
+ | External libraries let you integrate into Immich existing and already sorted out image libraries. It's a very welcome feature that let's you use Immich in evary conceivable scenario. | ||
+ | |||
+ | [[https:// | ||
+ | |||
+ | You have to perform two steps: | ||
+ | * Add the external library path as a volume in docker compose | ||
+ | * From Immich | ||
+ | |||
+ | So, in your docker-compose.yml ensure that you have mapped each external library like this example: | ||
+ | < | ||
+ | services: | ||
+ | | ||
+ | | ||
+ | - / | ||
</ | </ | ||
- | Be aware that Immich is bleeding edge and sometimes there are **breaking** updates! Always check on Immich [[https://github.com/ | + | Then, you have to go to //Immich web gui -> administration |
- | ==== NGINX reverse proxy ==== | + | You can also setup a watcher to monitor for new files or period scans to ensure new added files get updated inside Immich as well. |
- | === Immich | + | Keep in mind that Immich |
- | Since i do not want to use a specific sub-domain | + | |
+ | |||
+ | ==== Storage Template setup ==== | ||
+ | |||
+ | Storage templates let's you choose how Immich should store photos and videos on your filesystem. This is specially useful if you like to sort your photos | ||
+ | |||
+ | My template is: | ||
< | < | ||
- | location | + | {{y}}/{{#if album}}{{album}}{{else}}Others{{/if}}/{{filename}} |
- | proxy_pass http://192.168.1.100: | + | </code> |
- | | + | |
- | proxy_buffering | + | this template will store folders by **year** and **album**. If the photo is not stored in an album, it will go into a folder called **Others**. |
- | proxy_cache | + | |
- | proxy_cache_valid | + | |
- | sub_filter_once off; | + | That can be setup from //Immich web gui -> administration -> settings -> storage templates//. |
- | sub_filter_types text/html; | + | |
- | sub_filter ' href="/' ' href="/immich/'; | + | |
- | sub_filter ' src="/' | + | |
- | sub_filter ' action="/' | + | |
- | sub_filter ' | + | |
- | sub_filter 'base: ""' | + | |
- | location / | + | You also need to __enable__ it from the same setting area. Remember to run the update storage templates task if you change it. Also, remember to check that it's working as intended before you have thousand of photos stored the wrong way. |
- | proxy_pass http://192.168.1.100:2283; | + | |
- | rewrite / | + | |
- | sub_filter_types *; | ||
- | sub_filter '"/ | ||
- | } | ||
- | location ~ / | + | ==== SSO authentication setup ==== |
- | proxy_pass http:// | + | |
- | rewrite / | + | |
- | sub_filter_types *; | + | Immich support direct integration with [[selfhost: |
- | sub_filter '" | + | |
- | } | + | |
- | location ~ /immich/_app/immutable/chunks/api\\. { | + | First of all, you need to configure Authelia with a new client: |
- | | + | < |
- | rewrite | + | identity_providers: |
+ | oidc: | ||
+ | ## The other portions of the mandatory OpenID Connect 1.0 configuration go here. | ||
+ | ## See: https://www.authelia.com/c/oidc | ||
+ | clients: | ||
+ | - client_id: << see below to generate ClientID >> | ||
+ | client_name: | ||
+ | client_secret: | ||
+ | public: false | ||
+ | authorization_policy: | ||
+ | redirect_uris: | ||
+ | - ' | ||
+ | - 'https://immich.mydomain.com/ | ||
+ | - 'app.immich:///oauth-callback' | ||
+ | scopes: | ||
+ | - ' | ||
+ | - ' | ||
+ | - ' | ||
+ | userinfo_signed_response_alg: | ||
+ | </ | ||
- | sub_filter_types *; | + | To generate a ClientID: |
- | | + | <code bash> |
- | | + | authelia crypto rand --length 72 --charset rfc3986 |
- | } | + | </code> |
+ | This information will need to copied to both authelia config and immich | ||
- | location ~ /immich/api { | + | To generate a Client Secret: |
- | | + | <code bash> |
- | | + | authelia crypto hash generate pbkdf2 --variant sha512 --random --random.length 72 --random.charset rfc3986 |
+ | </code> | ||
+ | Please note **both** the hash and the password itself! You will need the password itself in the next step. | ||
- | proxy_cache off; | + | Then you need to configure Immich to use Authelia SSO, so go to //Immich web gui → administration → settings → Authentication settings// and enter the following information: |
- | | + | * Issuer URL: https://auth.example.com/ |
- | | + | * Client ID: << the generated ClientID |
- | sub_filter '" | + | * Client Secret: insecure_secret. |
- | } | + | * Scope: openid profile email. |
- | } | + | * Button Text: Login with Authelia. |
- | | + | * Auto Register: Enable if desired. |
- | you need also to disable authentication, | ||
- | | ||
- | === Immich on sub-domain === | ||
- | In case you do not care for sub_path and you want to use a dedicated subdomain, go ahead and use this much simpler NGINX configuration. I will assume your subdomain is called **immich.mydomain.com**: | ||
- | <file txt immich.conf> | + | ==== Bakcup setup ==== |
- | location / { | + | |
- | proxy_pass http://< | + | |
- | proxy_set_header Host $http_host; | + | |
- | proxy_set_header X-Real-IP | + | |
- | proxy_set_header X-Forwarded-For | + | |
- | proxy_set_header X-Forwarded-Proto $scheme; | + | |
- | # http://nginx.org/ | + | I assume you have setup a backup schedule like described [[selfhost:backup|here]], |
- | proxy_http_version 1.1; | + | |
- | proxy_set_header | + | |
- | proxy_set_header | + | |
- | proxy_redirect off; | + | |
- | } | + | |
- | </ | + | |
- | you need also to disable authentication, | + | For Immich you should backup: |
+ | * **/ | ||
+ | * **/ | ||
+ | You should also go to //Immich web gui -> administration -> settings -> backups// and reduce the retain to 1 or 2 backups, since you will be backing them up with restic. | ||
- | | ||
- | | ||
- | ==== First usage ==== | ||
- | Fire up your browser at https:// | + | ==== NGINX reverse proxy ==== |
- | To add //external libraries//, | + | Immich |
- | First you need, as administrator, | + | <file - immich.conf> |
+ | server { | ||
+ | server_name immich.mydomain.com; | ||
+ | listen 8443 ssl; | ||
+ | listen 443 ssl; | ||
+ | client_max_body_size 5000M; | ||
+ | large_client_header_buffers 4 32k; | ||
- | It's confusing, i think this will be improved in future releases. | + | access_log / |
+ | error_log / | ||
+ | location / { | ||
+ | location / { | ||
+ | proxy_pass http:// | ||
+ | #proxy_pass http:// | ||
+ | proxy_redirect | ||
+ | proxy_set_header | ||
+ | proxy_set_header | ||
+ | proxy_set_header | ||
+ | proxy_set_header | ||
+ | proxy_set_header | ||
+ | } | ||
+ | include com.mydomain/ | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | ===== Autostart ===== | ||
+ | |||
+ | To start it, and set it up on boot, as usual follow my indications [[gentoo: | ||
+ | < | ||
+ | ln -s / | ||
+ | </ | ||
+ | |||
+ | and create the following config file: | ||
+ | <file - / | ||
+ | USER=immich | ||
+ | DESCRIPTION=" | ||
+ | </ | ||
+ | |||
+ | Add the service to the default runlevel and start it now: | ||
+ | <code bash> | ||
+ | rc-update add user-containers.immich default | ||
+ | rc-service user-containers.immich start | ||
+ | </ | ||
+ | |||
+ | | ||
==== Command line CLI ==== | ==== Command line CLI ==== | ||
Line 184: | Line 240: | ||
immich upload --recursive directory/ | immich upload --recursive directory/ | ||
</ | </ | ||
+ | |||
+ | |||
+ | ===== Update ===== | ||
+ | |||
+ | When you want to update Immich, just: | ||
+ | <code bash> | ||
+ | su - immich | ||
+ | podman compose down | ||
+ | podman compose pull | ||
+ | podman compose up -d | ||
+ | </ | ||
+ | |||
+ | Be aware that Immich is bleeding edge and sometimes there are **breaking** updates! Always check on Immich [[https:// | ||