0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Mattermostをdockerで立てる

0
Posted at

Mattermost を docker-compose で起こしてみました

ちなみに、postgreSQLのバージョンは18.3です

DB側の設定

今回は、postgreSQLを使います。
Mattermost 用のDBとユーザを作ります

CREATE USER mattermost_user WITH PASSWORD 'xxxxxx';
CREATE DATABASE mattermostdb OWNER mattermost_user;
GRANT ALL PRIVILEGES ON DATABASE mattermostdb TO mattermost_user;

docker-compose.yml

Mattermost は61006ポートで待ち受けることにしました。
また、mattermost のディレクトリ付きにしています

vi docker-compose.yml
services:
  mattermost:
    image: mattermost/mattermost-team-edition:latest
    container_name: mattermost
    restart: always
    ports:
      - "61006:8065"
    environment:
      - MM_SERVICESETTINGS_SITEURL=${MM_SITE_URL}
      - MM_SQLSETTINGS_DRIVERNAME=postgres
      - MM_SQLSETTINGS_DATASOURCE=postgres://${MM_DB_USER}:${MM_DB_PASSWORD}@${MM_DB_POSTGRES}:5432/${MM_DB_NAME}?sslmode=disable&connect_timeout=10
    volumes:
      - ./.docker/mattermost/config:/mattermost/config
      - ./.docker/mattermost/data:/mattermost/data
      - ./.docker/mattermost/logs:/mattermost/logs
      - ./.docker/mattermost/plugins:/mattermost/plugins
      - ./.docker/mattermost/client-plugins:/mattermost/client/plugins
      - /etc/localtime:/etc/localtime:ro # OS時刻情報連携

エラーがでた。。。

Error: failed to load configuration: could not create config file: open /mattermost/config/config.json: permission denied

権限が無いようなので、以下で設定します

# 所有者を Mattermostコンテナの標準ユーザー (UID: 2000) に変更
sudo chown -R 2000:2000 ./.docker/mattermost

# 念のため、書き込み権限も付与
sudo chmod -R 700 ./.docker/mattermost

再起動したら、つながりました

参考

vi .env
MM_DB_USER=mattermost_user
MM_DB_PASSWORD=xxxxxx
MM_DB_NAME=mattermostdb
MM_SITE_URL=http://192.168.x.x/mattermost
MM_DB_POSTGRES=192.168.x.x

nginx側からのアクセス設定

vi nginx/conf.d/default.conf
    # /mattermost へのリクエストを mattermostコンテナへ転送
    location /mattermost/ {
        proxy_pass http://192.168.x.x:61006;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_set_header X-Frame-Options "SAMEORIGIN";
        proxy_set_header Upgrade $http_upgrade; # WebSocket用
        proxy_set_header Connection "upgrade";  # WebSocket用

        # スタイルシートやJSの読み込み対策
        proxy_redirect off;
    }

完成

image.png

image.png

感想など

難しいとこは無いですね。
このあと使ってみます

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?