cloud-swarm/photo/docker-compose.yml
krisz 14ad5ae799
All checks were successful
Portainer Stack Update / update_stack (push) Successful in 16s
add rclone-test service for debugging in docker-compose.yml
2025-09-06 11:52:14 +02:00

235 lines
5.1 KiB
YAML

version: '3.8'
x-traefik-enable-labels: &traefik-labels
traefik.enable: "true"
traefik.swarm.network: "traefik"
traefik.constraint-label: "traefik"
x-cron-deploy: &cron-deploy
mode: replicated
replicas: 0
update_config:
parallelism: 1
delay: 5s
order: stop-first
failure_action: rollback
rollback_config:
order: stop-first
restart_policy:
condition: none
x-api-deploy: &api-deployment
mode: replicated
update_config:
parallelism: 1
delay: 5s
order: stop-first
failure_action: rollback
rollback_config:
order: stop-first
restart_policy:
condition: on-failure
delay: 5s
max_attempts: 3
window: 120s
services:
immich:
image: ghcr.io/immich-app/immich-server:v1.138.1
networks:
- local
- traefik
- public
environment:
- TZ=Europe/Berlin
- NO_COLOR=true
- IMMICH_LOG_LEVEL=log
- DB_HOSTNAME=database
- DB_USERNAME=${DB_USERNAME}
- DB_PASSWORD_FILE=/run/secrets/db_password
- DB_DATABASE_NAME=immich
- REDIS_HOSTNAME=redis
- REDIS_PORT=6379
secrets:
- db_password
volumes:
- data:/data
- thumbnail:/data/thumbs
- /etc/localtime:/etc/localtime:ro
deploy:
replicas: 1
<<: *api-deployment
resources:
limits:
memory: 2G
cpus: '2'
reservations:
memory: 512M
cpus: '0.5'
placement:
constraints:
- node.labels.immich == thumbnail
labels:
<<: *traefik-labels
traefik.http.routers.immich.rule: "Host(`photo.szabolcsi.eu`)"
traefik.http.routers.immich.entrypoints: "https"
traefik.http.routers.immich.tls: "true"
traefik.http.routers.immich.tls.certresolver: "letsencrypt"
traefik.http.services.immich.loadbalancer.server.port: "2283"
machine-learning:
image: ghcr.io/immich-app/immich-machine-learning:v1.138.1
networks:
- local
- public
environment:
- TZ=Europe/Berlin
volumes:
- cache:/cache
deploy:
replicas: 1
<<: *api-deployment
resources:
limits:
memory: 4G # ML modellek több memóriát igényelhetnek
cpus: '4'
reservations:
memory: 1G
cpus: '1'
placement:
constraints:
- node.labels.immich == model-cache
proxy:
image: haproxy:3.1.7-alpine
networks:
local:
aliases:
- redis
- database
services:
aliases:
- photo-haproxy
database:
aliases:
- photo-haproxy
configs:
- source: haproxy
target: /usr/local/etc/haproxy/haproxy.cfg
deploy:
replicas: 1
<<: *api-deployment
rclone-sync:
image: rclone/rclone:latest
entrypoint: [/bin/sh]
command: -c 'rclone sync /data GDrive:Backups/immich/full_backup --backup-dir=GDrive:Backups/immich/archive/$$(date +%Y-%m-%d) --progress'
networks:
- public
volumes:
- data:/data:ro
- rclone-config:/config/rclone
environment:
- TZ=Europe/Budapest
deploy:
<<: *cron-deploy
labels:
swarm.cronjob.enable: "true"
swarm.cronjob.skip-running: "true"
swarm.cronjob.schedule: "0 3 * * *"
rclone-test:
image: rclone/rclone:latest
command: ls GDrive:immich/archive --drive-root-folder-id 1EGLuWVD5dS2dGoc7QEnJIp61krN1OsiN
networks:
- public
volumes:
- rclone-config:/config/rclone
environment:
- TZ=Europe/Budapest
deploy:
mode: replicated
replicas: 1
restart_policy:
condition: none
rclone-cleanup:
image: rclone/rclone:latest
command: delete GDrive:Backups/immich/archive --min-age 60d --rmdirs --progress --dry-run
networks:
- public
volumes:
- data:/data:ro
- rclone-config:/config/rclone
environment:
- TZ=Europe/Budapest
deploy:
<<: *cron-deploy
labels:
swarm.cronjob.enable: "false"
swarm.cronjob.skip-running: "true"
swarm.cronjob.schedule: "0 4 * * *"
networks:
local:
name: immich
driver: overlay
internal: true
ipam:
config:
- subnet: 172.30.17.0/24
traefik:
external: true
services:
external: true
public:
name: base-public
external: true
database:
external: true
volumes:
database:
name: immich-database
driver: local
data:
name: immich-data
driver: local
driver_opts:
type: nfs
device: ":/nfs_share/photo/data"
o: "addr=10.0.0.3,rw,soft,nfsvers=4"
thumbnail:
name: immich-thumbnail
driver: local
cache:
name: immich-model-cache
driver: local
rclone-config:
name: rclone-config
driver: local
driver_opts:
type: nfs
device: ":/nfs_share/rclone"
o: "addr=10.0.0.3,rw,soft,nfsvers=4"
configs:
haproxy:
name: "${HAPROXY_CONFIG_NAME}"
external: true
secrets:
db_password:
name: postgres-password
external: true
rclone-config:
name: google-drive-rclone-config
external: true