Compare commits

...

2 Commits

Author SHA1 Message Date
glenneth 09edb0a8e6 fix: Use head/cat instead of sed for multi-line YP snippet insertion 2026-01-02 13:55:46 +03:00
glenneth e9d243439f feat: Address PR feedback - rename XML files and add STATION_URL config
- Rename icecast.xml.base -> icecast-base.xml for editor highlighting
- Rename icecast-yp.xml.snippet -> icecast-yp-snippet.xml for editor highlighting
- Add STATION_URL env var to Liquidsoap for YP directory station link
- Production sets STATION_URL=https://asteroid.radio
- Update docker-compose.yml to pass both ICECAST_HOSTNAME and STATION_URL
- Update environment.sh.template with STATION_URL documentation
2026-01-02 13:48:13 +03:00
7 changed files with 23 additions and 8 deletions

View File

@ -5,7 +5,7 @@ COPY icecast-entrypoint.sh /usr/local/bin/icecast-entrypoint.sh
RUN chmod +x /usr/local/bin/icecast-entrypoint.sh RUN chmod +x /usr/local/bin/icecast-entrypoint.sh
# Copy base config and YP snippet # Copy base config and YP snippet
COPY icecast.xml.base /etc/icecast.xml.base COPY icecast-base.xml /etc/icecast-base.xml
COPY icecast-yp.xml.snippet /etc/icecast-yp.xml.snippet COPY icecast-yp-snippet.xml /etc/icecast-yp-snippet.xml
ENTRYPOINT ["/usr/local/bin/icecast-entrypoint.sh"] ENTRYPOINT ["/usr/local/bin/icecast-entrypoint.sh"]

View File

@ -25,6 +25,9 @@ settings.server.telnet.set(true)
settings.server.telnet.port.set(1234) settings.server.telnet.port.set(1234)
settings.server.telnet.bind_addr.set("0.0.0.0") settings.server.telnet.bind_addr.set("0.0.0.0")
# Station URL for YP directory listings (defaults to localhost for dev)
station_url = environment.get("STATION_URL") ?? "http://localhost:8080/asteroid/"
# ============================================================================= # =============================================================================
# CURATED STREAM (Low Orbit) - Sequential playlist # CURATED STREAM (Low Orbit) - Sequential playlist
# ============================================================================= # =============================================================================
@ -83,7 +86,7 @@ output.icecast(
name="Asteroid Radio", name="Asteroid Radio",
description="Music for Hackers - Streaming from the Asteroid", description="Music for Hackers - Streaming from the Asteroid",
genre="Electronic/Alternative", genre="Electronic/Alternative",
url="http://localhost:8080/asteroid/", url=station_url,
public=true, public=true,
radio radio
) )
@ -98,7 +101,7 @@ output.icecast(
name="Asteroid Radio (AAC)", name="Asteroid Radio (AAC)",
description="Music for Hackers - High efficiency AAC stream", description="Music for Hackers - High efficiency AAC stream",
genre="Electronic/Alternative", genre="Electronic/Alternative",
url="http://localhost:8080/asteroid/", url=station_url,
public=true, public=true,
radio radio
) )
@ -113,7 +116,7 @@ output.icecast(
name="Asteroid Radio (Low Quality)", name="Asteroid Radio (Low Quality)",
description="Music for Hackers - Low bandwidth stream", description="Music for Hackers - Low bandwidth stream",
genre="Electronic/Alternative", genre="Electronic/Alternative",
url="http://localhost:8080/asteroid/", url=station_url,
public=true, public=true,
radio radio
) )
@ -159,7 +162,7 @@ output.icecast(
name="Asteroid Radio (Shuffle)", name="Asteroid Radio (Shuffle)",
description="Music for Hackers - Random shuffle from the library", description="Music for Hackers - Random shuffle from the library",
genre="Electronic/Alternative", genre="Electronic/Alternative",
url="http://localhost:8080/asteroid/", url=station_url,
public=true, public=true,
shuffle_radio shuffle_radio
) )

