setup icecast server
This commit is contained in:
parent
8c3140f4b4
commit
ffbf41fefa
7 changed files with 172 additions and 6 deletions
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -167,3 +167,6 @@ logs/
|
||||||
|
|
||||||
# env vars
|
# env vars
|
||||||
variables.env
|
variables.env
|
||||||
|
|
||||||
|
# icecast conf
|
||||||
|
icecast.xml
|
||||||
|
|
87
config/icecast/icecast.xml.template
Normal file
87
config/icecast/icecast.xml.template
Normal file
|
@ -0,0 +1,87 @@
|
||||||
|
<icecast>
|
||||||
|
<hostname>localhost</hostname>
|
||||||
|
<location>earth</location>
|
||||||
|
<admin>admin@localhost</admin>
|
||||||
|
<fileserve>1</fileserve>
|
||||||
|
|
||||||
|
<directory>
|
||||||
|
<yp-url-timeout>15</yp-url-timeout>
|
||||||
|
<yp-url>http://dir.xiph.org/cgi-bin/yp-cgi</yp-url>
|
||||||
|
</directory>
|
||||||
|
|
||||||
|
<limits>
|
||||||
|
<clients>100</clients>
|
||||||
|
<sources>2</sources>
|
||||||
|
<queue-size>102400</queue-size>
|
||||||
|
<client-timeout>30</client-timeout>
|
||||||
|
<header-timeout>15</header-timeout>
|
||||||
|
<source-timeout>10</source-timeout>
|
||||||
|
<burst-on-connect>1</burst-on-connect>
|
||||||
|
<burst-size>65536</burst-size>
|
||||||
|
</limits>
|
||||||
|
|
||||||
|
<authentication>
|
||||||
|
<source-password>hackme34</source-password>
|
||||||
|
<relay-user>relay</relay-user>
|
||||||
|
<relay-password>hackme23</relay-password>
|
||||||
|
<admin-user>admin</admin-user>
|
||||||
|
<admin-password>hackme12</admin-password>
|
||||||
|
</authentication>
|
||||||
|
|
||||||
|
<listen-socket>
|
||||||
|
<port>8000</port>
|
||||||
|
</listen-socket>
|
||||||
|
|
||||||
|
<mount type="normal">
|
||||||
|
<mount-name>/stream.mp3</mount-name>
|
||||||
|
<max-listeners>100</max-listeners>
|
||||||
|
<max-listener-duration>3600</max-listener-duration>
|
||||||
|
<fallback-mount>/usr/share/icecast2/web/data/fallback.mp3</fallback-mount>
|
||||||
|
<fallback-override>1</fallback-override>
|
||||||
|
<fallback-when-full>1</fallback-when-full>
|
||||||
|
<public>1</public>
|
||||||
|
<stream-name>streamname</stream-name>
|
||||||
|
<stream-description>description</stream-description>
|
||||||
|
<stream-url>localhost</stream-url>
|
||||||
|
<genre>mixed</genre>
|
||||||
|
<bitrate>192</bitrate>
|
||||||
|
<type>application/mp3</type>
|
||||||
|
<hidden>1</hidden>
|
||||||
|
<burst-size>65536</burst-size>
|
||||||
|
<mp3-metadata-interval>4096</mp3-metadata-interval>
|
||||||
|
<http-headers>
|
||||||
|
<header name="Access-Control-Allow-Origin" value="*" />
|
||||||
|
<header name="X-Robots-Tag" value="index, noarchive" />
|
||||||
|
<header name="foo" value="bar" status="200" />
|
||||||
|
<header name="Nelson" value="Ha-Ha!" status="404" />
|
||||||
|
</http-headers>
|
||||||
|
<on-connect>/home/icecast/bin/source-start</on-connect>
|
||||||
|
<on-disconnect>/home/icecast/bin/source-end</on-disconnect>
|
||||||
|
</mount>
|
||||||
|
|
||||||
|
<paths>
|
||||||
|
<!-- basedir is only used if chroot is enabled -->
|
||||||
|
<basedir>@pkgdatadir@</basedir>
|
||||||
|
|
||||||
|
<logdir>/var/log/icecast2</logdir>
|
||||||
|
<webroot>/usr/share/icecast2/web</webroot>
|
||||||
|
<adminroot>/usr/share/icecast2/admin</adminroot>
|
||||||
|
<reportxmldb>/usr/share/icecast2/web/data/report-db.xml</reportxmldb>
|
||||||
|
<!-- <pidfile>@pkgdatadir@/icecast.pid</pidfile> -->
|
||||||
|
<alias source="/" destination="/status.xsl"/>
|
||||||
|
</paths>
|
||||||
|
|
||||||
|
<logging>
|
||||||
|
<accesslog>access.log</accesslog>
|
||||||
|
<errorlog>error.log</errorlog>
|
||||||
|
<loglevel>3</loglevel> <!-- 4 Debug, 3 Info, 2 Warn, 1 Error -->
|
||||||
|
</logging>
|
||||||
|
|
||||||
|
<security>
|
||||||
|
<chroot>0</chroot>
|
||||||
|
<changeowner>
|
||||||
|
<user>radio</user>
|
||||||
|
<group>radio</group>
|
||||||
|
</changeowner>
|
||||||
|
</security>
|
||||||
|
</icecast>
|
|
@ -83,3 +83,23 @@ services:
|
||||||
- net
|
- net
|
||||||
labels:
|
labels:
|
||||||
- meta.role=discordbot
|
- meta.role=discordbot
|
||||||
|
|
||||||
|
icecast:
|
||||||
|
#depends_on:
|
||||||
|
# - "radiorelay"
|
||||||
|
build: ./src/icecast
|
||||||
|
image: tv-icecast:latest
|
||||||
|
env_file:
|
||||||
|
- "variables.env"
|
||||||
|
restart: unless-stopped
|
||||||
|
ports:
|
||||||
|
- "8000:8000"
|
||||||
|
volumes:
|
||||||
|
- /etc/localtime:/etc/localtime:ro
|
||||||
|
- "./config/icecast/icecast.xml.template:/etc/icecast2/icecast.xml.template"
|
||||||
|
- "./data/icecast:/usr/share/icecast2/web/data"
|
||||||
|
- "./logs/icecast:/var/log/icecast2"
|
||||||
|
networks:
|
||||||
|
- net
|
||||||
|
labels:
|
||||||
|
- meta.role=icecast
|
||||||
|
|
23
init.sh
23
init.sh
|
@ -1,19 +1,30 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
echo "creating data dir structure"
|
echo "creating data dir structure"
|
||||||
mkdir -v -p data/restreamer/config
|
|
||||||
mkdir -v -p data/restreamer/data
|
|
||||||
|
|
||||||
mkdir -v -p data/recorder/vod
|
|
||||||
mkdir -v -p data/recorder/live
|
|
||||||
mkdir -v -p data/recorder/thumb
|
|
||||||
|
|
||||||
|
# certbot
|
||||||
mkdir -v -p data/certbot/etc
|
mkdir -v -p data/certbot/etc
|
||||||
mkdir -v -p data/certbot/var
|
mkdir -v -p data/certbot/var
|
||||||
mkdir -v -p logs/certbot
|
mkdir -v -p logs/certbot
|
||||||
|
|
||||||
mkdir -v -p data/certificates
|
mkdir -v -p data/certificates
|
||||||
|
|
||||||
|
# restreamer
|
||||||
|
mkdir -v -p data/restreamer/config
|
||||||
|
mkdir -v -p data/restreamer/data
|
||||||
|
|
||||||
|
# scheduler
|
||||||
|
mkdir -v -p data/recorder/vod
|
||||||
|
mkdir -v -p data/recorder/live
|
||||||
|
mkdir -v -p data/recorder/thumb
|
||||||
|
|
||||||
|
# icecast
|
||||||
|
mkdir -v -p logs/icecast
|
||||||
|
touch logs/icecast/access.log
|
||||||
|
touch logs/icecast/error.log
|
||||||
|
chown 1000:1000 logs/icecast/access.log
|
||||||
|
chown 1000:1000 logs/icecast/error.log
|
||||||
|
|
||||||
echo "generating self signed certificates for haproxy bootstrap"
|
echo "generating self signed certificates for haproxy bootstrap"
|
||||||
cd data/certificates
|
cd data/certificates
|
||||||
openssl genrsa -out default.key 2048
|
openssl genrsa -out default.key 2048
|
||||||
|
|
16
src/icecast/Dockerfile
Normal file
16
src/icecast/Dockerfile
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
FROM debian:stable-slim
|
||||||
|
|
||||||
|
ENV DEBIAN_FRONTEND noninteractive
|
||||||
|
|
||||||
|
RUN apt-get -qq -y update; \
|
||||||
|
apt-get -qq -y full-upgrade; \
|
||||||
|
apt-get -qq -y install icecast2 python3-setuptools; \
|
||||||
|
apt-get -y autoclean; \
|
||||||
|
apt-get clean;
|
||||||
|
|
||||||
|
RUN useradd radio ;\
|
||||||
|
chown -R radio:radio /var/log/icecast2
|
||||||
|
|
||||||
|
ADD ./start.sh /start.sh
|
||||||
|
|
||||||
|
CMD ["/start.sh"]
|
25
src/icecast/start.sh
Executable file
25
src/icecast/start.sh
Executable file
|
@ -0,0 +1,25 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
env
|
||||||
|
|
||||||
|
set -x
|
||||||
|
|
||||||
|
set_val() {
|
||||||
|
if [ -n "$2" ]; then
|
||||||
|
sed -i "s/<$2>[^<]*<\/$2>/<$2>$1<\/$2>/g" /etc/icecast2/icecast.xml
|
||||||
|
else
|
||||||
|
echo "Setting for '$1' is missing, skipping." >&2
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
cp -v /etc/icecast2/icecast.xml.template /etc/icecast2/icecast.xml
|
||||||
|
|
||||||
|
set_val $ICECAST_SOURCE_PASSWORD source-password
|
||||||
|
set_val $ICECAST_RELAY_PASSWORD relay-password
|
||||||
|
set_val $ICECAST_ADMIN_PASSWORD admin-password
|
||||||
|
set_val $CORE_API_HOSTNAME hostname
|
||||||
|
set_val $CORE_API_HOSTNAME stream-url
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
icecast2 -n -c /etc/icecast2/icecast.xml
|
|
@ -9,3 +9,7 @@ SCHEDULER_API_HOSTNAME=tv.example.com
|
||||||
DISCORDBOT_TOKEN=changeme
|
DISCORDBOT_TOKEN=changeme
|
||||||
DISCORDBOT_LIVE_CHANNEL_ID=0
|
DISCORDBOT_LIVE_CHANNEL_ID=0
|
||||||
DISCORDBOT_LIVE_CHANNEL_UPDATE=1440
|
DISCORDBOT_LIVE_CHANNEL_UPDATE=1440
|
||||||
|
ICECAST_SOURCE_PASSWORD=changeme
|
||||||
|
ICECAST_ADMIN_PASSWORD=changeme
|
||||||
|
ICECAST_RELAY_PASSWORD=changeme
|
||||||
|
ICECAST_PASSWORD=changeme
|
||||||
|
|
Loading…
Add table
Reference in a new issue