Skip to content

Commit ba17f25

Browse files
committed
2 parents b8abc7a + 1bdadfe commit ba17f25

File tree

3 files changed

+13
-16
lines changed

3 files changed

+13
-16
lines changed

Diff for: docker-compose.yml

+3-2
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,9 @@ services:
7272
#
7373
########################################################################################
7474

75-
# There's some apache fixes that are applied here so that you can expose the site on the internet - Specify the public FQDN name of your server here.
76-
- "EXTERNAL_HOSTNAME=${EXTERNAL_HOSTNAME-localhost}"
75+
# There's some apache fixes that are applied here so that you can expose the site on the internet - Specify the public FQDN name of your server using the EXTERNAL_HOSTNAME variable in your .env file.
76+
- EXTERNAL_HOSTNAME=${EXTERNAL_HOSTNAME-localhost}
77+
- WEB_UI_PORT=${WEB_UI_PORT-8882}
7778

7879
# Don't change these unless you change their values in the `libretime-rabbitmq` block.
7980
- RABBITMQ_DEFAULT_USER=${RABBITMQ_DEFAULT_USER-libretime}

Diff for: libretime-core/bootstrap/entrypoint.sh

+9-13
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,6 @@ AIRTIME_APACHE_CONFIG="/etc/apache2/sites-enabled/airtime.conf"
55
# Script that is executed to apply further customizations to airtime.
66
CUSTOMISATIONS_SCRIPT="/etc/airtime-customisations/run.sh"
77

8-
# Airtime seems to expect the hostname of 'airtime' to be set to properly function...
9-
echo "127.0.0.1 airtime libretime" >> /etc/hosts
10-
118
function setConfigFromEnvironments {
129

1310
# RabbitMQ
@@ -36,21 +33,20 @@ function setConfigFromEnvironments {
3633

3734
function apacheFixes() {
3835

39-
if ! grep -q 'BEGIN:LOCALHOSTFIX--' "$AIRTIME_APACHE_CONFIG"
36+
if ! grep -q 'BEGIN:WEBPORTFIX--' "$AIRTIME_APACHE_CONFIG"
4037
then
4138

4239
# Add in a "Substitute" filter to apache to strip out localhost references on the fly...
43-
sed -i 's^.*</VirtualHost>.*^ # Quick fix for iframes that reference hard coded localhost in paths.\n # BEGIN:LOCALHOSTFIX--\n <Location "/">\n SetOutputFilter SUBSTITUTE;DEFLATE\n AddOutputFilterByType SUBSTITUTE text/html\n Substitute "s|http://localhost//|/|ni"\n Substitute "s|https://localhost//|/|ni"\n Substitute "s|http://localhost/|/|ni"\n Substitute "s|https://localhost/|/|ni"\n </Location>\n&^' "$AIRTIME_APACHE_CONFIG"
40+
sed -i 's^.*</VirtualHost>.*^ # Quick fix for iframes and assets that load the EXTERNAL_HOSTNAME without a port.\n # BEGIN:WEBPORTFIX--\n <Location "/">\n SetOutputFilter SUBSTITUTE;DEFLATE\n AddOutputFilterByType SUBSTITUTE text/html\n Substitute "s|'$EXTERNAL_HOSTNAME'/embed|'$EXTERNAL_HOSTNAME':'$WEB_UI_PORT'/embed|ni"\n Substitute "s|'$EXTERNAL_HOSTNAME'/js|'$EXTERNAL_HOSTNAME':'$WEB_UI_PORT'/js|ni"\n Substitute "s|'$EXTERNAL_HOSTNAME'//css|'$EXTERNAL_HOSTNAME':'$WEB_UI_PORT'//css|ni"\n Substitute "s|'$EXTERNAL_HOSTNAME'/css|'$EXTERNAL_HOSTNAME':'$WEB_UI_PORT'/css|ni"\n Substitute "s|'$EXTERNAL_HOSTNAME'/widgets|'$EXTERNAL_HOSTNAME':'$WEB_UI_PORT'/widgets|ni"\n Substitute "s|'$EXTERNAL_HOSTNAME'/api|'$EXTERNAL_HOSTNAME':'$WEB_UI_PORT'/api|ni"\n </Location>\n&^' "$AIRTIME_APACHE_CONFIG"
4441

4542
a2enmod substitute
4643
fi
44+
}
4745

48-
if ! grep -q "$EXTERNAL_HOSTNAME" "$AIRTIME_APACHE_CONFIG"
49-
then
50-
# Fix localhost on "Radio Embed Page"
51-
sed -i 's^.*</Location>.*^ Substitute "s|http:\\/\\/localhost:8000|http:\\/\\/'"$EXTERNAL_HOSTNAME"'|ni"\n&^' "$AIRTIME_APACHE_CONFIG"
52-
fi
53-
46+
function fqdnFixes() {
47+
# Airtime seems to expect the hostname of 'airtime' to be set to properly function...
48+
# EXTERNAL_HOSTNAME necessary in order to connect to icecast when setting custom output streams
49+
echo "127.0.0.1 airtime libretime $EXTERNAL_HOSTNAME" >> /etc/hosts
5450
}
5551

5652
function customisations() {
@@ -66,13 +62,13 @@ if [ ! -f "$AIRTIME_CONFIG_FILE" ]; then
6662
/opt/libretime/firstrun.sh
6763

6864
# update config based on environment variables...
69-
setConfigFromEnvironments && apacheFixes && customisations
65+
setConfigFromEnvironments && apacheFixes && customisations && fqdnFixes
7066

7167
# Start everything up :)
7268
/usr/bin/supervisord
7369
else
7470
# Check (and update if required) any config based on environment variables..
75-
setConfigFromEnvironments && apacheFixes && customisations
71+
setConfigFromEnvironments && apacheFixes && customisations && fqdnFixes
7672

7773
# We're already installed - just run supervisor..
7874
/usr/bin/supervisord

Diff for: libretime-core/bootstrap/firstrun.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ curl -H 'Content-Type: application/x-www-form-urlencoded; charset=UTF-8' \
2525
# Web Interface
2626
curl -H 'Content-Type: application/x-www-form-urlencoded; charset=UTF-8' \
2727
-H 'Accept: application/json, text/javascript, */*; q=0.01' \
28-
--data "generalHost=localhost&generalPort=80&generalErr=" \
28+
--data "generalHost=$EXTERNAL_HOSTNAME&generalPort=80&generalErr=" \
2929
"http://${IP}/setup/setup-functions.php?obj=GeneralSetup"
3030

3131
# Media Settings

0 commit comments

Comments
 (0)