Ajout de Immich

This commit is contained in:
2026-07-30 10:07:13 +00:00
parent 598f0a6e31
commit b170c71db0
4 changed files with 206 additions and 5 deletions

View File

@@ -22,3 +22,7 @@ stirling-pdf ansible_host=10.100.5.105 ansible_user=ansible ansible_python_inter
[passwordpusher_servers] [passwordpusher_servers]
passwordpusher ansible_host=10.100.5.104 ansible_user=ansible ansible_python_interpreter=/usr/bin/python3 passwordpusher ansible_host=10.100.5.104 ansible_user=ansible ansible_python_interpreter=/usr/bin/python3
# END ANSIBLE MANAGED passwordpusher # END ANSIBLE MANAGED passwordpusher
# BEGIN ANSIBLE MANAGED immich
[immich_servers]
immich ansible_host=10.100.5.111 ansible_user=ansible ansible_python_interpreter=/usr/bin/python3
# END ANSIBLE MANAGED immich

View File

@@ -28,11 +28,11 @@
vars: vars:
# Identite du conteneur LXC # Identite du conteneur LXC
lxc_ctid: 105 lxc_ctid: 111
lxc_hostname: passwordpusher lxc_hostname: immichprod
# Configuration reseau du conteneur # Configuration reseau du conteneur
lxc_ip: 10.100.5.104/24 lxc_ip: 10.100.5.111/24
lxc_gateway: 10.100.5.1 lxc_gateway: 10.100.5.1
lxc_bridge: vmbr0 lxc_bridge: vmbr0
@@ -49,7 +49,7 @@
lxc_cores: 2 lxc_cores: 2
lxc_memory: 2048 lxc_memory: 2048
lxc_swap: 1024 lxc_swap: 1024
lxc_disk: 15 lxc_disk: 250
# IP du serveur Ansible # IP du serveur Ansible
# Cette IP sera utilisee dans authorized_keys pour limiter la cle SSH # Cette IP sera utilisee dans authorized_keys pour limiter la cle SSH
@@ -60,7 +60,7 @@
# Groupe Ansible ajoute dans inventory/hosts.ini # Groupe Ansible ajoute dans inventory/hosts.ini
# Exemple: # Exemple:
# lxc_hostname=tracearr -> passwordpusher_servers # lxc_hostname=tracearr -> immich_servers
lxc_inventory_group: "{{ lxc_hostname | replace('-', '_') }}_servers" lxc_inventory_group: "{{ lxc_hostname | replace('-', '_') }}_servers"
# Parametres Ansible du futur conteneur # Parametres Ansible du futur conteneur

125
playbooks/deploy-immich.yml Normal file
View File

@@ -0,0 +1,125 @@
---
# Playbook: deploy-immich.yml
#
# But:
# - Deployer Immich dans le LXC immich
# - Copier le docker-compose.yml depuis Git
# - Verifier que le fichier .env.runtime existe deja sur le LXC
# - Creer les dossiers runtime locaux
# - Demarrer la stack Docker Compose
# - Verifier que le port 2283 repond
#
# Important:
# - Le fichier .env.runtime ne doit pas etre dans Git
# - Le fichier .env.runtime doit etre sur le LXC:
# /opt/stacks/immich/.env.runtime
# - Ce playbook ne touche pas encore aux bibliotheques NAS
- name: Deployer Immich
hosts: immich_servers
become: true
gather_facts: false
vars:
stack_name: immich
stack_path: /opt/stacks/immich
compose_source: "{{ playbook_dir }}/../services/immich/docker-compose.yml"
tasks:
- name: Verifier que Docker est installe
command: docker --version
changed_when: false
- name: Verifier que Docker Compose est installe
command: docker compose version
changed_when: false
- name: Creer le dossier de la stack
file:
path: "{{ stack_path }}"
state: directory
owner: root
group: root
mode: "0750"
- name: Creer le dossier library Immich
file:
path: "{{ stack_path }}/library"
state: directory
owner: root
group: root
mode: "0755"
- name: Creer le dossier postgres Immich
file:
path: "{{ stack_path }}/postgres"
state: directory
owner: root
group: root
mode: "0755"
- name: Verifier que le fichier env runtime existe
stat:
path: "{{ stack_path }}/.env.runtime"
register: immich_env_runtime
- name: Arreter si le fichier env runtime est absent
fail:
msg: "Le fichier {{ stack_path }}/.env.runtime est absent. Il doit etre cree sur le LXC, pas dans Git."
when: not immich_env_runtime.stat.exists
- name: Securiser le fichier env runtime
file:
path: "{{ stack_path }}/.env.runtime"
owner: root
group: root
mode: "0600"
- name: Creer le lien env pour Docker Compose
file:
src: "{{ stack_path }}/.env.runtime"
dest: "{{ stack_path }}/.env"
state: link
owner: root
group: root
- name: Copier le fichier Docker Compose
copy:
src: "{{ compose_source }}"
dest: "{{ stack_path }}/docker-compose.yml"
owner: root
group: root
mode: "0644"
- name: Valider la configuration Docker Compose
command: docker compose config
args:
chdir: "{{ stack_path }}"
changed_when: false
- name: Telecharger les images Docker
command: docker compose pull
args:
chdir: "{{ stack_path }}"
- name: Demarrer la stack Immich
command: docker compose up -d
args:
chdir: "{{ stack_path }}"
- name: Attendre le port Immich
wait_for:
host: 127.0.0.1
port: 2283
timeout: 300
- name: Afficher les conteneurs de la stack
command: docker compose ps
args:
chdir: "{{ stack_path }}"
register: compose_ps
changed_when: false
- name: Afficher le statut Docker Compose
debug:
var: compose_ps.stdout_lines

View File

@@ -0,0 +1,72 @@
---
services:
immich-server:
container_name: immich_server
image: ghcr.io/immich-app/immich-server:${IMMICH_VERSION:-release}
restart: unless-stopped
volumes:
- ${UPLOAD_LOCATION}:/usr/src/app/upload
- /home/Immich:/mnt/photos:ro
- /etc/localtime:/etc/localtime:ro
env_file:
- .env.runtime
ports:
- "2283:2283"
depends_on:
- redis
- database
healthcheck:
disable: false
immich-machine-learning:
container_name: immich_machine_learning
image: ghcr.io/immich-app/immich-machine-learning:${IMMICH_VERSION:-release}
restart: unless-stopped
volumes:
- model-cache:/cache
env_file:
- .env.runtime
healthcheck:
disable: false
redis:
container_name: immich_redis
image: docker.io/redis:7-alpine
restart: unless-stopped
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 30s
timeout: 10s
retries: 5
database:
container_name: immich_postgres
image: ghcr.io/immich-app/postgres:14-vectorchord0.4.3-pgvectors0.2.0
restart: unless-stopped
environment:
POSTGRES_PASSWORD: ${DB_PASSWORD}
POSTGRES_USER: ${DB_USERNAME}
POSTGRES_DB: ${DB_DATABASE_NAME}
POSTGRES_INITDB_ARGS: "--data-checksums"
volumes:
- ${DB_DATA_LOCATION}:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${DB_USERNAME} -d ${DB_DATABASE_NAME}"]
interval: 30s
timeout: 10s
retries: 5
volumes:
model-cache: