From e084f8db1f91acad040dbee99dc920257c3fff73 Mon Sep 17 00:00:00 2001 From: Tobias Gesellchen Date: Sat, 14 Feb 2026 13:08:16 +0100 Subject: [PATCH] Enhance Docker configuration for Swarm and consolidate environment templates --- .env.example | 3 +++ .gitignore | 1 + docker-compose.yml | 32 +++++++++++++++++++++++++++++--- docs/SOUNDTOUCH-SERVICE.md | 5 ++++- 4 files changed, 37 insertions(+), 4 deletions(-) diff --git a/.env.example b/.env.example index 045c37d..dc417df 100644 --- a/.env.example +++ b/.env.example @@ -1,6 +1,9 @@ # Bose SoundTouch Configuration # Copy this file to .env and customize for your setup +# Docker/Service Settings +SOUNDTOUCH_HOSTNAME=soundtouch.local + # Discovery Settings DISCOVERY_TIMEOUT=5s UPNP_ENABLED=true diff --git a/.gitignore b/.gitignore index d5ebe10..5ed88d5 100644 --- a/.gitignore +++ b/.gitignore @@ -24,6 +24,7 @@ dist/ .env .env.local .env.*.local +docker-compose.override.yml # Test coverage reports coverage.out diff --git a/docker-compose.yml b/docker-compose.yml index f83fa8b..de8dc11 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,15 +1,41 @@ services: soundtouch-service: - build: . + image: ghcr.io/gesellix/bose-soundtouch:latest + # build: . container_name: soundtouch-service - # network_mode: host # Linux only, required for discovery + # Linux only, required for discovery. Swarm requires host network at the task level. + # network_mode: host ports: - "8000:8000" + - "8443:8443" environment: - PORT=8000 + - HTTPS_PORT=8443 - DATA_DIR=/app/data - LOG_PROXY_BODY=false - REDACT_PROXY_LOGS=true + - RECORD_INTERACTIONS=true + - DISCOVERY_INTERVAL=5m + - SERVER_URL=http://${SOUNDTOUCH_HOSTNAME:-soundtouch.local}:8000 + - HTTPS_SERVER_URL=https://${SOUNDTOUCH_HOSTNAME:-soundtouch.local}:8443 volumes: - - ./data:/app/data + - soundtouch-data:/app/data + # Use host volume for local development if preferred: + # - ./data:/app/data restart: unless-stopped + deploy: + replicas: 1 + restart_policy: + condition: on-failure + resources: + limits: + cpus: '0.50' + memory: 512M + reservations: + cpus: '0.25' + memory: 128M + +volumes: + soundtouch-data: + # Named volumes are preferred in Swarm. For multi-node persistence, + # consider using a volume driver like NFS or GlusterFS. diff --git a/docs/SOUNDTOUCH-SERVICE.md b/docs/SOUNDTOUCH-SERVICE.md index 685df1f..97c9609 100644 --- a/docs/SOUNDTOUCH-SERVICE.md +++ b/docs/SOUNDTOUCH-SERVICE.md @@ -100,8 +100,11 @@ services: - HTTPS_SERVER_URL=https://soundtouch.local:8443 - DATA_DIR=/app/data volumes: - - ./data:/app/data + - soundtouch-data:/app/data restart: unless-stopped + +volumes: + soundtouch-data: ``` And run: