services:

  app:
    image: mattermost/mattermost-team-edition:9.10
    container_name: ${mattermostServName}
    restart: ${restartPolicy}
    # memory: 1G
    # disk_quota: 256M
    volumes:
      - matterConfig:/mattermost/config:rw
#      - matterConfigLangSrv:/mattermost/i18n:rw
#      - matterConfigLangClt:/mattermost/client/i18n:rw      
      - matterData:/mattermost/data:rw
      - matterLogs:/mattermost/logs:rw
      - matterPlugins:/mattermost/plugins:rw
      - matterClientPlugins:/mattermost/client/plugins:rw
#      - matterIcons:/mattermost/client/images/
#      - matterI18n:/mattermost/i18n:rw
      - /etc/ssl:/etc/ssl:ro
      - /etc/localtime:/etc/localtime:ro
      - /etc/timezone:/etc/timezone:ro
      - /etc/environment:/etc/environment:ro
    env_file:
      - ../../secret/env-${mattermostServName}
    environment:
      - VIRTUAL_HOST=mattermost.${domain}
      - MM_PASSWORDSETTINGS_MINIMUMLENGTH=10
      - MM_PASSWORDSETTINGS_LOWERCASE=false
      - MM_PASSWORDSETTINGS_UPPERCASE=false
      - MM_PASSWORDSETTINGS_NUMBER=false
      - MM_PASSWORDSETTINGS_SYMBOL=true
      # in case your config is not in default location
      #- MM_CONFIG=/mattermost/config/config.json

    depends_on:
      - db
    links:
      - db
    expose:
      - ${matterPort}
    # ports:
    #   - 8089:80
    networks:
      - mattermostNet
      - postfixNet
    external_links:
      - ${smtpServName}:${smtpHost}.${domain}
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.${mattermostServName}.rule=Host(`${matterHost}.${domain}`)"
      - "traefik.http.services.${mattermostServName}.loadbalancer.server.port=${matterPort}"
      - "traefik.docker.network=mattermostNet"
    healthcheck:
      test: ["CMD", "curl", "-f", "http://app:${matterPort}"]
      interval: 20s
      retries: 10
      start_period: 20s
      timeout: 10s

  db:
    image: mariadb:10.5
    container_name: ${mattermostDBName}
    restart: ${restartPolicy}
    networks:
      - mattermostNet
    env_file:
      - ../../secret/env-${mattermostDBName}
    volumes:
      - matterDB:/var/lib/mysql
      - /home/sauve/:/svg/
      - /etc/localtime:/etc/localtime:ro
      - /etc/timezone:/etc/timezone:ro

volumes:
  matterDB:
  matterConfig:
  matterData:
  matterLogs:
  matterPlugins:
  matterClientPlugins:
  matterConfigLangSrv:
  matterConfigLangClt:
#  matterI18n:
#  matterIcons:

networks:
  mattermostNet:
    external: true
    name: mattermostNet
  postfixNet:
    external: true
    name: postfixNet
