Add fallback music to icecast server
Some checks failed
Deploy with Docker Compose / deploy (push) Has been cancelled

This commit is contained in:
2026-03-10 12:58:53 +00:00
parent cd1bcc7f39
commit 469a225860
5 changed files with 36 additions and 42 deletions

3
.gitignore vendored
View File

@@ -47,5 +47,8 @@ coverage
# Vitest # Vitest
__screenshots__/ __screenshots__/
icecast2/fallback_music/
!icecast2/fallback_music/.gitkeep
.deploy .deploy
*.xcf *.xcf

View File

@@ -80,6 +80,10 @@ services:
- app-network - app-network
env_file: env_file:
- ./.env - ./.env
volumes:
- ./icecast2/fallback_music:/music:ro
ports:
- "${LIQUIDSOAP_HARBOR_PORT:-8001}:${LIQUIDSOAP_HARBOR_PORT:-8001}"
gitea-runner: gitea-runner:
image: gitea/act_runner:latest image: gitea/act_runner:latest

View File

@@ -1,19 +1,13 @@
FROM debian:latest as builder FROM savonet/liquidsoap:v2.3.2
USER root
WORKDIR /app
RUN apt-get update \ RUN apt-get update \
&& apt-get install --yes icecast2 gettext media-types && apt-get install --yes icecast2 gettext media-types \
# RUN apt-get install --yes liquidsoap && rm -rf /var/lib/apt/lists/*
RUN useradd radio RUN useradd radio
RUN chown -R radio:radio /etc/icecast2 /var/log/icecast2 RUN mkdir -p /music
# RUN chown -R radio:radio /etc/liquidsoap /var/log/liquidsoap RUN chown -R radio:radio /etc/icecast2 /var/log/icecast2 /music
USER radio USER radio
COPY icecast.xml.template /etc/icecast2/icecast.xml.template COPY icecast.xml.template /etc/icecast2/icecast.xml.template
# COPY stream.liq.template /etc/liquidsoap/stream.liq.template COPY stream.liq.template /etc/liquidsoap/stream.liq.template
COPY entrypoint.sh /entrypoint.sh COPY entrypoint.sh /entrypoint.sh
ENTRYPOINT [ "/entrypoint.sh" ] ENTRYPOINT [ "/entrypoint.sh" ]

View File

@@ -1,11 +1,12 @@
#!/bin/sh #!/bin/bash
set -e set -e
# Substitute environment variables into template
envsubst < /etc/icecast2/icecast.xml.template > /etc/icecast2/icecast.xml envsubst < /etc/icecast2/icecast.xml.template > /etc/icecast2/icecast.xml
# envsubst < /etc/liquidsoap/stream.liq.template > /etc/liquidsoap/stream.liq envsubst < /etc/liquidsoap/stream.liq.template > /etc/liquidsoap/stream.liq
# Run icecast with the generated config icecast2 -c /etc/icecast2/icecast.xml &
exec icecast2 -c /etc/icecast2/icecast.xml sleep 2
# exec liquidsoap /etc/liquidsoap/stream.liq liquidsoap /etc/liquidsoap/stream.liq &
# wait -n wait -n
kill $(jobs -p) 2>/dev/null || true
exit 1

View File

@@ -1,24 +1,16 @@
[general] settings.server.telnet.set(false)
duration = 0 # 0 = run forever
bufferSecs = 5 # buffer size in seconds
reconnect = yes # reconnect on failure
reconnectDelay = 5
[input] music = playlist("/music", mode="randomize", reload_mode="watch")
device = pulse # PulseAudio input
sampleRate = 44100 # in Hz
bitsPerSample = 16
channel = 2
[icecast2-0] live = input.harbor("${LIQUIDSOAP_HARBOR_MOUNT}", port=${LIQUIDSOAP_HARBOR_PORT}, password="${ICECAST_SOURCE_PASSWORD}")
bitrateMode = cbr
bitrate = 128 # kbps radio = fallback(track_sensitive=false, [live, music, blank()])
format = mp3
server = ${ICECAST_HOST} output.icecast(
port = ${ICECAST_PORT} %mp3,
password = ${ICECAST_SOURCE_PASSWORD} host="localhost",
mountPoint = ${ICECAST_MOUNT} port=${ICECAST_PORT},
name = "Live DJ stream" password="${ICECAST_SOURCE_PASSWORD}",
description = "Live microphone stream" mount="${ICECAST_MOUNT}",
genre = "Various" radio
public = yes )