initial commit

This commit is contained in:
2026-05-16 22:46:17 +02:00
commit a285dda742
2298 changed files with 494137 additions and 0 deletions
+32
View File
@@ -0,0 +1,32 @@
FROM debian:bookworm-slim
ARG SNAPCAST_VERSION=0.35.0
ARG TARGETARCH
# Resolve Debian arch name from Docker arch
RUN case "${TARGETARCH}" in \
amd64) ARCH=amd64 ;; \
arm64) ARCH=arm64 ;; \
arm) ARCH=armhf ;; \
*) echo "Unsupported arch: ${TARGETARCH}" && exit 1 ;; \
esac \
&& apt-get update \
&& apt-get install -y --no-install-recommends curl ca-certificates gettext-base \
&& curl -fLO "https://github.com/badaix/snapcast/releases/download/v${SNAPCAST_VERSION}/snapserver_${SNAPCAST_VERSION}-1_${ARCH}_bookworm.deb" \
&& apt-get install -y --no-install-recommends ./snapserver_*.deb \
&& rm -f snapserver_*.deb \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
COPY entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]
EXPOSE 1704 1705 1780
HEALTHCHECK --interval=15s --timeout=5s --start-period=10s \
CMD wget -qO- http://localhost:1780/jsonrpc \
-d '{"jsonrpc":"2.0","method":"Server.GetStatus","id":1}' \
| grep -q '"id":1' || exit 1
CMD ["snapserver", "--config", "/tmp/snapserver.conf"]
+5
View File
@@ -0,0 +1,5 @@
#!/bin/sh
# Expand env vars in snapserver config (e.g. ${SNAPSERVER_HOST}, ${TCP_POP_HOST})
set -e
envsubst < /etc/snapserver.conf > /tmp/snapserver.conf
exec "$@"
+176
View File
@@ -0,0 +1,176 @@
###############################################################################
# ______ #
# / _____) #
# ( (____ ____ _____ ____ ___ _____ ____ _ _ _____ ____ #
# \____ \ | _ \ (____ || _ \ /___)| ___ | / ___)| | | || ___ | / ___) #
# _____) )| | | |/ ___ || |_| ||___ || ____|| | \ V / | ____|| | #
# (______/ |_| |_|\_____|| __/ (___/ |_____)|_| \_/ |_____)|_| #
# |_| #
# #
# Snapserver config file #
# #
###############################################################################
# default values are commented
# uncomment and edit to change them
# Settings can be overwritten on command line with:
# "--<section>.<name>=<value>", e.g. --server.threads=4
# General server settings #####################################################
#
[server]
# Number of additional worker threads to use
# - For values < 0 the number of threads will be 2 (on single and dual cores)
# or 4 (for quad and more cores)
# - 0 will utilize just the processes main thread and might cause audio drops
# in case there are a couple of longer running tasks, such as encoding
# multiple audio streams
#threads = -1
# the pid file when running as daemon
#pidfile = /var/run/snapserver/pid
# the user to run as when daemonized
#user = snapserver
# the group to run as when daemonized
group = audio
# directory where persistent data is stored (server.json)
# if empty, data dir will be
# - "/var/lib/snapserver/" when running as daemon
# - "$HOME/.config/snapserver/" when not running as daemon
#
###############################################################################
# HTTP RPC ####################################################################
#
[http]
# enable HTTP Json RPC (HTTP POST and websockets)
enabled = true
# address to listen on, can be specified multiple times
# use "0.0.0.0" to bind to any IPv4 address or :: to bind to any IPv6 address
# or "127.0.0.1" or "::1" to bind to localhost IPv4 or IPv6, respectively
# use the address of a specific network interface to just listen to and accept
# connections from that interface
bind_to_address = 0.0.0.0
# which port the server should listen to
port = 1780
# serve a website from the doc_root location
# disabled if commented or empty
doc_root = /usr/share/snapserver/snapweb
# Hostname or IP under which clients can reach this host
# used to serve cached cover art
# use <hostname> as placeholder for your actual host name
host = ${SNAPSERVER_HOST}
#
###############################################################################
# TCP RPC #####################################################################
#
[tcp]
# enable TCP Json RPC
enabled = true
# address to listen on, can be specified multiple times
# use "0.0.0.0" to bind to any IPv4 address or :: to bind to any IPv6 address
# or "127.0.0.1" or "::1" to bind to localhost IPv4 or IPv6, respectively
# use the address of a specific network interface to just listen to and accept
# connections from that interface
bind_to_address = 0.0.0.0
# which port the server should listen to
port = 1705
#
###############################################################################
# Stream settings #############################################################
#
[stream]
# address to listen on, can be specified multiple times
# use "0.0.0.0" to bind to any IPv4 address or :: to bind to any IPv6 address
# or "127.0.0.1" or "::1" to bind to localhost IPv4 or IPv6, respectively
# use the address of a specific network interface to just listen to and accept
# connections from that interface
bind_to_address = 0.0.0.0
# which port the server should listen to
port = 1704
# source URI of the PCM input stream, can be configured multiple times
# The following notation is used in this paragraph:
# <angle brackets>: the whole expression must be replaced with your specific setting
# [square brackets]: the whole expression is optional and can be left out
# [key=value]: if you leave this option out, "value" will be the default for "key"
#
# Format: TYPE://host/path?name=<name>[&codec=<codec>][&sampleformat=<sampleformat>][&chunk_ms=<chunk ms>][&controlscript=<control script filename>[&controlscriptparams=<control script command line arguments>]]
# parameters have the form "key=value", they are concatenated with an "&" character
# parameter "name" is mandatory for all sources, while codec, sampleformat and chunk_ms are optional
# and will override the default codec, sampleformat or chunk_ms settings
# Available types are:
# pipe: pipe:///<path/to/pipe>?name=<name>[&mode=create], mode can be "create" or "read"
#source = librespot:///librespot?name=Spotify[&username=<user>&password=<pass>][&devicename=Snapcast][&bitrate=320][&wd_timeout=7800][&volume=100][&nomalize=false][&autoplay=true][&killall=false>]
# note that you need to have the librespot binary on your machine
# sampleformat will be set to "44100:16:2"
# file: file:///<path/to/PCM/file>?name=<name>
# process: process:///<path/to/process>?name=<name>[&wd_timeout=0][&log_stderr=false][&params=<process arguments>]
source = pipe:///audio/mopidy.fifo?name=mopidy&mode=read&sampleformat=48000:16:2&buffer=160
source = pipe:///audio/turntable.fifo?name=turntable&mode=read&sampleformat=48000:16:2
source = tcp://${TCP_POP_HOST}:4711?name=pop&mode=client
source = tcp://${TCP_TP_HOST}:4711?name=tp&mode=client
source = tcp://${TCP_FRAMEWORK_HOST}:4711?name=framework&mode=client&sampleformat=48000:16:2
sampleformat = 48000:16:2
# Default transport codec
# (flac|ogg|opus|pcm)[:options]
# Start Snapserver with "--stream:codec=<codec>:?" to get codec specific options
codec = pcm
# Default source stream read chunk size [ms].
# The server will continously read this number of milliseconds from the source into buffer and pass this buffer to the encoder.
# The encoded buffer is sent to the clients. Some codecs have a higher latency and will need more data, e.g. Flac will need ~26ms chunks
#chunk_ms = 26
# Buffer [ms]
# The end-to-end latency, from capturing a sample on the server until the sample is played-out on the client
buffer = 3500
# Send audo to muted clients
#send_to_muted = false
#
# Streaming client options ####################################################
#
[streaming_client]
# Volume assigned to new snapclients [percent]
# Defaults to 100 if unset
#initial_volume = 100
#
###############################################################################
# Logging options #############################################################
#
[logging]
# log sink [null,system,stdout,stderr,file:<filename>]
# when left empty: if running as daemon "system" else "stdout"
#sink =
# log filter <tag>:<level>[,<tag>:<level>]*
# with tag = * or <log tag> and level = [trace,debug,info,notice,warning,error,fatal]
#filter = *:info
#
###############################################################################
+23
View File
@@ -0,0 +1,23 @@
[server]
threads = -1
[http]
enabled = true
bind_to_address = 0.0.0.0
port = 1780
doc_root = /usr/share/snapserver/snapweb
[tcp]
enabled = true
bind_to_address = 0.0.0.0
port = 1705
[stream]
# Mopidy audio output (GStreamer filesink → FIFO)
stream = pipe:///audio/mopidy.fifo?name=Mopidy&sampleformat=48000:16:2&chunk_ms=20&mode=read&dryout_ms=2000
# Turntable (written by the host-side turntable-capture service)
stream = pipe:///audio/turntable.fifo?name=Turntable&sampleformat=48000:16:2&chunk_ms=20&mode=read&dryout_ms=2000
[logging]
debug = false