3
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Raspberry Pi 3 に Mattermost を構築する

Posted at

Raspberry Pi 3上にMattermostを構築したい。

参考にしたサイト

RaspberryPi3上にMattermostをインストールする方法
Mattermost公式:Administrator’s Guide

MariaDBの設定

MariaDBのインストール

これは既にインストール済みだったので割愛します。
MySQLをインストールしようとしたら、MariaDBに置き換わりました。
基本的にMySQLと思って作業して大丈夫でした。

MariaDBの設定

ルートのパスワードを要求されます。
MariaDB作成時に設定しているはずです。

$ sudo mysql -u root -p
Enter password: 
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 44
Server version: 10.3.22-MariaDB-0+deb10u1 Raspbian 10

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> 

mmuser というユーザーを作成します。
パスワードは自分で設定します。
ちゃんと作成できるか確認しておきます。

MariaDB [(none)]> create user 'mmuser'@'%' identified by ‘your-password‘
    -> ;
Query OK, 0 rows affected (0.081 sec)

MariaDB [(none)]> 
MariaDB [(none)]> select user,host from mysql.user;
+--------+-----------+
| user   | host      |
+--------+-----------+
| mmuser | %         |
| root   | localhost |
+--------+-----------+
2 rows in set (0.006 sec)

MariaDB [(none)]> 

mattermost というDBを作成して、その他の設定を行います。
終わったら exit でMariaDBからログアウトします。

MariaDB [(none)]> create database mattermost;
Query OK, 1 row affected (0.005 sec)

MariaDB [(none)]> 
MariaDB [(none)]> grant all privileges on mattermost.* to 'mmuser'@'%';
Query OK, 0 rows affected (0.005 sec)

MariaDB [(none)]> 
MariaDB [(none)]> GRANT ALTER, CREATE, DELETE, DROP, INDEX, INSERT, SELECT, UPDATE ON mattermost.* TO 'mmuser'@'%';
Query OK, 0 rows affected (0.008 sec)

MariaDB [(none)]> 
MariaDB [(none)]> exit

Mattermostの導入

Mattermostですが、Raspberry Pi 3にインストールしようとすると、公式からはできません。
何故かと言うと、64bitではないからです。

$ getconf LONG_BIT
32

そのため、以下の通り32bit対応しているサイトからダウンロードします。

$ wget https://github.com/SmartHoneybee/ubiquitous-memory/releases/download/untagged-e5b3d8052fc39cbf9f41/mattermost-4.10.0-arm.tar.gz
--2020-04-25 20:07:11--  https://github.com/SmartHoneybee/ubiquitous-memory/releases/download/untagged-e5b3d8052fc39cbf9f41/mattermost-4.10.0-arm.tar.gz
github.com (github.com) をDNSに問いあわせています... 52.192.72.89
github.com (github.com)|52.192.72.89|:443 に接続しています... 接続しました。
HTTP による接続要求を送信しました、応答を待っています... 302 Found
場所: https://github-production-release-asset-2e65be.s3.amazonaws.com/107789421/d48fbbec-58dd-11e8-92a4-110280b0c291?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20200425%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20200425T110717Z&X-Amz-Expires=300&X-Amz-Signature=66c4852c7f282b3a477c3d42fe1a8d232b1113560e9125b2b63f4aff30c22e60&X-Amz-SignedHeaders=host&actor_id=0&repo_id=107789421&response-content-disposition=attachment%3B%20filename%3Dmattermost-4.10.0-arm.tar.gz&response-content-type=application%2Foctet-stream [続く]
--2020-04-25 20:07:17--  https://github-production-release-asset-2e65be.s3.amazonaws.com/107789421/d48fbbec-58dd-11e8-92a4-110280b0c291?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20200425%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20200425T110717Z&X-Amz-Expires=300&X-Amz-Signature=66c4852c7f282b3a477c3d42fe1a8d232b1113560e9125b2b63f4aff30c22e60&X-Amz-SignedHeaders=host&actor_id=0&repo_id=107789421&response-content-disposition=attachment%3B%20filename%3Dmattermost-4.10.0-arm.tar.gz&response-content-type=application%2Foctet-stream
github-production-release-asset-2e65be.s3.amazonaws.com (github-production-release-asset-2e65be.s3.amazonaws.com) をDNSに問いあわせています... 52.216.10.67
github-production-release-asset-2e65be.s3.amazonaws.com (github-production-release-asset-2e65be.s3.amazonaws.com)|52.216.10.67|:443 に接続しています... 接続しました。
HTTP による接続要求を送信しました、応答を待っています... 200 OK
長さ: 38253617 (36M) [application/octet-stream]
`mattermost-4.10.0-arm.tar.gz' に保存中

mattermost-4.10.0-arm.tar.gz              100%[=====================================================================================>]  36.48M   338KB/s 時間 6m 3s    

2020-04-25 20:13:21 (103 KB/s) - `mattermost-4.10.0-arm.tar.gz' へ保存完了 [38253617/38253617]

