Compare commits

...

3 Commits

Author SHA1 Message Date
cc73e4214a deploiement de snowshare 2026-07-30 11:47:24 +00:00
b170c71db0 Ajout de Immich 2026-07-30 10:07:13 +00:00
598f0a6e31 ajout de passwordpusher 2026-07-23 10:21:16 +00:00
8 changed files with 603 additions and 5 deletions

View File

@@ -22,3 +22,11 @@ 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
# BEGIN ANSIBLE MANAGED snowshare
[snowshare_servers]
snowshare ansible_host=10.100.5.112 ansible_user=ansible ansible_python_interpreter=/usr/bin/python3
# END ANSIBLE MANAGED snowshare

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
@@ -218,6 +218,29 @@
delegate_to: localhost delegate_to: localhost
become: false become: false
- name: Supprimer l ancienne cle SSH connue
known_hosts:
name: "{{ lxc_ip_address }}"
state: absent
delegate_to: localhost
become: false
- name: Scanner la nouvelle cle SSH du LXC
command: ssh-keyscan -H {{ lxc_ip_address }}
register: lxc_ssh_keyscan
changed_when: false
delegate_to: localhost
become: false
- name: Ajouter la nouvelle cle SSH du LXC dans known_hosts
known_hosts:
name: "{{ lxc_ip_address }}"
key: "{{ item }}"
state: present
loop: "{{ lxc_ssh_keyscan.stdout_lines }}"
delegate_to: localhost
become: false
# Ajout automatique du nouveau LXC dans inventory/hosts.ini. # Ajout automatique du nouveau LXC dans inventory/hosts.ini.
# #
# blockinfile evite les doublons: # blockinfile evite les doublons:

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,118 @@
---
# Playbook: deploy-snowshare.yml
#
# But:
# - Deployer Snowshare dans le LXC snowshare
# - Copier le docker-compose.yml depuis Git
# - Generer .env.runtime si absent
# - Creer un lien .env pour Docker Compose
# - Demarrer la stack Docker Compose
# - Verifier que le port 3000 repond
#
# Important:
# - Les secrets ne doivent pas etre dans Git
# - Le fichier .env.runtime reste sur le LXC
- name: Deployer Snowshare
hosts: snowshare_servers
become: true
gather_facts: false
vars:
stack_name: snowshare
stack_path: /opt/stacks/snowshare
compose_source: "{{ playbook_dir }}/../services/snowshare/docker-compose.yml"
snowshare_domain: snowshare.thomasmlg.fr
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: Generer le fichier env runtime si absent
shell: |
set -e
umask 077
if [ ! -f "{{ stack_path }}/.env.runtime" ]; then
POSTGRES_PASSWORD="$(openssl rand -hex 32)"
NEXTAUTH_SECRET="$(openssl rand -hex 32)"
{
printf 'POSTGRES_USER=snowshare\n'
printf 'POSTGRES_PASSWORD=%s\n' "$POSTGRES_PASSWORD"
printf 'POSTGRES_DB=snowshare\n'
printf 'DATABASE_URL=postgres://snowshare:%s@db:5432/snowshare\n' "$POSTGRES_PASSWORD"
printf 'NEXTAUTH_URL=https://{{ snowshare_domain }}\n'
printf 'NEXTAUTH_SECRET=%s\n' "$NEXTAUTH_SECRET"
printf 'ALLOW_SIGNUP=true\n'
} > "{{ stack_path }}/.env.runtime"
fi
chown root:root "{{ stack_path }}/.env.runtime"
chmod 600 "{{ stack_path }}/.env.runtime"
args:
executable: /bin/bash
no_log: true
changed_when: true
- 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 Snowshare
command: docker compose up -d
args:
chdir: "{{ stack_path }}"
- name: Attendre le port Snowshare
wait_for:
host: 127.0.0.1
port: 3000
timeout: 180
- 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,117 @@
---
# Playbook: deploy-passwordpusher.yml
#
# But:
# - Copier le docker-compose.yml Password Pusher sur le LXC
# - Generer le fichier .env.runtime sur le LXC si absent
# - Garder les secrets hors Git
# - Demarrer la stack Docker Compose
# - Verifier que le port 5100 repond
- name: Deployer Password Pusher
hosts: passwordpusher_servers
become: true
gather_facts: false
vars_prompt:
- name: smtp_address
prompt: "SMTP address"
private: false
- name: smtp_user
prompt: "SMTP username"
private: false
- name: smtp_password
prompt: "SMTP password"
private: true
vars:
stack_name: passwordpusher
stack_path: /opt/stacks/passwordpusher
compose_source: "{{ playbook_dir }}/../services/passwordpusher/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 de stockage
file:
path: "{{ stack_path }}/storage"
state: directory
owner: root
group: root
mode: "0755"
- name: Generer le fichier env runtime si absent
shell: |
set -e
umask 077
if [ ! -f "{{ stack_path }}/.env.runtime" ]; then
SECRET_KEY_BASE="$(openssl rand -hex 64)"
PWPUSH_MASTER_KEY="$(openssl rand -hex 32)"
{
printf 'SECRET_KEY_BASE=%s\n' "$SECRET_KEY_BASE"
printf 'PWPUSH_MASTER_KEY=%s\n' "$PWPUSH_MASTER_KEY"
printf 'PWP__MAIL__SMTP_ADDRESS=%s\n' "{{ smtp_address }}"
printf 'PWP__MAIL__SMTP_USER_NAME=%s\n' "{{ smtp_user }}"
printf 'PWP__MAIL__SMTP_PASSWORD=%s\n' "{{ smtp_password }}"
} > "{{ stack_path }}/.env.runtime"
fi
chown root:root "{{ stack_path }}/.env.runtime"
chmod 600 "{{ stack_path }}/.env.runtime"
args:
executable: /bin/bash
no_log: true
changed_when: true
- name: Copier le fichier Docker Compose
copy:
src: "{{ compose_source }}"
dest: "{{ stack_path }}/docker-compose.yml"
owner: root
group: root
mode: "0644"
- name: Telecharger les images Docker
command: docker compose pull
args:
chdir: "{{ stack_path }}"
- name: Demarrer la stack Password Pusher
command: docker compose up -d
args:
chdir: "{{ stack_path }}"
- name: Attendre le port Password Pusher
wait_for:
host: 127.0.0.1
port: 5100
timeout: 180
- 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:

View File

@@ -0,0 +1,84 @@
---
services:
passwordpusher:
image: docker.io/pglombardo/pwpush:stable
container_name: passwordpusher
restart: unless-stopped
platform: linux/amd64
ports:
- "5100:5100"
env_file:
- .env.runtime
environment:
TZ: Europe/Paris
# URL publique via Caddy
PWP__HOST_DOMAIN: passwordpusher.thomasmlg.fr
PWP__HOST_PROTOCOL: https
PWP__OVERRIDE_BASE_URL: https://passwordpusher.thomasmlg.fr
PWP__ALLOWED_HOSTS: "passwordpusher.thomasmlg.fr passwordpusher.thomasmlg.fr:443 10.100.5.104 10.100.5.104:5100 localhost localhost:5100"
# Cookies securises car l acces public passe par HTTPS via Caddy
PWP__SECURE_COOKIES: "true"
# Pas d acces anonyme
PWP__ALLOW_ANONYMOUS: "false"
# Phase initiale: inscriptions ouvertes pour creer ton compte
# Apres creation du compte, passer PWP__DISABLE_SIGNUPS a "true"
PWP__DISABLE_SIGNUPS: "false"
PWP__DISABLE_LOGINS: "false"
PWP__ENABLE_USER_ACCOUNT_EMAILS: "true"
# SMTP non sensible
PWP__MAIL__RAISE_DELIVERY_ERRORS: "true"
PWP__MAIL__SMTP_ADDRESS: ssl0.ovh.net
PWP__MAIL__SMTP_DOMAIN: thomasmlg.fr
PWP__MAIL__SMTP_PORT: "587"
PWP__MAIL__SMTP_AUTHENTICATION: plain
PWP__MAIL__SMTP_ENABLE_STARTTLS_AUTO: "true"
PWP__MAIL__SMTP_OPEN_TIMEOUT: "10"
PWP__MAIL__SMTP_READ_TIMEOUT: "10"
PWP__MAIL__MAILER_SENDER: passwordpusher@thomasmlg.fr
# Fonctionnalites
PWP__ENABLE_URL_PUSHES: "true"
PWP__ENABLE_FILE_PUSHES: "false"
PWP__ENABLE_QR_PUSHES: "true"
# Branding
PWP__BRAND__TITLE: "Thomas MALGOUYRES"
PWP__BRAND__TAGLINE: "Partage securisé de mots de passe"
PWP__BRAND__DISCLAIMER: "Instance privée reservée a un usage personnel."
PWP__BRAND__SHOW_FOOTER_MENU: "false"
# Theme
PWP__THEME: darkly
# Securite et confidentialite
PWP__NOINDEX: "true"
PWP__SHOW_VERSION: "false"
PWP__THROTTLING__MINUTE: "60"
PWP__THROTTLING__SECOND: "10"
# Interface et logs
PWP__DEFAULT_LOCALE: fr
PWP__LOG_LEVEL: warn
PWP__LOG_TO_STDOUT: "true"
volumes:
- pwpush-storage:/opt/PasswordPusher/storage
healthcheck:
test: ["CMD-SHELL", "curl -f -H 'Host: passwordpusher.thomasmlg.fr' || exit 1"]
interval: 30s
timeout: 10s
retries: 3
start_period: 40s
volumes:
pwpush-storage:
name: passwordpusher-storage
driver: local

View File

@@ -0,0 +1,51 @@
---
services:
db:
image: postgres:16-alpine
container_name: snowshare-db
restart: unless-stopped
env_file:
- .env.runtime
environment:
POSTGRES_USER: ${POSTGRES_USER}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
POSTGRES_DB: ${POSTGRES_DB}
volumes:
- db-data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER} -d ${POSTGRES_DB}"]
interval: 5s
timeout: 5s
retries: 10
app:
image: turodev/snowshare:latest
container_name: snowshare-app
restart: unless-stopped
depends_on:
db:
condition: service_healthy
env_file:
- .env.runtime
environment:
DATABASE_URL: ${DATABASE_URL}
NEXTAUTH_URL: ${NEXTAUTH_URL}
NEXTAUTH_SECRET: ${NEXTAUTH_SECRET}
ALLOW_SIGNUP: ${ALLOW_SIGNUP}
ports:
- "3000:3000"
volumes:
- uploads:/app/uploads
volumes:
db-data:
uploads: