Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
services:immich [2025/02/23 19:30] – willy | services:immich [2025/03/19 10:04] (current) – [SSO authentication setup] willy | ||
---|---|---|---|
Line 3: | Line 3: | ||
[[https:// | [[https:// | ||
- | Immich | + | Immich |
- | Overall | + | |
- | * Doesn' | + | |
- | * Uses a database | + | |
- | * It's been a bit unclear since it was acquired by Futo' | + | |
- | * After moving to Futo they added some controversial support system (on which they also backtracked), and it seemed | + | |
- | * Devs don't seems to care too much on user needs and keep plowing ahead on their roadmap. | + | |
- | Immich, at this time, does not support // | + | Immich, at this time, still does not support // |
- | Overall, i stopped using it. | + | 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. |
- | ===== Installation ===== | ||
+ | ===== Installation ===== | ||
- | Use **photos** | + | I will assume you will store all Immich stuff under **/data/photos**. You will need two folders here: |
+ | * / | ||
+ | * / | ||
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 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:// | ||
- | I assume you have already created the photo user and group, but in case you didn' | + | I assume you have already created the photo user and group (see [[selfhost: |
- | So, let's get going. Create an **immich** user: | + | |
<code bash> | <code bash> | ||
useradd -d / | useradd -d / | ||
+ | mkdir / | ||
+ | mkdir / | ||
+ | mkdir / | ||
</ | </ | ||
Line 54: | 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 | ||
</ | </ | ||
+ | |||
+ | You can fine-tune the rest of the env file to your needs. | ||
+ | |||
===== Configuration ===== | ===== 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 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. | ||
- | ==== Storage Template setup ==== | + | [[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: | ||
+ | immich-server: | ||
+ | volumes: | ||
+ | - / | ||
+ | </ | ||
+ | Then, you have to go to //Immich web gui -> administration -> external libraries// and add create a new library. Each library must belong to an user and shall have one or more paths, the ones mapped as above, inside. | ||
+ | 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. | ||
+ | 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. | ||
- | ==== NGINX reverse proxy ==== | ||
- | === Immich on sub-path | + | ==== Storage Template setup ==== |
- | If you do not want to use a specific sub-domain | + | Storage templates let' |
+ | |||
+ | My template is: | ||
< | < | ||
- | location | + | {{y}}/{{#if album}}{{album}}{{else}}Others{{/if}}/{{filename}} |
- | proxy_pass http://127.0.0.1: | + | </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**. |
- | 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://127.0.0.1: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: << the random password generated above, not the digest >>. |
- | } | + | * Scope: openid profile email. |
- | | + | * Button Text: Login with Authelia. |
- | | + | * Auto Register: Enable if desired. |
- | | + | |
- | proxy_set_header | ||
- | proxy_set_header | ||
- | proxy_set_header | ||
- | proxy_set_header | ||
- | proxy_set_header | ||
- | proxy_cache_use_stale | ||
- | http_500 http_502 http_503 http_504; | ||
- | proxy_redirect | ||
- | } | + | ==== Bakcup setup ==== |
- | </ | + | |
- | you need also to disable authentication, since Immich cannot work with Proxy Auth and you would end up with double-authentication. | + | I assume |
- | (note: YMMV, at this time this seems broken by an Immich | + | For Immich |
- | + | * **/ | |
+ | * **/ | ||
- | === Immich | + | You should also go to //Immich |
- | 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**: | ||
- | < | + | ==== NGINX reverse proxy ==== |
+ | |||
+ | Immich officially **only** support subdomain and not subpath deployment. Use the following NGINX configuration, | ||
+ | |||
+ | < | ||
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 170: | 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 211: | Line 242: | ||
+ | ===== 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:// | ||