From 50d983865283b2d49901916ba959e95fb84ce589 Mon Sep 17 00:00:00 2001 From: Torsten Curdt Date: Sat, 11 Mar 2023 00:57:09 +0100 Subject: [PATCH] Add docker compose examples, with traefik or caddy and without, fixes #476 (#2240) * add docker compose examples, with traefik or caddy and without, fixes #476 * ignore the docker-compose in root, but not the one in contrib --- .gitignore | 3 +- contrib/docker-compose/Caddyfile | 7 +++ .../docker-compose/docker-compose-caddy.yml | 31 +++++++++++ .../docker-compose/docker-compose-traefik.yml | 51 +++++++++++++++++++ contrib/docker-compose/docker-compose.yml | 18 +++++++ 5 files changed, 109 insertions(+), 1 deletion(-) create mode 100644 contrib/docker-compose/Caddyfile create mode 100644 contrib/docker-compose/docker-compose-caddy.yml create mode 100644 contrib/docker-compose/docker-compose-traefik.yml create mode 100644 contrib/docker-compose/docker-compose.yml diff --git a/.gitignore b/.gitignore index 4f5714b9c..2243b42c0 100644 --- a/.gitignore +++ b/.gitignore @@ -19,8 +19,9 @@ cache/* embedded_gen.go dist music -docker-compose.yml navidrome.db-shm navidrome.db-wal tags .gitinfo +docker-compose.yml +!contrib/docker-compose.yml \ No newline at end of file diff --git a/contrib/docker-compose/Caddyfile b/contrib/docker-compose/Caddyfile new file mode 100644 index 000000000..8bea04408 --- /dev/null +++ b/contrib/docker-compose/Caddyfile @@ -0,0 +1,7 @@ +https://your.website { + reverse_proxy * navidrome:4533 { + header_up Host {http.reverse_proxy.upstream.hostport} + header_up X-Forwarded-For {http.request.remote} + header_up X-Real-IP {http.reverse_proxy.upstream.port} + } +} \ No newline at end of file diff --git a/contrib/docker-compose/docker-compose-caddy.yml b/contrib/docker-compose/docker-compose-caddy.yml new file mode 100644 index 000000000..d259c0e20 --- /dev/null +++ b/contrib/docker-compose/docker-compose-caddy.yml @@ -0,0 +1,31 @@ +version: '3.6' + +volumes: + caddy_data: + navidrome_data: + +services: + + caddy: + container_name: "caddy" + image: caddy:2.6-alpine + restart: unless-stopped + read_only: true + volumes: + - "caddy_data:/data:rw" + - "./Caddyfile:/etc/caddy/Caddyfile:ro" + ports: + - "80:80" + - "443:443" + + navidrome: + container_name: "navidrome" + image: deluan/navidrome:latest + restart: unless-stopped + read_only: true + # user: 1000:1000 + ports: + - "4533:4533" + volumes: + - "navidrome_data:/data" + #- "/mnt/music:/music:ro" diff --git a/contrib/docker-compose/docker-compose-traefik.yml b/contrib/docker-compose/docker-compose-traefik.yml new file mode 100644 index 000000000..825d7ba92 --- /dev/null +++ b/contrib/docker-compose/docker-compose-traefik.yml @@ -0,0 +1,51 @@ +version: "3.6" + +volumes: + traefik_data: + navidrome_data: + +services: + + traefik: + container_name: "traefik" + image: traefik:2.9 + restart: unless-stopped + read_only: true + command: + - "--log.level=ERROR" + - "--providers.docker=true" + - "--providers.docker.exposedbydefault=false" + - "--entrypoints.websecure.address=:443" + - "--certificatesresolvers.tc.acme.tlschallenge=true" + #- "--certificatesresolvers.tc.acme.caserver=https://acme-staging-v02.api.letsencrypt.org/directory" + - "--certificatesresolvers.tc.acme.email=foo@foo.com" + - "--certificatesresolvers.tc.acme.storage=/letsencrypt/acme.json" + ports: + - "443:443" + volumes: + - "traefik_data:/letsencrypt" + #- "/var/run/docker.sock:/var/run/docker.sock:ro" + + navidrome: + container_name: "navidrome" + image: deluan/navidrome:latest + restart: unless-stopped + read_only: true + # user: 1000:1000 + ports: + - "4533:4533" + environment: + ND_SCANINTERVAL: 6h + ND_LOGLEVEL: info + ND_SESSIONTIMEOUT: 168h + ND_BASEURL: "" + volumes: + - "navidrome_data:/data" + #- "/mnt/music:/music:ro" + labels: + - "traefik.enable=true" + - "traefik.http.routers.navidrome.rule=Host(`foo.com`)" + - "traefik.http.routers.navidrome.entrypoints=websecure" + - "traefik.http.routers.navidrome.tls=true" + - "traefik.http.routers.navidrome.tls.certresolver=tc" + - "traefik.http.services.navidrome.loadbalancer.server.port=4533" diff --git a/contrib/docker-compose/docker-compose.yml b/contrib/docker-compose/docker-compose.yml new file mode 100644 index 000000000..8358f8d0d --- /dev/null +++ b/contrib/docker-compose/docker-compose.yml @@ -0,0 +1,18 @@ +version: '3.6' + +volumes: + navidrome_data: + +services: + + navidrome: + container_name: "navidrome" + image: deluan/navidrome:latest + restart: unless-stopped + read_only: true + # user: 1000:1000 + ports: + - "4533:4533" + volumes: + - "navidrome_data:/data" + #- "/mnt/music:/music:ro"