Add Traefik reverse proxy support with automatic SSL
Configure Immich to work with existing Traefik instance: - Add Traefik labels to immich-server for automatic routing - Add external traefik network connection - Disable direct port exposure (use Traefik instead) - Add DOMAIN variable to .env.example - Improve .gitignore for generated files and volumes - Add comprehensive README with deployment instructions 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,5 +1,8 @@
|
|||||||
# You can find documentation for all the supported env variables at https://docs.immich.app/install/environment-variables
|
# You can find documentation for all the supported env variables at https://docs.immich.app/install/environment-variables
|
||||||
|
|
||||||
|
# Domain for Traefik reverse proxy
|
||||||
|
DOMAIN=photos.example.com
|
||||||
|
|
||||||
# The location where your uploaded files are stored
|
# The location where your uploaded files are stored
|
||||||
UPLOAD_LOCATION=./library
|
UPLOAD_LOCATION=./library
|
||||||
|
|
||||||
|
|||||||
17
.gitignore
vendored
17
.gitignore
vendored
@@ -1 +1,18 @@
|
|||||||
|
# Environment variables
|
||||||
.env
|
.env
|
||||||
|
|
||||||
|
# Upload directory
|
||||||
|
library/
|
||||||
|
|
||||||
|
# Docker volumes
|
||||||
|
pgdata/
|
||||||
|
|
||||||
|
# System files
|
||||||
|
.DS_Store
|
||||||
|
Thumbs.db
|
||||||
|
|
||||||
|
# IDE
|
||||||
|
.vscode/
|
||||||
|
.idea/
|
||||||
|
*.swp
|
||||||
|
*.swo
|
||||||
|
|||||||
244
README.md
Normal file
244
README.md
Normal file
@@ -0,0 +1,244 @@
|
|||||||
|
# Immich - Serveur de photos auto-hébergé
|
||||||
|
|
||||||
|
Déploiement Docker d'Immich configuré pour fonctionner avec Traefik existant.
|
||||||
|
|
||||||
|
## Prérequis
|
||||||
|
|
||||||
|
- Docker et Docker Compose
|
||||||
|
- Traefik déjà installé et configuré sur l'host
|
||||||
|
- Un réseau Docker nommé `traefik` pour Traefik
|
||||||
|
- Un nom de domaine pointant vers votre serveur
|
||||||
|
- Au moins 4GB de RAM
|
||||||
|
- Espace disque suffisant pour vos photos
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
### 1. Cloner ce dépôt
|
||||||
|
|
||||||
|
```bash
|
||||||
|
git clone <url-du-repo>
|
||||||
|
cd agence66-immich
|
||||||
|
```
|
||||||
|
|
||||||
|
### 2. Vérifier le réseau Traefik
|
||||||
|
|
||||||
|
Assurez-vous que votre réseau Traefik existe :
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker network ls | grep traefik
|
||||||
|
```
|
||||||
|
|
||||||
|
Si le réseau n'existe pas, créez-le :
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker network create traefik
|
||||||
|
```
|
||||||
|
|
||||||
|
### 3. Configuration
|
||||||
|
|
||||||
|
Créer le fichier `.env` :
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cp .env.example .env
|
||||||
|
```
|
||||||
|
|
||||||
|
Modifier le fichier `.env` :
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Votre domaine
|
||||||
|
DOMAIN=photos.votredomaine.com
|
||||||
|
|
||||||
|
# Base de données - CHANGEZ CE MOT DE PASSE !
|
||||||
|
DB_PASSWORD=VotreMotDePasseSecurise123!
|
||||||
|
```
|
||||||
|
|
||||||
|
### 4. Créer le répertoire de stockage
|
||||||
|
|
||||||
|
```bash
|
||||||
|
mkdir -p library
|
||||||
|
```
|
||||||
|
|
||||||
|
### 5. Lancer les services
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker-compose up -d
|
||||||
|
```
|
||||||
|
|
||||||
|
### 6. Vérifier le déploiement
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker-compose logs -f
|
||||||
|
```
|
||||||
|
|
||||||
|
## Accès
|
||||||
|
|
||||||
|
L'application sera accessible sur `https://photos.votredomaine.com`
|
||||||
|
|
||||||
|
Le routage et SSL sont gérés par votre Traefik existant.
|
||||||
|
|
||||||
|
**Important** : Au premier lancement, créez un compte administrateur.
|
||||||
|
|
||||||
|
## Configuration Traefik
|
||||||
|
|
||||||
|
### Labels configurés
|
||||||
|
|
||||||
|
Le service `immich-server` utilise ces labels Traefik :
|
||||||
|
|
||||||
|
- `traefik.enable=true` : Active Traefik pour ce conteneur
|
||||||
|
- `traefik.http.routers.immich.rule=Host(\`${DOMAIN}\`)` : Règle de routage par domaine
|
||||||
|
- `traefik.http.routers.immich.entrypoints=websecure` : Utilise l'entrypoint HTTPS
|
||||||
|
- `traefik.http.routers.immich.tls=true` : Active TLS
|
||||||
|
- `traefik.http.routers.immich.tls.certresolver=letsencrypt` : Utilise Let's Encrypt
|
||||||
|
- `traefik.http.services.immich.loadbalancer.server.port=3001` : Port interne du service
|
||||||
|
|
||||||
|
### Personnalisation
|
||||||
|
|
||||||
|
Si votre Traefik utilise des noms différents, modifiez dans le docker-compose.yml :
|
||||||
|
|
||||||
|
- `websecure` : nom de votre entrypoint HTTPS
|
||||||
|
- `letsencrypt` : nom de votre certresolver
|
||||||
|
- `traefik` : nom de votre réseau Docker
|
||||||
|
|
||||||
|
## Architecture
|
||||||
|
|
||||||
|
- **Immich Server** : Application principale (exposée via Traefik)
|
||||||
|
- **Immich Microservices** : Services de traitement en arrière-plan
|
||||||
|
- **Immich ML** : Machine Learning pour reconnaissance faciale et objets
|
||||||
|
- **PostgreSQL** : Base de données avec extension pgvecto-rs
|
||||||
|
- **Redis** : Cache et gestion des tâches
|
||||||
|
|
||||||
|
### Réseaux
|
||||||
|
|
||||||
|
- `traefik` (externe) : Réseau partagé avec Traefik pour le reverse proxy
|
||||||
|
- `immich-internal` : Réseau interne pour la communication entre services
|
||||||
|
|
||||||
|
## Gestion
|
||||||
|
|
||||||
|
### Arrêter les services
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker-compose down
|
||||||
|
```
|
||||||
|
|
||||||
|
### Voir les logs
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Tous les services
|
||||||
|
docker-compose logs -f
|
||||||
|
|
||||||
|
# Un service spécifique
|
||||||
|
docker-compose logs -f immich-server
|
||||||
|
```
|
||||||
|
|
||||||
|
### Mettre à jour Immich
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker-compose pull
|
||||||
|
docker-compose up -d
|
||||||
|
```
|
||||||
|
|
||||||
|
### Redémarrer un service
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker-compose restart immich-server
|
||||||
|
```
|
||||||
|
|
||||||
|
## Sauvegardes
|
||||||
|
|
||||||
|
### Base de données
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker exec -t immich_postgres pg_dumpall -c -U postgres > backup_$(date +%Y%m%d_%H%M%S).sql
|
||||||
|
```
|
||||||
|
|
||||||
|
### Restaurer une sauvegarde
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cat backup_XXXXXXXX_XXXXXX.sql | docker exec -i immich_postgres psql -U postgres
|
||||||
|
```
|
||||||
|
|
||||||
|
### Sauvegarder les photos
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Sauvegarde locale
|
||||||
|
tar -czf immich-library-$(date +%Y%m%d).tar.gz library/
|
||||||
|
|
||||||
|
# Ou avec rsync vers un serveur distant
|
||||||
|
rsync -avz ./library/ user@backup-server:/path/to/backup/
|
||||||
|
```
|
||||||
|
|
||||||
|
### Script de sauvegarde automatique
|
||||||
|
|
||||||
|
Créez un cron job pour sauvegardes quotidiennes :
|
||||||
|
|
||||||
|
```bash
|
||||||
|
#!/bin/bash
|
||||||
|
# /opt/scripts/backup-immich.sh
|
||||||
|
|
||||||
|
BACKUP_DIR="/var/backups/immich"
|
||||||
|
DATE=$(date +%Y%m%d_%H%M%S)
|
||||||
|
|
||||||
|
mkdir -p $BACKUP_DIR
|
||||||
|
|
||||||
|
# Sauvegarde DB
|
||||||
|
docker exec -t immich_postgres pg_dumpall -c -U postgres > $BACKUP_DIR/db_$DATE.sql
|
||||||
|
|
||||||
|
# Garder seulement les 7 dernières sauvegardes
|
||||||
|
find $BACKUP_DIR -name "db_*.sql" -mtime +7 -delete
|
||||||
|
```
|
||||||
|
|
||||||
|
Ajoutez au crontab :
|
||||||
|
|
||||||
|
```bash
|
||||||
|
crontab -e
|
||||||
|
# Ajouter : 0 2 * * * /opt/scripts/backup-immich.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
## Dépannage
|
||||||
|
|
||||||
|
### Immich n'est pas accessible via Traefik
|
||||||
|
|
||||||
|
1. Vérifiez que le conteneur est sur le bon réseau :
|
||||||
|
```bash
|
||||||
|
docker inspect immich_server | grep -A 10 Networks
|
||||||
|
```
|
||||||
|
|
||||||
|
2. Vérifiez les logs Traefik pour voir s'il détecte le service
|
||||||
|
|
||||||
|
3. Vérifiez que le domaine résout bien vers votre serveur :
|
||||||
|
```bash
|
||||||
|
nslookup photos.votredomaine.com
|
||||||
|
```
|
||||||
|
|
||||||
|
### Erreur "network traefik not found"
|
||||||
|
|
||||||
|
Créez le réseau :
|
||||||
|
```bash
|
||||||
|
docker network create traefik
|
||||||
|
```
|
||||||
|
|
||||||
|
### Erreur de connexion à la base de données
|
||||||
|
|
||||||
|
Vérifiez que tous les services sont démarrés :
|
||||||
|
```bash
|
||||||
|
docker-compose ps
|
||||||
|
```
|
||||||
|
|
||||||
|
Consultez les logs :
|
||||||
|
```bash
|
||||||
|
docker-compose logs database
|
||||||
|
```
|
||||||
|
|
||||||
|
### Performance lente
|
||||||
|
|
||||||
|
Vérifiez les ressources :
|
||||||
|
```bash
|
||||||
|
docker stats
|
||||||
|
```
|
||||||
|
|
||||||
|
Immich nécessite au minimum 4GB de RAM.
|
||||||
|
|
||||||
|
## Support
|
||||||
|
|
||||||
|
- Documentation Immich : https://immich.app/docs/
|
||||||
|
- Issues : Créez une issue sur le dépôt Git
|
||||||
@@ -22,14 +22,24 @@ services:
|
|||||||
- /etc/localtime:/etc/localtime:ro
|
- /etc/localtime:/etc/localtime:ro
|
||||||
env_file:
|
env_file:
|
||||||
- .env
|
- .env
|
||||||
ports:
|
# ports:
|
||||||
- '2283:2283'
|
# - '2283:2283' # Désactivé car on utilise Traefik - décommentez si vous voulez un accès direct
|
||||||
depends_on:
|
depends_on:
|
||||||
- redis
|
- redis
|
||||||
- database
|
- database
|
||||||
restart: always
|
restart: always
|
||||||
healthcheck:
|
healthcheck:
|
||||||
disable: false
|
disable: false
|
||||||
|
networks:
|
||||||
|
- traefik
|
||||||
|
labels:
|
||||||
|
- "traefik.enable=true"
|
||||||
|
- "traefik.http.routers.immich.rule=Host(`${DOMAIN}`)"
|
||||||
|
- "traefik.http.routers.immich.entrypoints=websecure"
|
||||||
|
- "traefik.http.routers.immich.tls=true"
|
||||||
|
- "traefik.http.routers.immich.tls.certresolver=letsencrypt"
|
||||||
|
- "traefik.http.services.immich.loadbalancer.server.port=3001"
|
||||||
|
- "traefik.docker.network=traefik"
|
||||||
|
|
||||||
immich-machine-learning:
|
immich-machine-learning:
|
||||||
container_name: immich_machine_learning
|
container_name: immich_machine_learning
|
||||||
@@ -70,5 +80,9 @@ services:
|
|||||||
shm_size: 128mb
|
shm_size: 128mb
|
||||||
restart: always
|
restart: always
|
||||||
|
|
||||||
|
networks:
|
||||||
|
traefik:
|
||||||
|
external: true
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
model-cache:
|
model-cache:
|
||||||
|
|||||||
Reference in New Issue
Block a user