wget でダウンロードができたら、解凍していきます。

$ tar -xvzf mattermost*.gz
mattermost/
mattermost/bin/
mattermost/bin/platform
mattermost/logs/
mattermost/config/
〜長いので省略〜
mattermost/client/main.9bbaf95cca8e85cd2584.js.map
mattermost/client/root.html
mattermost/MIT-COMPILED-LICENSE.md
mattermost/NOTICE.txt
mattermost/README.md

解凍できたら、残りの設定をしていきます。

$ sudo mv mattermost /opt
$ sudo mkdir /opt/mattermost/data
$ sudo useradd --system --user-group mattermost
$ sudo chown -R mattermost:mattermost /opt/mattermost
$ sudo chmod -R g+w /opt/mattermost

jsonファイルの中身を修正します。
SqlSettingsDataSource を修正します。
記載しているのは、変更後のものです。

$ sudo vi /opt/mattermost/config/config.json

“DataSource”: “mmuser:your-password@tcp(localhost:3306)/mattermost?charset=utf8mb4,utf8¥u0026readTimeout=30s¥u0026writeTimeout=30s”,

mattermostを起動させます。
起動には少しだけ時間がかかります。

$ cd /opt/mattermost
$ sudo -u mattermost ./bin/platform
{"level":"info","ts":1587815625.8077798,"caller":"utils/i18n.go:83","msg":"Loaded system translations for 'en' from '/opt/mattermost/i18n/en.json'"}
{"level":"info","ts":1587815625.809742,"caller":"app/app.go:181","msg":"Server is initializing..."}
{"level":"info","ts":1587815625.8209016,"caller":"sqlstore/supplier.go:198","msg":"Pinging SQL master database"}
{"level":"info","ts":1587815628.0340216,"caller":"sqlstore/upgrade.go:89","msg":"The database schema has been set to version 4.10.0"}
{"level":"info","ts":1587815632.1226985,"caller":"commands/server.go:73","msg":"Current version is 4.10.0 (dev-arm-tag4.10.0/Wed May 16 05:49:18 UTC 2018//none)"}
{"level":"info","ts":1587815632.1229966,"caller":"commands/server.go:74","msg":"Enterprise Enabled: false"}
{"level":"info","ts":1587815632.1232486,"caller":"commands/server.go:75","msg":"Current working directory is /opt/mattermost"}
{"level":"info","ts":1587815632.1234004,"caller":"commands/server.go:76","msg":"Loaded config file from /opt/mattermost/config/config.json"}
{"level":"info","ts":1587815632.1240351,"caller":"utils/file_backend_local.go:30","msg":"Able to write files to local storage."}
{"level":"info","ts":1587815632.1338358,"caller":"app/app.go:527","msg":"Migrating roles to database."}
{"level":"info","ts":1587815632.2322626,"caller":"sqlstore/post_store.go:1243","msg":"Post.Message supports at most 16383 characters (65535 bytes)"}
{"level":"info","ts":1587815632.4392831,"caller":"app/plugin.go:374","msg":"Starting up plugins"}
{"level":"warn","ts":1587815632.4402778,"caller":"app/plugin.go:404","msg":"plugin sandboxing is not supported. plugins will run with the same access level as the server. See documentation to learn more: https://developers.mattermost.com/extend/plugins/security/","error":"unsupported architecture"}
{"level":"info","ts":1587815632.4408529,"caller":"app/server.go:100","msg":"Starting Server..."}
{"level":"info","ts":1587815632.441362,"caller":"app/server.go:139","msg":"Server is listening on [::]:8065"}
{"level":"info","ts":1587815632.5323699,"caller":"app/web_hub.go:67","msg":"Starting 8 websocket hubs"}
{"level":"info","ts":1587815632.7220874,"caller":"jobs/workers.go:57","msg":"Starting workers"}
{"level":"info","ts":1587815632.7249198,"caller":"jobs/schedulers.go:62","msg":"Starting schedulers."}

立ち上がったら、Raspberry Pi 3のブラウザで、http://localhost:8065 でアクセスすればMattermostの画面が開きます。
別のPCからも、http://RaspberryPi3のIPアドレス:8065 でアクセスすれば開きます。

個人的つまづきポイント

  1. Mattermost公式からダウンロードした資材が64bit対応のため動かないことを知らなかった
  2. jsonファイルの修正で失敗していた。dockerhostを見る設定になっていて、そこの間違いに気づくまで時間を要した。
3
3
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
3
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?