Skip to content

Commit

Permalink
set EXTERNAL_HOSTNAME in install process, update apache config hack
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanrain committed Dec 10, 2018
1 parent 36318b8 commit fe9faa8
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 13 deletions.
5 changes: 3 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,9 @@ services:
#
########################################################################################

# 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.
- "EXTERNAL_HOSTNAME=${EXTERNAL_HOSTNAME-localhost}"
# 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.
- EXTERNAL_HOSTNAME=${EXTERNAL_HOSTNAME-localhost}
- WEB_UI_PORT=${WEB_UI_PORT-8882}

# Don't change these unless you change their values in the `libretime-rabbitmq` block.
- RABBITMQ_DEFAULT_USER=${RABBITMQ_DEFAULT_USER-libretime}
Expand Down
11 changes: 2 additions & 9 deletions libretime-core/bootstrap/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,21 +33,14 @@ function setConfigFromEnvironments {

function apacheFixes() {

if ! grep -q 'BEGIN:LOCALHOSTFIX--' "$AIRTIME_APACHE_CONFIG"
if ! grep -q 'BEGIN:WEBPORTFIX--' "$AIRTIME_APACHE_CONFIG"
then

# Add in a "Substitute" filter to apache to strip out localhost references on the fly...
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"
sed -i 's^.*</VirtualHost>.*^ # Quick fix for iframes that reference hard coded localhost in paths.\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"

a2enmod substitute
fi

if ! grep -q "$EXTERNAL_HOSTNAME" "$AIRTIME_APACHE_CONFIG"
then
# Fix localhost on "Radio Embed Page"
sed -i 's^.*</Location>.*^ Substitute "s|http:\\/\\/localhost:8000|http:\\/\\/'"$EXTERNAL_HOSTNAME"'|ni"\n&^' "$AIRTIME_APACHE_CONFIG"
fi

}

function fqdnFixes() {
Expand Down
4 changes: 2 additions & 2 deletions libretime-core/bootstrap/firstrun.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ curl -H 'Content-Type: application/x-www-form-urlencoded; charset=UTF-8' \
# Web Interface
curl -H 'Content-Type: application/x-www-form-urlencoded; charset=UTF-8' \
-H 'Accept: application/json, text/javascript, */*; q=0.01' \
--data "generalHost=localhost&generalPort=80&generalErr=" \
--data "generalHost=$EXTERNAL_HOSTNAME&generalPort=80&generalErr=" \
"http://${IP}/setup/setup-functions.php?obj=GeneralSetup"

# Media Settings
curl -H 'Content-Type: application/x-www-form-urlencoded; charset=UTF-8' \
-H 'Accept: application/json, text/javascript, */*; q=0.01' \
--data 'mediaFolder=%2Fexternal-media%2F&mediaErr=' \
"http://${IP}/setup/setup-functions.php?obj=MediaSetup"
"http://${IP}/setup/setup-functions.php?obj=MediaSetup"

0 comments on commit fe9faa8

Please sign in to comment.