From 7c01f5aa02968b315ab422cecf7c4f53374a3cb6 Mon Sep 17 00:00:00 2001 From: John Kua Date: Tue, 15 Apr 2025 16:15:05 -0700 Subject: [PATCH 1/2] Added notes on Sonos issues and a systemd unit/service file --- README.md | 17 +++++++++++++++++ subsonic-docker.service | 21 +++++++++++++++++++++ 2 files changed, 38 insertions(+) create mode 100644 subsonic-docker.service diff --git a/README.md b/README.md index 33fad32..03cdd87 100644 --- a/README.md +++ b/README.md @@ -85,6 +85,16 @@ docker run -it \ stuckj/subsonic:latest ``` +### Sonos issues +If you have problems with Subsonic's Sonos support while running in Docker, this may be due to Sonos' use of UPnP. There are a few things that can be done to fix this, but note that the following steps reduce your server's network security and carries some level of additional risk! + +[Removing network isolation](https://docs.docker.com/engine/network/) from the docker container may help. Add these parameters to the above `docker run` commands: +* `--net=host` +* `-eSUBSONIC_HOST=` +Note that with this, the `-p` port publishing parameters are no longer necessary. + +If this still doesn't work, also try disabling the firewall on your host machine. On Ubuntu, try running `sudo ufw disable` and then restarting the container. + ## Docker compose Here is an example `docker-compose.yaml` if you choose to run with docker compose: @@ -108,6 +118,13 @@ services: - /data/subsonic-data:/var/subsonic ``` +## Running as a service +If you want to run subsonic as a service (not using Docker compose), modify [subsonic-docker.service](subsonic-docker.service) and install it: +1. Copy the file to `/etc/systemd/system/subsonic-docker.service` +2. `sudo systemctl daemon-reload` +3. `sudo systemctl enable subsonic-docker` +4. `sudo systemctl start subsonic-docker` + ## TODOs TODO: Setup auto-detection of new versions in Dockerfile (will need to scrape page). diff --git a/subsonic-docker.service b/subsonic-docker.service new file mode 100644 index 0000000..ffb2393 --- /dev/null +++ b/subsonic-docker.service @@ -0,0 +1,21 @@ +[Unit] +Description=Subsonic (Docker) Service +After=docker.service +Requires=docker.service + +[Service] +TimeoutStartSec=0 +Restart=always +ExecStartPre=-/usr/bin/docker exec %n stop +ExecStartPre=-/usr/bin/docker rm %n +ExecStartPre=/usr/bin/docker pull stuckj/subsonic:latest +ExecStart=/usr/bin/docker run --rm \ + -p "4040:4040/tcp" \ + -v /data/music:/var/music \ + -v /data/subsonic-data:/var/subsonic \ + --name="subsonic" \ + stuckj/subsonic:latest +ExecStop=/usr/bin/docker exec %n stop + +[Install] +WantedBy=default.target \ No newline at end of file From cac35fcb694cd397a035e89cd94001a6bc7270f7 Mon Sep 17 00:00:00 2001 From: John Kua Date: Tue, 15 Apr 2025 16:20:59 -0700 Subject: [PATCH 2/2] README.md Formatting --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 03cdd87..4a36c5b 100644 --- a/README.md +++ b/README.md @@ -91,6 +91,7 @@ If you have problems with Subsonic's Sonos support while running in Docker, this [Removing network isolation](https://docs.docker.com/engine/network/) from the docker container may help. Add these parameters to the above `docker run` commands: * `--net=host` * `-eSUBSONIC_HOST=` + Note that with this, the `-p` port publishing parameters are no longer necessary. If this still doesn't work, also try disabling the firewall on your host machine. On Ubuntu, try running `sudo ufw disable` and then restarting the container.