Just want to describe my setup to run Mattermost using the Docker setup together with nginx-proxy in front of Mattermost. Since v3.7.1 the Mattermost Docker setup creates it's own network for communication between containers. nginx-proxy needs to know about this network. That means you need to find the network and connect it to nginx-proxy:
docker network ls
# Grep the name of your Mattermost network like "mymattermost_default".
docker network connect mymattermost_default nginx-proxy
Now restart the Mattermost app container (or web if using it) to get nginx-proxy configured correctly:
docker-compose stop app
docker-compose start app
BTW: With nginx-proxy there is no need to run the web container. My docker-compose.yml looks like this:
version: "2"
services:
db:
build: db
restart: unless-stopped
volumes:
- ./volumes/db/var/lib/postgresql/data:/var/lib/postgresql/data
- /etc/localtime:/etc/localtime:ro
environment:
- POSTGRES_USER=mmuser
- POSTGRES_PASSWORD=mmuser_password
- POSTGRES_DB=mattermost
# uncomment the following to enable backup
# - AWS_ACCESS_KEY_ID=XXXX
# - AWS_SECRET_ACCESS_KEY=XXXX
# - WALE_S3_PREFIX=s3://BUCKET_NAME/PATH
# - AWS_REGION=us-east-1
# in case your config is not in default location
# - MM_CONFIG=/mattermost/config/config.jso
app:
build:
context: app
# comment out for team edition
#dockerfile: Dockerfile-enterprise
restart: unless-stopped
volumes:
- ./volumes/app/mattermost/config:/mattermost/config:rw
- ./volumes/app/mattermost/data:/mattermost/data:rw
- ./volumes/app/mattermost/logs:/mattermost/logs:rw
- /etc/localtime:/etc/localtime:ro
environment:
# set same as db credentials and dbname
- MM_USERNAME=mmuser
- MM_PASSWORD=mmuser_password
- MM_DBNAME=mattermost
- VIRTUAL_HOST=mymattermost.tld
- LETSENCRYPT_HOST=mymattermost.tld
- LETSENCRYPT_EMAIL=me@mymattermost.tld
expose:
- "80"
depends_on:
- db
Notes:
- Important changes are the VIRTUAL_HOST environment variable and the expose directive which tells nginx-proxy where to connect to the Mattermost backend.
- I'm using the LetsEncrypt companion container for nginx-proxy for automatic Let's Encrypt certs.
- You may customize the nginx-proxy settings as described at their Github page (can not post the link because as new user to this forum I'm not allowed to post mor than 2 links). For instance the Mattermost nginx is configured with
client_max_body_size 50M;
. - The network needs to be connected manually this way. To automatize this you may create a independent network before and use it together with nginx-proxy. See docker-compose documentation regarding using external networks.