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:
parent
3715c7aadd
commit
8dc50a5d31
@ -74,9 +74,9 @@ If you choose to use MySQL instead of PostgreSQL, you should set a different dat
|
|||||||
Don't forget to replace all entries (beginning by `MM_` and `DB_`) in `MM_SQLSETTINGS_DATASOURCE` with the real variables values.
|
Don't forget to replace all entries (beginning by `MM_` and `DB_`) in `MM_SQLSETTINGS_DATASOURCE` with the real variables values.
|
||||||
|
|
||||||
### Web server container
|
### Web server container
|
||||||
This image is optional, you should not use it you have your own reverse-proxy. It is a simple front Web server for the Mattermost app container.
|
This image is optional, you should **not** use it when you have your own reverse-proxy. It is a simple front Web server for the Mattermost app container. If you use the provided `docker-compose.yml` file, you don't have to configure anything. But if your application container is reachable on custom host and/or port (eg. if you use a container provider), you should add those two environment variables :
|
||||||
* `MATTERMOST_ENABLE_SSL`: whether to enable SSL
|
* `APP_HOST`: application host address
|
||||||
* `PLATFORM_PORT_80_TCP_PORT`: port that Mattermost image is listening on
|
* `APP_PORT_NUMBER`: application HTTP port
|
||||||
|
|
||||||
#### Install with SSL certificate
|
#### Install with SSL certificate
|
||||||
Put your SSL certificate as `./volumes/web/cert/cert.pem` and the private key that has
|
Put your SSL certificate as `./volumes/web/cert/cert.pem` and the private key that has
|
||||||
|
@ -45,7 +45,7 @@ services:
|
|||||||
- "443:443"
|
- "443:443"
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
volumes:
|
volumes:
|
||||||
# This directory must have cert files
|
# This directory must have cert files if you want to enable SSL
|
||||||
- ./volumes/web/cert:/cert:ro
|
- ./volumes/web/cert:/cert:ro
|
||||||
- /etc/localtime:/etc/localtime:ro
|
- /etc/localtime:/etc/localtime:ro
|
||||||
# Uncomment for SSL
|
# Uncomment for SSL
|
||||||
|
@ -1,9 +1,22 @@
|
|||||||
#!/bin/bash
|
#!/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
|
if [ -f "/cert/cert.pem" -a -f "/cert/key-no-password.pem" ]; then
|
||||||
echo "found certificate and key, linking ssl config"
|
echo "found certificate and key, linking ssl config"
|
||||||
ssl="-ssl"
|
ssl="-ssl"
|
||||||
else
|
else
|
||||||
echo "linking plain config"
|
echo "linking plain config"
|
||||||
fi
|
fi
|
||||||
|
# Linking Nginx configuration file
|
||||||
ln -s /etc/nginx/sites-available/mattermost$ssl /etc/nginx/conf.d/mattermost.conf
|
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;'
|
nginx -g 'daemon off;'
|
||||||
|
@ -18,7 +18,7 @@ server {
|
|||||||
proxy_buffers 256 16k;
|
proxy_buffers 256 16k;
|
||||||
proxy_buffer_size 16k;
|
proxy_buffer_size 16k;
|
||||||
proxy_read_timeout 600s;
|
proxy_read_timeout 600s;
|
||||||
proxy_pass http://app:80;
|
proxy_pass http://{%APP_HOST%}:{%APP_PORT%};
|
||||||
}
|
}
|
||||||
|
|
||||||
location / {
|
location / {
|
||||||
@ -34,6 +34,6 @@ server {
|
|||||||
proxy_buffers 256 16k;
|
proxy_buffers 256 16k;
|
||||||
proxy_buffer_size 16k;
|
proxy_buffer_size 16k;
|
||||||
proxy_read_timeout 600s;
|
proxy_read_timeout 600s;
|
||||||
proxy_pass http://app:80;
|
proxy_pass http://{%APP_HOST%}:{%APP_PORT%};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -34,7 +34,7 @@ server {
|
|||||||
proxy_buffers 256 16k;
|
proxy_buffers 256 16k;
|
||||||
proxy_buffer_size 16k;
|
proxy_buffer_size 16k;
|
||||||
proxy_read_timeout 600s;
|
proxy_read_timeout 600s;
|
||||||
proxy_pass http://app:80;
|
proxy_pass http://{%APP_HOST%}:{%APP_PORT%};
|
||||||
}
|
}
|
||||||
|
|
||||||
location / {
|
location / {
|
||||||
@ -51,7 +51,7 @@ server {
|
|||||||
proxy_buffers 256 16k;
|
proxy_buffers 256 16k;
|
||||||
proxy_buffer_size 16k;
|
proxy_buffer_size 16k;
|
||||||
proxy_read_timeout 600s;
|
proxy_read_timeout 600s;
|
||||||
proxy_pass http://app:80;
|
proxy_pass http://{%APP_HOST%}:{%APP_PORT%};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user