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:27] – [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 for your external photo libraries. | + | 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 |
- | < | + | * Specify a network |
- | # Set the following | + | * Add any specific |
- | volumes: | + | * Remove the //restart// and //healthcheck// sections |
- | - ${UPLOAD_LOCATION}: | + | |
- | - /etc/localtime:/etc/localtime: | + | |
- | - ${EXTERNAL_PATH}:/ | + | |
- | # Add these two lines to each one of the services (immich-server, | + | This is the specific code for the network: |
+ | < | ||
+ | # 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 |
- | If you do not want to use a specific sub-domain | + | |
+ | |||
+ | ==== Storage Template setup ==== | ||
+ | |||
+ | 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: insecure_secret. |
- | } | + | * 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 163: | 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 202: | 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:// | ||