LoginSignup
2
0

More than 1 year has passed since last update.

MattermostをWSL2でビルドする

Posted at

概要

Mattermostは,Slack風のチャットツールですが,オープンソースで一般公開されています.

本記事では,WSL2でMattermostをビルドするための手順を紹介します.

前提とする環境

  • OS
    • Windows10 Home or Pro
    • WSL2
  • Docker
    • Docker for Desktop
    • docker および docker-compose がインストールされている必要あります
  • 標準ツール類
    • make
    • git

ビルドする上で必要なツール類のインストール手順

Mattermostをビルドするために,以下をインストールする必要があります.

  • GO(v1.16.0)
  • nvm(v10.20.1)

GO のインストール

WSL2の ${HOME} 上で,goenv をインストールします.

$ git clone https://github.com/syndbg/goenv.git ~/.goenv
$ echo 'export GOENV_ROOT="$HOME/.goenv"' >> ~/.bashrc
$ echo 'export PATH="$GOENV_ROOT/bin:$PATH"' >> ~/.bashrc
$ echo 'eval "$(goenv init -)"' >> ~/.bashrc
$ echo 'export PATH="$GOROOT/bin:$PATH"' >> ~/.bashrc
$ echo 'export PATH="$PATH:$GOPATH/bin"' >> ~/.bashrc 
$ source .bashrc

次に,go を以下の手順でインストールします

$ goenv install 1.16.0
$ goenv global 1.16.0
$ goenv rehash

nvm のインストール

WSL2の ${HOME} 上で,nvm をインストールします.

$ curl https://raw.githubusercontent.com/creationix/nvm/master/install.sh | bash
$ source .bashrc
$ nvm install v10.20.1

Mattermostのビルド手順

2021/11/03 時点で,参考記事の Mattermostバージョンのソースを取得してビルドすると,docker image が存在せずエラーとなりましたので,ここでは v6.0.0 を使用します.

mattermostのソースは,任意のディレクトリ上にmattermostというディレクトリ作って,そこで以下のように clone します.

$ cd mattermost/
$ git clone https://github.com/mattermost/mattermost-server.git -b v6.0.0 --depth 1
$ git clone https://github.com/mattermost/mattermost-webapp.git -b v6.0.0 --depth 1

あとはビルドするだけ.

webapp 側のビルド手順

$ cd mattermost-webapp/
$ make clean
$ make -j4 build

server 側のビルド手順

server 側のビルドが終わると,Webサーバーが起動されます.

$ cd ../mattermost-server/
$ ln -nfs ../mattermost-webapp/dist client
$ make run-server

サーバーアクセス方法

まずは,WSL2のIPアドレスを確認しましょう.

$ $ ifconfig | grep -A1 eth0 | grep inet | awk '{print $2}'
172.24.36.25

Webブラウザ使って,http://<WSL2のIPアドレス>:8065/でアクセスします.
成功すると,以下のように,Mattermostの初期画面が見えます.

image.png

なお,サーバーを停止するには,mattermost-serverディレクトリ直下で,以下のコマンドを叩くことで停止します.

$ make stop-server

参考記事

2
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
2
0