Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
services:immich [2024/02/23 10:14] – 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. |
- | < | + | |
- | su - immich | + | |
- | podman compose up -d | + | ===== Configuration ===== |
+ | |||
+ | 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. | ||
+ | |||
+ | |||
+ | ==== 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 web GUI, create the external library pointing to that path | ||
+ | |||
+ | So, in your docker-compose.yml ensure that you have mapped each external library like this example: | ||
+ | < | ||
+ | services: | ||
+ | | ||
+ | | ||
+ | | ||
</ | </ | ||
- | When you want to update | + | Then, you have to go to //Immich |
- | <code bash> | + | |
- | su - immich | + | 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. |
- | podman compose down | + | |
- | podman compose pull | + | Keep in mind that Immich will **not touch** the files inthe external library at all, which means that any change to those files metadata will **not** be embedded in the external library files. |
- | podman compose up -d | + | |
+ | |||
+ | |||
+ | ==== 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 for albums and/or year-month-day. I think this is a very powerful feature of Immich and a very welcome addition to it's features. | ||
+ | |||
+ | My template is: | ||
+ | < | ||
+ | {{y}}/{{#if album}}{{album}}{{else}}Others{{/ | ||
</ | </ | ||
- | Be aware that Immich is bleeding edge and sometimes there are **breaking** updates! Always check on Immich [[https:// | + | this template will store folders by **year** |
- | ==== NGINX reverse proxy ==== | + | That can be setup from //Immich web gui -> administration -> settings -> storage templates// |
- | === Immich on sub-path === | + | 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. |
- | If you do not want to use a specific sub-domain for Immich, | + | |
+ | ==== SSO authentication setup ==== | ||
+ | |||
+ | Immich | ||
+ | |||
+ | First of all, you need to configure Authelia with a new client: | ||
< | < | ||
- | location | + | identity_providers: |
- | | + | oidc: |
- | | + | ## The other portions of the mandatory OpenID Connect 1.0 configuration go here. |
+ | ## See: https:// | ||
+ | clients: | ||
+ | - client_id: << see below to generate ClientID >> | ||
+ | client_name: | ||
+ | | ||
+ | public: false | ||
+ | authorization_policy: | ||
+ | redirect_uris: | ||
+ | - 'https://immich.mydomain.com/ | ||
+ | - ' | ||
+ | - 'app.immich:/// | ||
+ | scopes: | ||
+ | - ' | ||
+ | - ' | ||
+ | - ' | ||
+ | userinfo_signed_response_alg: | ||
+ | </ | ||
- | proxy_buffering | + | To generate a ClientID: |
- | | + | <code bash> |
- | | + | authelia crypto rand --length 72 --charset rfc3986 |
+ | </ | ||
+ | This information will need to copied to both authelia config and immich settings. | ||
- | sub_filter_once off; | + | 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. |
- | sub_filter ' | + | |
- | sub_filter 'base: ""' | + | |
- | location | + | 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/.well-known/ |
- | | + | * Client ID: << the generated ClientID >>. |
+ | * Client Secret: insecure_secret. | ||
+ | | ||
+ | * Button Text: Login with Authelia. | ||
+ | * Auto Register: Enable if desired. | ||
- | sub_filter_types *; | ||
- | sub_filter '"/ | ||
- | } | ||
- | location ~ / | ||
- | proxy_pass http:// | ||
- | rewrite / | ||
- | sub_filter_types *; | ||
- | sub_filter '"/' | ||
- | } | ||
- | location ~ / | + | ==== Bakcup setup ==== |
- | proxy_pass http:// | + | |
- | rewrite / | + | |
- | sub_filter_types *; | + | I assume you have setup a backup schedule like described [[selfhost:backup|here]], |
- | sub_filter ' | + | |
- | sub_filter ' | + | |
- | } | + | |
- | location ~ /immich/api { | + | For Immich you should backup: |
- | proxy_pass http://192.168.1.100:2283; | + | * **/data/photos/Library/library**: where actual photos are stored |
- | | + | * **/data/photos/Library/ |
- | proxy_cache off; | + | 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. |
- | + | ||
- | sub_filter_types *; | + | |
- | sub_filter '" | + | |
- | } | + | |
- | } | + | |
- | </code> | + | |
- | you need also to disable authentication, | ||
- | | ||
- | === Immich on sub-domain | + | ==== NGINX reverse proxy ==== |
- | In case you do not care for sub_path and you want to use a dedicated | + | Immich officially **only** support |
- | < | + | < |
server { | server { | ||
server_name immich.mydomain.com; | server_name immich.mydomain.com; | ||
- | listen 8443 ssl; # managed by Certbot | + | listen 8443 ssl; |
- | listen 443 ssl; # managed by Certbot | + | listen 443 ssl; |
- | client_max_body_size | + | client_max_body_size |
large_client_header_buffers 4 32k; | large_client_header_buffers 4 32k; | ||
Line 148: | Line 189: | ||
location / { | location / { | ||
- | | + | location / { |
+ | | ||
+ | #proxy_pass http:// | ||
+ | proxy_redirect | ||
+ | proxy_set_header | ||
+ | proxy_set_header | ||
+ | proxy_set_header | ||
+ | proxy_set_header | ||
+ | proxy_set_header | ||
} | } | ||
- | |||
include com.mydomain/ | include com.mydomain/ | ||
} | } | ||
</ | </ | ||
- | you need also to disable authentication, | + | ===== 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 - / | |
- | ==== First usage ==== | + | USER=immich |
+ | DESCRIPTION="The photo gallery and backup solution" | ||
+ | </ | ||
- | Fire up your browser at https:// | + | Add the service to the default runlevel and start it now: |
- | + | <code bash> | |
- | To add //external libraries//, | + | rc-update |
- | + | rc-service | |
- | First you need, as administrator, | + | </ |
- | + | ||
- | It's confusing, i think this will be improved in future releases. | + | |
+ | | ||
==== Command line CLI ==== | ==== Command line CLI ==== | ||
Line 187: | 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:// | ||