Allow to customize app host/port (#181)

Allow to use custom hostname and/or port value for app container from the Web
container. Usefull for some people using containers provider (eg. #142)
This commit is contained in:
Kyâne Pichou authored and GitHub committed 2017-10-26 21:16:09 +02:00
1 parent 3715c7aadd
commit 8dc50a5d31
5 files changed
+21 -8

No files matched your search

+13
View File
@@ -1,9 +1,22 @@
#!/bin/bash
# Define default value for app container hostname and port
APP_HOST=${APP_HOST:-app}
APP_PORT_NUMBER=${APP_PORT_NUMBER:-80}
# Check if SSL should be enabled (if certificates exists)
if [ -f "/cert/cert.pem" -a -f "/cert/key-no-password.pem" ]; then
echo "found certificate and key, linking ssl config"
ssl="-ssl"
else
echo "linking plain config"
fi
# Linking Nginx configuration file
ln -s /etc/nginx/sites-available/mattermost$ssl /etc/nginx/conf.d/mattermost.conf
# Setup app host and port on configuration file
sed -i "s/{%APP_HOST%}/${APP_HOST}/g" /etc/nginx/conf.d/mattermost.conf
sed -i "s/{%APP_PORT%}/${APP_PORT_NUMBER}/g" /etc/nginx/conf.d/mattermost.conf
# Run Nginx
nginx -g 'daemon off;'
+2 -2
View File
@@ -18,7 +18,7 @@ server {
proxy_buffers 256 16k;
proxy_buffer_size 16k;
proxy_read_timeout 600s;
proxy_pass http://app:80;
proxy_pass http://{%APP_HOST%}:{%APP_PORT%};
}
location / {
@@ -34,6 +34,6 @@ server {
proxy_buffers 256 16k;
proxy_buffer_size 16k;
proxy_read_timeout 600s;
proxy_pass http://app:80;
proxy_pass http://{%APP_HOST%}:{%APP_PORT%};
}
}
+2 -2
View File
@@ -34,7 +34,7 @@ server {
proxy_buffers 256 16k;
proxy_buffer_size 16k;
proxy_read_timeout 600s;
proxy_pass http://app:80;
proxy_pass http://{%APP_HOST%}:{%APP_PORT%};
}
location / {
@@ -51,7 +51,7 @@ server {
proxy_buffers 256 16k;
proxy_buffer_size 16k;
proxy_read_timeout 600s;
proxy_pass http://app:80;
proxy_pass http://{%APP_HOST%}:{%APP_PORT%};
}
}