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:52] – [Installation] 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. |
+ | |||
+ | |||
+ | ===== 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: | ||
+ | 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. | ||
+ | |||
+ | |||
+ | |||
+ | ==== 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{{/ | ||
+ | </ | ||
+ | |||
+ | 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**. | ||
+ | |||
+ | That can be setup from //Immich web gui -> administration -> settings -> storage templates// | ||
+ | |||
+ | 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. | ||
+ | |||
+ | |||
+ | ==== SSO authentication setup ==== | ||
+ | |||
+ | Immich support direct integration with [[selfhost: | ||
+ | |||
+ | First of all, you need to configure Authelia with a new client: | ||
+ | < | ||
+ | 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: | ||
+ | client_secret: | ||
+ | public: false | ||
+ | authorization_policy: | ||
+ | redirect_uris: | ||
+ | - ' | ||
+ | - ' | ||
+ | - ' | ||
+ | scopes: | ||
+ | - ' | ||
+ | - ' | ||
+ | - ' | ||
+ | userinfo_signed_response_alg: | ||
+ | </ | ||
+ | |||
+ | To generate a ClientID: | ||
<code bash> | <code bash> | ||
- | su - immich | + | authelia crypto rand --length 72 --charset rfc3986 |
- | podman compose up -d | + | |
</ | </ | ||
+ | This information will need to copied to both authelia config and immich settings. | ||
- | When you want to update Immich, just: | + | To generate a Client Secret: |
<code bash> | <code bash> | ||
- | su - immich | + | authelia crypto hash generate pbkdf2 |
- | podman compose down | + | |
- | podman compose pull | + | |
- | podman compose up -d | + | |
</ | </ | ||
+ | Please note **both** the hash and the password itself! You will need the password itself in the next step. | ||
- | Be aware that Immich | + | Then you need to configure |
+ | | ||
+ | * Client ID: << | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
- | ==== NGINX reverse proxy ==== | ||
- | Immich does not support bas_url, so: | ||
- | <file txt immich.conf> | ||
- | location /immich { | ||
- | auth_pam off; | ||
- | | ||
- | } | ||
- | </ | ||
- | The following | + | ==== Bakcup |
- | <file txt immich.conf> | + | |
- | 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 |
+ | * **/ | ||
+ | * **/ | ||
- | === Immich | + | You should also go to //Immich |
- | Immich does not yet support sub-paths. But using the following specific proxy setup will work: | ||
- | < | ||
- | location /immich { | ||
- | proxy_pass http:// | ||
- | rewrite / | ||
- | proxy_buffering | + | ==== NGINX reverse proxy ==== |
- | proxy_cache | + | |
- | proxy_cache_valid | + | |
- | sub_filter_once off; | + | Immich officially **only** support subdomain and not subpath deployment. Use the following NGINX configuration, |
- | sub_filter_types text/ | + | |
- | sub_filter ' href="/' | + | |
- | sub_filter ' src="/' | + | |
- | sub_filter ' action="/' | + | |
- | sub_filter ' | + | |
- | sub_filter 'base: ""' | + | |
- | location /immich/ | + | <file - immich.conf> |
- | | + | server |
- | | + | |
+ | | ||
+ | listen 443 ssl; | ||
+ | client_max_body_size 5000M; | ||
+ | large_client_header_buffers 4 32k; | ||
- | sub_filter_types *; | + | access_log |
- | sub_filter '" | + | error_log |
- | } | + | |
- | | + | |
- | proxy_pass http://192.168.1.100:2283; | + | location |
- | | + | proxy_pass http://127.0.0.1:2283; |
+ | # | ||
+ | proxy_redirect | ||
+ | proxy_set_header | ||
+ | proxy_set_header | ||
+ | proxy_set_header | ||
+ | proxy_set_header | ||
+ | proxy_set_header | ||
+ | } | ||
+ | include com.mydomain/ | ||
+ | } | ||
+ | </ | ||
- | sub_filter_types *; | + | ===== Autostart ===== |
- | sub_filter '"/' | + | |
- | } | + | |
- | location ~ /immich/_app/immutable/chunks/api\\. { | + | To start it, and set it up on boot, as usual follow my indications [[gentoo: |
- | proxy_pass http://192.168.1.100: | + | < |
- | | + | ln -s /etc/init.d/user-containers |
+ | </code> | ||
- | sub_filter_types *; | + | and create the following config file: |
- | | + | <file - /etc/conf.d/ |
- | | + | USER=immich |
- | } | + | DESCRIPTION="The photo gallery and backup solution" |
+ | </file> | ||
- | location ~ /immich/api { | + | Add the service to the default runlevel and start it now: |
- | | + | <code bash> |
- | | + | rc-update add user-containers.immich |
+ | rc-service user-containers.immich start | ||
+ | </code> | ||
- | proxy_cache off; | ||
- | | ||
- | sub_filter_types *; | ||
- | sub_filter '" | ||
- | } | ||
- | } | ||
- | </ | ||
- | | ||
- | TO BE TESTED | ||
- | | ||
| | ||
- | === First usage === | + | ==== Command line CLI ==== |
- | Fire up your browser at http://<server ip>:2283 and follow instructions. | + | Immich has a CLI which requires NPM: |
- | To add //external libraries//, | + | <code bash> |
+ | emerge nodejs | ||
+ | </code> | ||
- | === Command line CLI === | + | as user immich: |
+ | <code bash> | ||
+ | npm i -g @immich/ | ||
+ | </ | ||
- | Immich has a CLI qhich requires NPM: | + | The CLI might require login for upload operations: |
<code bash> | <code bash> | ||
- | > emerge nodejs | + | immich login-key https:// |
+ | immich upload --recursive directory/ | ||
</ | </ | ||
- | as root: | ||
- | npm i -g @immich/cli | ||
- | as une user: | + | ===== Update ===== |
- | immich login-key http:// | + | |
- | immich upload | + | When you want to update Immich, just: |
+ | <code bash> | ||
+ | su - immich | ||
+ | podman compose down | ||
+ | podman compose pull | ||
+ | podman compose up -d | ||
+ | </code> | ||
+ | Be aware that Immich is bleeding edge and sometimes there are **breaking** updates! Always check on Immich [[https:// | ||