noelhibbard / shairport-sync-docker

18 stars 1 forks source link

Introduction

This guide assumes you have solid knowledge of Linux, shairport-sync, PulseAudio, Docker and Docker Compose. If you are solid on these things, this guide should be easy to follow. This guide also assumes your Linux server doesn’t have a desktop environment because this guide will have you disable the usermode PulseAudio service which would probably break a desktop environment. I am personally running Debian but Ubuntu should work with these instructions. Other distros may also work with minimal deviation from these instructions.

Clone this repo somewhere on your server

git clone https://github.com/noelhibbard/shairport-sync-docker.git

Install Docker and Docker Compose Plugin on host

Install / Configure PulseAudio on host

Add PulseAudio sinks that point to ALSA outputs

Add a line to /etc/pulse/system.pa for each ALSA output you want available in in Pulse. For example:

echo "load-module module-alsa-sink device=<device> sink_name=<sink_name>" >> /etc/pulse/system.pa

Note: device is the ALSA output device you want to make available in PulseAudio (Example: hw:0). sink-name is the name of the sink. What ever you use here is what you will use in shairport-sync.conf for the pa sink.

Restart PulseAudio to reload config

sudo systemctl restart pulseaudio

Configure host network in docker-compose.yaml template

The docker containers will be placed on your host network. Before you can do that you have to supply the physical network interface, subnet and gateway for your host network.

Configure SPS instances within docker-compose.yaml

A single docker-compose.yaml will contain the configureation for all your SPS docker containers. My example has two instances. One named Instance1 with the IP 192.168.1.101 and the other named Instance2 with the IP 192.168.1.102. Edit these how ever fits your environment. Also notice the volume entry that maps your shairport-sync.conf into the container. Make sure you also edit the name and PulseAudio sink within your shairport-sync.conf files.

Start the containers

docker compose up -d

Stop the containers

docker compose stop

Restart the containers

docker compose restart

Monitor shairport-sync output

docker compose logs -f

Update your containers to the latest version of NQPTP and shairport-sync.

docker compose pull
docker compose up -d