View File

@ -11,6 +11,7 @@ services:
- ICECAST_ADMIN_PASSWORD=asteroid_admin_2024 - ICECAST_ADMIN_PASSWORD=asteroid_admin_2024
- ICECAST_RELAY_PASSWORD=asteroid_relay_2024 - ICECAST_RELAY_PASSWORD=asteroid_relay_2024
- ICECAST_ENABLE_YP=${ICECAST_ENABLE_YP:-false} - ICECAST_ENABLE_YP=${ICECAST_ENABLE_YP:-false}
- ICECAST_HOSTNAME=${ICECAST_HOSTNAME:-localhost}
restart: unless-stopped restart: unless-stopped
networks: networks:
- asteroid-network - asteroid-network
@ -24,6 +25,8 @@ services:
- "127.0.0.1:1234:1234" - "127.0.0.1:1234:1234"
depends_on: depends_on:
- icecast - icecast
environment:
- STATION_URL=${STATION_URL:-http://localhost:8080/asteroid/}
volumes: volumes:
- ${MUSIC_LIBRARY:-../music/library}:/app/music:ro - ${MUSIC_LIBRARY:-../music/library}:/app/music:ro
- ./asteroid-radio-docker.liq:/app/asteroid-radio.liq:ro - ./asteroid-radio-docker.liq:/app/asteroid-radio.liq:ro

View File

@ -21,3 +21,8 @@ export ASTEROID_DB_PASSWORD=asteroid_db_2025
# Production should set this to the public hostname # Production should set this to the public hostname
# Dev defaults to 'localhost' if unset # Dev defaults to 'localhost' if unset
# export ICECAST_HOSTNAME=ice.asteroid.radio # export ICECAST_HOSTNAME=ice.asteroid.radio
# Station URL (shown in YP directory listings as the station website)
# This is what listeners click to visit the station
# Dev defaults to 'http://localhost:8080/asteroid/'
# export STATION_URL=https://asteroid.radio

View File

@ -4,7 +4,7 @@
# - Substitute hostname (defaults to localhost for dev) # - Substitute hostname (defaults to localhost for dev)
# - If ICECAST_ENABLE_YP=true, insert YP directory blocks # - If ICECAST_ENABLE_YP=true, insert YP directory blocks
cp /etc/icecast.xml.base /etc/icecast.xml cp /etc/icecast-base.xml /etc/icecast.xml
# Set hostname (defaults to localhost if not specified) # Set hostname (defaults to localhost if not specified)
ICECAST_HOSTNAME=${ICECAST_HOSTNAME:-localhost} ICECAST_HOSTNAME=${ICECAST_HOSTNAME:-localhost}
@ -14,7 +14,11 @@ sed -i "s|<hostname>localhost</hostname>|<hostname>$ICECAST_HOSTNAME</hostname>|
if [ "$ICECAST_ENABLE_YP" = "true" ]; then if [ "$ICECAST_ENABLE_YP" = "true" ]; then
echo "YP directory publishing ENABLED" echo "YP directory publishing ENABLED"
# Insert YP config before closing </icecast> tag # Insert YP config before closing </icecast> tag
sed -i 's|</icecast>|'"$(cat /etc/icecast-yp.xml.snippet)"'\n</icecast>|' /etc/icecast.xml # Use sed with a temp file to handle multi-line insertion
head -n -1 /etc/icecast.xml > /tmp/icecast-temp.xml
cat /etc/icecast-yp-snippet.xml >> /tmp/icecast-temp.xml
echo "</icecast>" >> /tmp/icecast-temp.xml
mv /tmp/icecast-temp.xml /etc/icecast.xml
else else
echo "YP directory publishing DISABLED (dev mode)" echo "YP directory publishing DISABLED (dev mode)"
fi fi