mattermost/mattermost-docker

what's going on with env variables?

felixsanz opened this issue · 1 comments

Hi, from the readme:

MM_USERNAME: database username
MM_PASSWORD: database password
MM_DBNAME: database name
DB_HOST: database host address
DB_PORT_NUMBER: database port
MM_SQLSETTINGS_DRIVERNAME : mysql

why some variables are MM_, another DB_, and another MM_SQLSETTINGS_? This is crazy!

This repository has quite some outdated code in it. MM_* variables are usually used by mattermost directly to replace settings from the config.json. The others are used by the entrypoint.sh. You only need either the MM_SQLSETTINGS_DATASOURCE or the MM_USERNAME and MM_PASSWORD (and optionally MM_DBNAME, DB_HOST and DB_PORT_NUMBER). The official docker images don't have these extra variables though. You can deploy the team-edition e. g. with the following docker-compose.yml:

version: "3"
volumes:
  db:
  config:
  data:
  logs:
  plugins:
  client-plugins:
services:
  db:
    image: postgres:12-alpine
    volumes:
      - db:/var/lib/postgresql/data
      - /etc/localtime:/etc/localtime:ro
    environment:
      - POSTGRES_DB=mattermost
      - POSTGRES_USER=mmuser
      - POSTGRES_PASSWORD=<PASSWORD>
    restart: always
  app:
    image: mattermost/mattermost-team-edition:release-5.25
    ports:
      - 127.0.0.1:8080:8065
    volumes:
      - config:/mattermost/config
      - data:/mattermost/data
      - logs:/mattermost/logs
      - plugins:/mattermost/plugins
      - client-plugins:/mattermost/client/plugins
      - /etc/localtime:/etc/localtime:ro
    environment:
      - MM_LOGSETTINGS_CONSOLELEVEL=ERROR
      - MM_SQLSETTINGS_DRIVERNAME=postgres
      - MM_SQLSETTINGS_DATASOURCE=postgres://mmuser:<PASSWORD>@db:5432/mattermost?sslmode=disable&connect_timeout=10
    restart: always