mattermost / mattermost/docker

error while interpolating services.mattermost.read_only

Open
#108 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Shell
Stars
533
Forks
284
PR merge metrics
No merged PRs in 30d

Description

Hello there,

I get the following error message, when I try to run sudo docker-compose -f docker-compose.yml -f docker-compose.without-nginx.yml up -d:

WARN[0000] The "POSTGRES_IMAGE_TAG" variable is not set. Defaulting to a blank string.
WARN[0000] The "RESTART_POLICY" variable is not set. Defaulting to a blank string.
WARN[0000] The "POSTGRES_DATA_PATH" variable is not set. Defaulting to a blank string.
WARN[0000] The "RESTART_POLICY" variable is not set. Defaulting to a blank string.
WARN[0000] The "MATTERMOST_IMAGE" variable is not set. Defaulting to a blank string.
WARN[0000] The "MATTERMOST_IMAGE_TAG" variable is not set. Defaulting to a blank string.
WARN[0000] The "MATTERMOST_CONFIG_PATH" variable is not set. Defaulting to a blank string.
WARN[0000] The "MATTERMOST_DATA_PATH" variable is not set. Defaulting to a blank string.
WARN[0000] The "MATTERMOST_LOGS_PATH" variable is not set. Defaulting to a blank string.
WARN[0000] The "MATTERMOST_PLUGINS_PATH" variable is not set. Defaulting to a blank string.
WARN[0000] The "MATTERMOST_CLIENT_PLUGINS_PATH" variable is not set. Defaulting to a blank string.
WARN[0000] The "MATTERMOST_BLEVE_INDEXES_PATH" variable is not set. Defaulting to a blank string.
WARN[0000] The "MATTERMOST_CONTAINER_READONLY" variable is not set. Defaulting to a blank string.
error while interpolating services.mattermost.read_only: failed to cast to expected type: invalid boolean:

My .env-file contains the following code:

# Domain of service
DOMAIN=my.sub.domain.de

# Container settings
## Timezone inside the containers. The value needs to be in the form 'Europe/Berlin'.
## A list of these tz database names can be looked up at Wikipedia
## https://en.wikipedia.org/wiki/List_of_tz_database_time_zones

TZ=Europe/Berlin

RESTART_POLICY=unless-stopped

# Postgres settings
## Documentation for this image and available settings can be found on hub.docker.com
## https://hub.docker.com/_/postgres
## Please keep in mind this will create a superuser and it's recommended to use a less privileged
## user to connect to the database.
## A guide on how to change the database user to a nonsuperuser can be found in docs/creation-of-nonsuperuser.md

POSTGRES_IMAGE_TAG=13-alpine
POSTGRES_DATA_PATH=./volumes/db/var/lib/postgresql/data
POSTGRES_USER=username
POSTGRES_PASSWORD=password
POSTGRES_DB=mattermost

## Exposed ports to the host. Inside the container 80 and 443 will be used
HTTPS_PORT=443
HTTP_PORT=80

# Mattermost settings
## Inside the container the uid and gid is 2000. The folder owner can be set with
## `sudo chown -R 2000:2000 ./volumes/app/mattermost`.

MATTERMOST_CONFIG_PATH=./volumes/app/mattermost/config
MATTERMOST_DATA_PATH=./volumes/app/mattermost/data
MATTERMOST_LOGS_PATH=./volumes/app/mattermost/logs
MATTERMOST_PLUGINS_PATH=./volumes/app/mattermost/plugins
MATTERMOST_CLIENT_PLUGINS_PATH=./volumes/app/mattermost/client/plugins
MATTERMOST_BLEVE_INDEXES_PATH=./volumes/app/mattermost/bleve-indexes

## Bleve index (inside the container)
MM_BLEVESETTINGS_INDEXDIR=/mattermost/bleve-indexes

## This will be 'mattermost-enterprise-edition' or 'mattermost-team-edition' based on the version of Mattermost you're installing.
MATTERMOST_IMAGE=mattermost-team-edition
MATTERMOST_IMAGE_TAG=7.1

## Make Mattermost container readonly. This interferes with the regeneration of root.html inside the container. Only use
## it if you know what you're doing.
## See https://github.com/mattermost/docker/issues/18
MATTERMOST_CONTAINER_READONLY=false

## The app port is only relevant for using Mattermost without the nginx container as reverse proxy. This is not meant
## to be used with the internal HTTP server exposed but rather in case one wants to host several services on one host
## or for using it behind another existing reverse proxy.
APP_PORT=8065

