diff --git a/README.md b/README.md index 1b4b7ea..a655ce8 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,6 @@ # One Container Radio Using Ices2 and Icecast2, the goal is to build a simple, single container deployment. One should be able to fill few parameters and direct the container to a music folder or share giving them a basic self hosted random music stream. (Reword) -** Note: Usernames / Passwords are defaulted currently. Change them if you decide to use this... ** - ** Warning: Work in progress, Docker experimenting. Please improve if you would like! Thanks :) ** ## Usage ## @@ -15,14 +13,21 @@ Using Ices2 and Icecast2, the goal is to build a simple, single container deploy (Below is based on a local build) ```bash -docker run -p 8080:8000 -v d:/music:/media -t docker-one-container-radio:latest +docker run -p 8000:8000 -e ICES_NAME=Seanland -e ICECAST_ADMIN_USER=seanland -e ICECAST_ADMIN_EMAIL=me@seanland.ca -e ICECAST_ADMIN_PASSWORD=seanland -v d:/music:/media -t docker-one-container-radio:latest ``` +## Support Environment Variables +| Variable | Type | Description | +|--------------|:-----:|:-----:| +| ICES_NAME | Str | +| ICECAST_ADMIN_USER | Str | +| ICECAST_ADMIN_EMAIL | Str | +| ICECAST_ADMIN_PASSWORD | Str | ## To Do ## - - [ ] Update parameters for username and passwords + - [ x ] Update parameters for username and passwords - [ ] Add Customizations - - [ ] Update Readme - - [ ] Add Parameters + - [ x ] Update Readme + - [ x ] Add Parameters - [ ] Build Docker Compose (other forms to deploy) - [ ] Modify exposed volumes for log access / addition information diff --git a/start-icecast.sh b/start-icecast.sh index 7a1b5d8..b98b4ee 100644 --- a/start-icecast.sh +++ b/start-icecast.sh @@ -1,5 +1,44 @@ #!/bin/bash +env + +set -x + +set_val_ices() { + if [ -n "$2" ]; then + echo "set '$2' to '$1'" + sed -i "s/<$2>[^<]*<\/$2>/<$2>$1<\/$2>/g" /ices.xml + else + echo "Setting for '$1' is missing, skipping." >&2 + fi +} + +set_val() { + if [ -n "$2" ]; then + echo "set '$2' to '$1'" + sed -i "s/<$2>[^<]*<\/$2>/<$2>$1<\/$2>/g" /etc/icecast2/icecast.xml + else + echo "Setting for '$1' is missing, skipping." >&2 + fi +} + +# TB Added in future - will change how this is processed. +# set_val $ICES_GENRE genre +# set_val $ICES_DESC description +# set_val $ICES_PORT port +set_val_ices $ICES_NAME name +# set_val_ices $ICES_HOSTNAME hostname +# set_val_ices $ICES_PASSWORD password +# set_val $ICECAST_SOURCE_PASSWORD source-password +# set_val $ICECAST_RELAY_PASSWORD relay-password +set_val $ICECAST_ADMIN_PASSWORD admin-password +set_val $ICECAST_ADMIN_USER admin-user +set_val $ICECAST_ADMIN_EMAIL admin +# set_val $ICECAST_PASSWORD password +# set_val $ICECAST_HOSTNAME hostname + +set -e + sudo -Eu icecast2 icecast2 -n -c /etc/icecast2/icecast.xml & bash ./start-ices.sh