## Configuration settings for Mattermost. Documentation on the variables and the settings itself can be found at
## https://docs.mattermost.com/administration/config-settings.html
## Keep in mind that variables set here will take precedence over the same setting in config.json. This includes
## the system console as well and settings set with env variables will be greyed out.
## Below one can find necessary settings to spin up the Mattermost container
MM_SQLSETTINGS_DRIVERNAME=postgres
MM_SQLSETTINGS_DATASOURCE=postgres://${POSTGRES_USER}:${POSTGRES_PASSWORD}@postgres:5432/${POSTGRES_DB}?sslmode=disable&connect_timeout=10
## Example settings (any additional setting added here also needs to be introduced in the docker-compose.yml)
MM_SERVICESETTINGS_SITEURL=https://${DOMAIN}

My docker-compose.yml looks like this:

version: "3.8"

services:
  postgres:
    image: postgres:${POSTGRES_IMAGE_TAG}
    restart: ${RESTART_POLICY}
    security_opt:
      - no-new-privileges:true
    pids_limit: 100
    read_only: true
    tmpfs:
      - /tmp
      - /var/run/postgresql
    volumes:
      - ${POSTGRES_DATA_PATH}:/var/lib/postgresql/data
    environment:
      # timezone inside container
      - TZ

      # necessary Postgres options/variables
      - POSTGRES_USER
      - POSTGRES_PASSWORD
      - POSTGRES_DB
    labels:
      - traefik.enable="false"
    networks:
      - default

  mattermost:
    depends_on:
      - postgres
    image: mattermost/${MATTERMOST_IMAGE}:${MATTERMOST_IMAGE_TAG}
    restart: ${RESTART_POLICY}
    security_opt:
      - no-new-privileges:true
    pids_limit: 200
    read_only: ${MATTERMOST_CONTAINER_READONLY}
    tmpfs:
      - /tmp
    volumes:
      - ${MATTERMOST_CONFIG_PATH}:/mattermost/config:rw
      - ${MATTERMOST_DATA_PATH}:/mattermost/data:rw
      - ${MATTERMOST_LOGS_PATH}:/mattermost/logs:rw
      - ${MATTERMOST_PLUGINS_PATH}:/mattermost/plugins:rw
      - ${MATTERMOST_CLIENT_PLUGINS_PATH}:/mattermost/client/plugins:rw
      - ${MATTERMOST_BLEVE_INDEXES_PATH}:/mattermost/bleve-indexes:rw
    environment:
      # timezone inside container
      - TZ

      # necessary Mattermost options/variables (see env.example)
      - MM_SQLSETTINGS_DRIVERNAME
      - MM_SQLSETTINGS_DATASOURCE

      # necessary for bleve
      - MM_BLEVESETTINGS_INDEXDIR

      # additional settings
      - MM_SERVICESETTINGS_SITEURL
    labels:
      traefik.enable: "true"
      traefik.http.routers.mattermost.entrypoints: "http"
      traefik.http.routers.mattermost.rule: "Host(`my.sub.domain.de`)"
      traefik.http.middlewares.mattermost-https-redirect.redirectscheme.scheme: "https"
      traefik.http.routers.mattermost.middlewares: "mattermost-https-redirect"
      traefik.http.routers.mattermost-secure.entrypoints: "https"
      traefik.http.routers.mattermost-secure.rule: "Host(`my.sub.domain.de`)"
      traefik.http.routers.mattermost-secure.tls: "true"
      traefik.http.routers.mattermost-secure.tls.certresolver: "http"
      traefik.http.routers.mattermost-secure.service: "mattermost"
      traefik.http.services.mattermost.loadbalancer.server.port: "80"
      traefik.docker.network: "proxy"
    networks:
      - default
      - proxy

Weirdly enough, when I run the docker-compose.yml twice, I get a slightly different error message:

WARN[0000] The "RESTART_POLICY" variable is not set. Defaulting to a blank string.
WARN[0000] The "POSTGRES_DATA_PATH" variable is not set. Defaulting to a blank string.
WARN[0000] The "POSTGRES_IMAGE_TAG" variable is not set. Defaulting to a blank string.
WARN[0000] The "MATTERMOST_IMAGE" variable is not set. Defaulting to a blank string.
WARN[0000] The "MATTERMOST_IMAGE_TAG" variable is not set. Defaulting to a blank string.
WARN[0000] The "MATTERMOST_CONTAINER_READONLY" variable is not set. Defaulting to a blank string.
error while interpolating services.mattermost.read_only: failed to cast to expected type: invalid boolean:

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with docker-compose.yml and docker-compose.without-nginx.yml, then verify how the .env file is discovered when running the supplied docker-compose command. Reproduce the interpolation failure and inspect services.mattermost.read_only alongside MATTERMOST_CONTAINER_READONLY. Done means the documented command parses both compose files without the invalid-boolean error.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, docker-compose
Domain
devops, infrastructure
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.