Mattermost

Contents

Mattermostについて

公式サイト:https://mattermost.com/

Slackライクなチャットツールである。オープンソースとして配布されており、使用する際には自身でサーバを用意してインストールし、管理する必要がある。

SaaSとしても提供されており、エンタープライズ向けの有料版のほか、小チーム向けの無料版もある。

SaaS版ではない自己管理版でも有料プランと無料プランがあり、無料プランの場合に複数ユーザでグループを設定してそのグループに対してメンションできる機能が使用できない点が不便である。

そのため、どれだけユーザーが増えても無料であるが、データが増えてくると検索が遅くなってくるので、パフォーマンス改善対応や、障害時の対応等も必要になる。

ブラウザからも使用できるが、Slackと同様にデスクトップアプリやスマートフォンアプリもある。

 

環境

AWS EC2上に構築する。

 

サーバの構築

AWS上での設定

最小システム要件として以下が求めらている(参照)。
ただし、これは1000人以上の利用を想定したものなので、スモールスタートの場合はもっと小規模のサーバでよいと思われる。

EC2でサーバ作成後、詳細は割愛するが以下設定が追加で必要

 

メールでの通知を使用する場合、SMTPサーバが必要になる。同じサーバ上にPostfix等で構築してもよいが、複数のサービスでメール送信を行う予定ならAmazon SESを使用すると管理が楽である。

なお、EC2からメールをインターネット上に送信する場合はAWSで許可申請が必要になる。

 

rootになる

各設定を始める前にrootユーザになっておく

sudo su -

 

firewalld

アクセスコントロールはAWSで行うので、サーバ上では設定しない

 

SELinux

標準で無効化されている

[root@ip-10-0-13-104 ~]# getenforce
Disabled

 

その他のLinuxの設定

SSHのポート番号の変更

デフォルトのSSHポート(TCP/22)をインターネットに公開していると不正アクセスをしようとするアクセスが多くなり、アクセスに失敗したとしても不要なログが増えがちである。

ポート番号を変更することである程度軽減できる。

この変更を行う場合、EC2のセキュリティグループの許可設定追加も必要となる。

  1. 現在はポート指定がないことを確認(デフォルトポートで動作している)
    grep "^#Port 22" /etc/ssh/sshd_config
    • ログ
      [root@ip-10-0-13-104 ~]# grep "^#Port 22" /etc/ssh/sshd_config
      #Port 22
  2. 設定変更(ここでは7542番ポートにしているが実際は何でもよい)
    sed -i -e "s/^#Port 22/Port 7542/g" /etc/ssh/sshd_config
  3. 設定が変更されたことを確認
    grep "^Port " /etc/ssh/sshd_config
    • ログ
      [root@ip-10-0-13-104 ~]# grep "^Port " /etc/ssh/sshd_config
      Port 7542
  4. sshdを再起動する
    systemctl restart sshd
  5. 再起動後、待ち受けポート番号が変わっていることを確認
    ss -lnp | grep sshd
    • ログ
      [root@ip-10-0-13-104 ~]# ss -lnp | grep sshd
      u_dgr UNCONN 0 0 * 19254 * 1515 users:(("sshd",pid=2410,fd=4),("sshd",pid=2393,fd=4))
      tcp LISTEN 0 128 0.0.0.0:7542 0.0.0.0:* users:(("sshd",pid=2498,fd=3))
      tcp LISTEN 0 128 [::]:7542 [::]:* users:(("sshd",pid=2498,fd=4))

 

タイムゾーンの変更

タイムゾーンは初期状態ではUTCになっているので、JSTに変更する

rm -f /etc/localtime
ln -s /usr/share/zoneinfo/Asia/Tokyo /etc/localtime

 

パッケージ最新化

インストール済みの既存パッケージを最新化する

yum update -y

 

MariaDBのインストール

MattermostではDBとしてMySQL、PostgreSQLが使用可能である。

Amazon LinuxではMySQL互換のMariaDBのみが標準でパッケージ管理ツールでインストール可能なので、MariaDBをインストールする。

参考:https://docs.mattermost.com/install/install-rhel-8.html#install-a-database

  1. 使用可能なバージョンを確認する
    amazon-linux-extras | grep -i maria
  2. 最新バージョンインストールする
    ※yumでインストール可能であるが、yumでインストールするとバージョンが古く、mattermost使用時にFULLTEXTインデックスが使用できないとしてエラーになる。
    amazon-linux-extras install mariadb10.5 -y
  3. サービスを起動する
    systemctl enable mariadb
    systemctl start mariadb
    systemctl list-unit-files --type service --no-pager | grep mariadb
    ログ
    [root@ip-10-0-13-104 ~]# systemctl enable mariadb
    Created symlink from /etc/systemd/system/multi-user.target.wants/mariadb.service to /usr/lib/systemd/system/mariadb.service.
    [root@ip-10-0-13-104 ~]# systemctl start mariadb
    [root@ip-10-0-13-104 ~]# systemctl list-unit-files --type service --no-pager | grep mariadb
    mariadb.service enabled
    mariadb@.service disabled
  4. MariaDBに接続する
    mysql
  5. ユーザーを作成する。
    パスワードは任意のものに変更してよい。
    create user 'mmuser'@'localhost' identified by 'mmuser-password';
  6. データベースを作成する
    create database mattermost;
  7. 作成したユーザーにアクセス権限を付与する
    grant all privileges on mattermost.* to 'mmuser'@'localhost';
  8. ログアウトする
    exit

 

Mattermostのインストール

Dockerを使用することもできるが、効率よくリソースを使用するためにサーバに直接インストールする

  1. 最新版のソースコードのURLを確認する
    https://mattermost.com/deploy/
    ページ中のBinaryタブ部分である。
    GitHubからもダウンロード可能
  2. ソースコードをダウンロードする
    wget <URL>
  3. アーカイブを展開する
    tar -xvzf mattermost-*.gz
  4. 解凍したファイルを/optディレクトリに移動する

    mv mattermost /opt
  5. ファイルの格納ディレクトリを作成する

    mkdir /opt/mattermost/data
  6. サービス実行用のユーザーとグループを作成する

    useradd --user-group --no-create-home --shell /sbin/nologin mattermost
  7. ファイルの所有者を変更する
    chown -R mattermost:mattermost /opt/mattermost
    chmod -R g+w /opt/mattermost
  8.  設定ファイル中のDB接続情報を変更する
    grep "postgres\"" /opt/mattermost/config/config.json
    grep "mysql\"" /opt/mattermost/config/config.json
    sed -i -e "s/postgres\"/mysql\"/g" /opt/mattermost/config/config.json
    grep "postgres\"" /opt/mattermost/config/config.json
    grep "mysql\"" /opt/mattermost/config/config.json

    grep "postgres:.*," /opt/mattermost/config/config.json
    grep "mysql:.*," /opt/mattermost/config/config.json
    sed -i -e "s/postgres:.*,/mmuser:mmuser-password@tcp(localhost)\/mattermost?charset=utf8mb4,utf8\&writeTimeout=30s\",/g" /opt/mattermost/config/config.json
    grep "postgres:.*," /opt/mattermost/config/config.json
    grep "mysql:.*," /opt/mattermost/config/config.json
    ログ
    [root@ip-10-0-13-104 ~]# grep "postgres\"" /opt/mattermost/config/config.json
    "DriverName": "postgres",
    [root@ip-10-0-13-104 ~]# grep "mysql\"" /opt/mattermost/config/config.json
    [root@ip-10-0-13-104 ~]# sed -i -e "s/postgres\"/mysql\"/g" /opt/mattermost/config/config.json
    [root@ip-10-0-13-104 ~]# grep "postgres\"" /opt/mattermost/config/config.json
    [root@ip-10-0-13-104 ~]# grep "mysql\"" /opt/mattermost/config/config.json
    "DriverName": "mysql",

    [root@ip-10-0-13-104 ~]# grep "postgres:" /opt/mattermost/config/config.json
    "DataSource": "postgres://mmuser:mostest@localhost/mattermost_test?sslmode=disable\u0026connect_timeout=10\u0026binary_parameters=yes",writeTimeout=30s
    [root@ip-10-0-13-104 ~]# grep "mysql:" /opt/mattermost/config/config.json
    [root@ip-10-0-13-104 ~]# sed -i -e "s/postgres:.*,/mmuser:mmuser-password@tcp(localhost)\/mattermost?charset=utf8mb4,utf8\&writeTimeout=30s\",/g" /opt/mattermost/config/config.json
    [root@ip-10-0-13-104 ~]# grep "postgres:.*," /opt/mattermost/config/config.json
    [root@ip-10-0-13-104 ~]# grep "mysql:.*," /opt/mattermost/config/config.json
    "DataSource": "mysql://mmuser:mmuser-password@localhost/mattermost?charset=utf8mb4,utf8&writeTimeout=30s",
  9. 動作テストを行う。
    “level”:”fatal”のログが出ていないことを確認する。(errorログは無視する)
    1分ほど待っても動作が停止しなければデーモンが正常に起動しているはずである。
    問題なければCtrl+Cで停止する。
    cd /opt/mattermost
    sudo -u mattermost bin/mattermost
  10. サービス用のファイルを作成する
    cat > /lib/systemd/system/mattermost.service << EOT
    [Unit] Description=Mattermost After=network.target After=mariadb.service BindsTo=mariadb.service [Service] Type=notify ExecStart=/opt/mattermost/bin/mattermost TimeoutStartSec=3600 KillMode=mixed Restart=always RestartSec=10 WorkingDirectory=/opt/mattermost User=mattermost Group=mattermost LimitNOFILE=49152 [Install] WantedBy=multi-user.target
    EOT
  11. サービスとして起動する
    systemctl daemon-reload
    systemctl enable mattermost
    systemctl start mattermost
    systemctl status mattermost
  12. 管理ページが応答するか確認する
    curl http://localhost:8065

 

Mattermostの設定

Mattermostを使用開始する前にサーバーの各種設定を行った方が良い。

設定ファイルは下記パスにある。

/opt/mattermost/config/config.json

 

パラメータの各意味についてはドキュメントサイトで検索することでわかる。
https://docs.mattermost.com/guides/administration.html

 

設定後、サービスを再起動すること

systemctl start mattermost

 

なお、ログはデフォルトでは下記パスに出力される。

/opt/mattermost/logs/mattermost.log

 

設定についてはアプリやWebブラウザから管理者権限があれば管理画面からでも行える。
ただし、ポート番号やTLS設定等の初期設定については事前にやっておいた方が良い。

 

初期設定

{
    "ServiceSettings": {
        "SiteURL": "",
        "WebsocketURL": "",
        "LicenseFileLocation": "",
        "ListenAddress": ":8065",
        "ConnectionSecurity": "",
        "TLSCertFile": "",
        "TLSKeyFile": "",
        "TLSMinVer": "1.2",
        "TLSStrictTransport": false,
        "TLSStrictTransportMaxAge": 63072000,
        "TLSOverwriteCiphers": [],
        "UseLetsEncrypt": false,
        "LetsEncryptCertificateCacheFile": "./config/letsencrypt.cache",
        "Forward80To443": false,
        "TrustedProxyIPHeader": [],
        "ReadTimeout": 300,
        "WriteTimeout": 300,
        "IdleTimeout": 60,
        "MaximumLoginAttempts": 10,
        "GoroutineHealthThreshold": -1,
        "EnableOAuthServiceProvider": false,
        "EnableIncomingWebhooks": true,
        "EnableOutgoingWebhooks": true,
        "EnableCommands": true,
        "EnablePostUsernameOverride": false,
        "EnablePostIconOverride": false,
        "GoogleDeveloperKey": "",
        "EnableLinkPreviews": true,
        "EnablePermalinkPreviews": true,
        "RestrictLinkPreviews": "",
        "EnableTesting": false,
        "EnableDeveloper": false,
        "DeveloperFlags": "",
        "EnableClientPerformanceDebugging": false,
        "EnableOpenTracing": false,
        "EnableSecurityFixAlert": true,
        "EnableInsecureOutgoingConnections": false,
        "AllowedUntrustedInternalConnections": "",
        "EnableMultifactorAuthentication": false,
        "EnforceMultifactorAuthentication": false,
        "EnableUserAccessTokens": false,
        "AllowCorsFrom": "",
        "CorsExposedHeaders": "",
        "CorsAllowCredentials": false,
        "CorsDebug": false,
        "AllowCookiesForSubdomains": false,
        "ExtendSessionLengthWithActivity": true,
        "SessionLengthWebInDays": 30,
        "SessionLengthWebInHours": 720,
        "SessionLengthMobileInDays": 30,
        "SessionLengthMobileInHours": 720,
        "SessionLengthSSOInDays": 30,
        "SessionLengthSSOInHours": 720,
        "SessionCacheInMinutes": 10,
        "SessionIdleTimeoutInMinutes": 43200,
        "WebsocketSecurePort": 443,
        "WebsocketPort": 80,
        "WebserverMode": "gzip",
        "EnableGifPicker": true,
        "GfycatAPIKey": "2_KtH_W5",
        "GfycatAPISecret": "3wLVZPiswc3DnaiaFoLkDvB4X0IV6CpMkj4tf2inJRsBY6-FnkT08zGmppWFgeof",
        "EnableCustomEmoji": true,
        "EnableEmojiPicker": true,
        "PostEditTimeLimit": -1,
        "TimeBetweenUserTypingUpdatesMilliseconds": 5000,
        "EnablePostSearch": true,
        "EnableFileSearch": true,
        "MinimumHashtagLength": 3,
        "EnableUserTypingMessages": true,
        "EnableChannelViewedMessages": true,
        "EnableUserStatuses": true,
        "ExperimentalEnableAuthenticationTransfer": true,
        "ClusterLogTimeoutMilliseconds": 2000,
        "EnablePreviewFeatures": true,
        "EnableTutorial": true,
        "EnableOnboardingFlow": true,
        "ExperimentalEnableDefaultChannelLeaveJoinMessages": true,
        "ExperimentalGroupUnreadChannels": "disabled",
        "EnableAPITeamDeletion": false,
        "EnableAPITriggerAdminNotifications": false,
        "EnableAPIUserDeletion": false,
        "ExperimentalEnableHardenedMode": false,
        "ExperimentalStrictCSRFEnforcement": false,
        "EnableEmailInvitations": false,
        "DisableBotsWhenOwnerIsDeactivated": true,
        "EnableBotAccountCreation": false,
        "EnableSVGs": false,
        "EnableLatex": false,
        "EnableInlineLatex": true,
        "PostPriority": true,
        "EnableAPIChannelDeletion": false,
        "EnableLocalMode": false,
        "LocalModeSocketLocation": "/var/tmp/mattermost_local.socket",
        "EnableAWSMetering": false,
        "SplitKey": "",
        "FeatureFlagSyncIntervalSeconds": 30,
        "DebugSplit": false,
        "ThreadAutoFollow": true,
        "CollapsedThreads": "always_on",
        "ManagedResourcePaths": "",
        "EnableCustomGroups": true,
        "SelfHostedPurchase": true,
        "AllowSyncedDrafts": true
    },
    "TeamSettings": {
        "SiteName": "Mattermost",
        "MaxUsersPerTeam": 50,
        "EnableUserCreation": true,
        "EnableOpenServer": false,
        "EnableUserDeactivation": false,
        "RestrictCreationToDomains": "",
        "EnableCustomUserStatuses": true,
        "EnableCustomBrand": false,
        "CustomBrandText": "",
        "CustomDescriptionText": "",
        "RestrictDirectMessage": "any",
        "EnableLastActiveTime": true,
        "UserStatusAwayTimeout": 300,
        "MaxChannelsPerTeam": 2000,
        "MaxNotificationsPerChannel": 1000,
        "EnableConfirmNotificationsToChannel": true,
        "TeammateNameDisplay": "username",
        "ExperimentalViewArchivedChannels": true,
        "ExperimentalEnableAutomaticReplies": false,
        "LockTeammateNameDisplay": false,
        "ExperimentalPrimaryTeam": "",
        "ExperimentalDefaultChannels": []
    },
    "ClientRequirements": {
        "AndroidLatestVersion": "",
        "AndroidMinVersion": "",
        "IosLatestVersion": "",
        "IosMinVersion": ""
    },
    "SqlSettings": {
        "DriverName": "mysql",
        "DataSource": "mmuser:mmuser-password@tcp(localhost)/mattermost?charset=utf8mb4,utf8\u0026writeTimeout=30s",
        "DataSourceReplicas": [],
        "DataSourceSearchReplicas": [],
        "MaxIdleConns": 20,
        "ConnMaxLifetimeMilliseconds": 3600000,
        "ConnMaxIdleTimeMilliseconds": 300000,
        "MaxOpenConns": 300,
        "Trace": false,
        "AtRestEncryptKey": "XXXXXXXXXXXXXXXX",
        "QueryTimeout": 30,
        "DisableDatabaseSearch": false,
        "MigrationsStatementTimeoutSeconds": 100000,
        "ReplicaLagSettings": []
    },
    "LogSettings": {
        "EnableConsole": true,
        "ConsoleLevel": "INFO",
        "ConsoleJson": true,
        "EnableColor": false,
        "EnableFile": true,
        "FileLevel": "INFO",
        "FileJson": true,
        "FileLocation": "",
        "EnableWebhookDebugging": true,
        "EnableDiagnostics": true,
        "VerboseDiagnostics": false,
        "EnableSentry": true,
        "AdvancedLoggingConfig": ""
    },
    "ExperimentalAuditSettings": {
        "FileEnabled": false,
        "FileName": "",
        "FileMaxSizeMB": 100,
        "FileMaxAgeDays": 0,
        "FileMaxBackups": 0,
        "FileCompress": false,
        "FileMaxQueueSize": 1000,
        "AdvancedLoggingConfig": ""
    },
    "NotificationLogSettings": {
        "EnableConsole": true,
        "ConsoleLevel": "INFO",
        "ConsoleJson": true,
        "EnableColor": false,
        "EnableFile": true,
        "FileLevel": "INFO",
        "FileJson": true,
        "FileLocation": "",
        "AdvancedLoggingConfig": ""
    },
    "PasswordSettings": {
        "MinimumLength": 8,
        "Lowercase": false,
        "Number": false,
        "Uppercase": false,
        "Symbol": false
    },
    "FileSettings": {
        "EnableFileAttachments": true,
        "EnableMobileUpload": true,
        "EnableMobileDownload": true,
        "MaxFileSize": 104857600,
        "MaxImageResolution": 33177600,
        "MaxImageDecoderConcurrency": -1,
        "DriverName": "local",
        "Directory": "./data/",
        "EnablePublicLink": false,
        "ExtractContent": true,
        "ArchiveRecursion": false,
        "PublicLinkSalt": "y6rn5rruqhx5k6t5gbsdogezcqkb3c5k",
        "InitialFont": "nunito-bold.ttf",
        "AmazonS3AccessKeyId": "",
        "AmazonS3SecretAccessKey": "",
        "AmazonS3Bucket": "",
        "AmazonS3PathPrefix": "",
        "AmazonS3Region": "",
        "AmazonS3Endpoint": "s3.amazonaws.com",
        "AmazonS3SSL": true,
        "AmazonS3SignV2": false,
        "AmazonS3SSE": false,
        "AmazonS3Trace": false,
        "AmazonS3RequestTimeoutMilliseconds": 30000
    },
    "EmailSettings": {
        "EnableSignUpWithEmail": true,
        "EnableSignInWithEmail": true,
        "EnableSignInWithUsername": true,
        "SendEmailNotifications": false,
        "UseChannelInEmailNotifications": false,
        "RequireEmailVerification": false,
        "FeedbackName": "",
        "FeedbackEmail": "",
        "ReplyToAddress": "",
        "FeedbackOrganization": "",
        "EnableSMTPAuth": false,
        "SMTPUsername": "",
        "SMTPPassword": "",
        "SMTPServer": "localhost",
        "SMTPPort": "10025",
        "SMTPServerTimeout": 10,
        "ConnectionSecurity": "",
        "SendPushNotifications": true,
        "PushNotificationServer": "https://push-test.mattermost.com",
        "PushNotificationContents": "full",
        "PushNotificationBuffer": 1000,
        "EnableEmailBatching": false,
        "EmailBatchingBufferSize": 256,
        "EmailBatchingInterval": 30,
        "EnablePreviewModeBanner": true,
        "SkipServerCertificateVerification": false,
        "EmailNotificationContentsType": "full",
        "LoginButtonColor": "#0000",
        "LoginButtonBorderColor": "#2389D7",
        "LoginButtonTextColor": "#2389D7",
        "EnableInactivityEmail": true
    },
    "RateLimitSettings": {
        "Enable": false,
        "PerSec": 10,
        "MaxBurst": 100,
        "MemoryStoreSize": 10000,
        "VaryByRemoteAddr": true,
        "VaryByUser": false,
        "VaryByHeader": ""
    },
    "PrivacySettings": {
        "ShowEmailAddress": true,
        "ShowFullName": true
    },
    "SupportSettings": {
        "TermsOfServiceLink": "https://mattermost.com/terms-of-use/",
        "PrivacyPolicyLink": "https://mattermost.com/privacy-policy/",
        "AboutLink": "https://docs.mattermost.com/about/product.html/",
        "HelpLink": "https://mattermost.com/default-help/",
        "ReportAProblemLink": "https://mattermost.com/default-report-a-problem/",
        "SupportEmail": "",
        "CustomTermsOfServiceEnabled": false,
        "CustomTermsOfServiceReAcceptancePeriod": 365,
        "EnableAskCommunityLink": true
    },
    "AnnouncementSettings": {
        "EnableBanner": false,
        "BannerText": "",
        "BannerColor": "#f2a93b",
        "BannerTextColor": "#333333",
        "AllowBannerDismissal": true,
        "AdminNoticesEnabled": true,
        "UserNoticesEnabled": true,
        "NoticesURL": "https://notices.mattermost.com/",
        "NoticesFetchFrequency": 3600,
        "NoticesSkipCache": false
    },
    "ThemeSettings": {
        "EnableThemeSelection": true,
        "DefaultTheme": "default",
        "AllowCustomThemes": true,
        "AllowedThemes": []
    },
    "GitLabSettings": {
        "Enable": false,
        "Secret": "",
        "Id": "",
        "Scope": "",
        "AuthEndpoint": "",
        "TokenEndpoint": "",
        "UserAPIEndpoint": "",
        "DiscoveryEndpoint": "",
        "ButtonText": "",
        "ButtonColor": ""
    },
    "GoogleSettings": {
        "Enable": false,
        "Secret": "",
        "Id": "",
        "Scope": "profile email",
        "AuthEndpoint": "https://accounts.google.com/o/oauth2/v2/auth",
        "TokenEndpoint": "https://www.googleapis.com/oauth2/v4/token",
        "UserAPIEndpoint": "https://people.googleapis.com/v1/people/me?personFields=names,emailAddresses,nicknames,metadata",
        "DiscoveryEndpoint": "",
        "ButtonText": "",
        "ButtonColor": ""
    },
    "Office365Settings": {
        "Enable": false,
        "Secret": "",
        "Id": "",
        "Scope": "User.Read",
        "AuthEndpoint": "https://login.microsoftonline.com/common/oauth2/v2.0/authorize",
        "TokenEndpoint": "https://login.microsoftonline.com/common/oauth2/v2.0/token",
        "UserAPIEndpoint": "https://graph.microsoft.com/v1.0/me",
        "DiscoveryEndpoint": "",
        "DirectoryId": ""
    },
    "OpenIdSettings": {
        "Enable": false,
        "Secret": "",
        "Id": "",
        "Scope": "profile openid email",
        "AuthEndpoint": "",
        "TokenEndpoint": "",
        "UserAPIEndpoint": "",
        "DiscoveryEndpoint": "",
        "ButtonText": "",
        "ButtonColor": "#145DBF"
    },
    "LdapSettings": {
        "Enable": false,
        "EnableSync": false,
        "LdapServer": "",
        "LdapPort": 389,
        "ConnectionSecurity": "",
        "BaseDN": "",
        "BindUsername": "",
        "BindPassword": "",
        "UserFilter": "",
        "GroupFilter": "",
        "GuestFilter": "",
        "EnableAdminFilter": false,
        "AdminFilter": "",
        "GroupDisplayNameAttribute": "",
        "GroupIdAttribute": "",
        "FirstNameAttribute": "",
        "LastNameAttribute": "",
        "EmailAttribute": "",
        "UsernameAttribute": "",
        "NicknameAttribute": "",
        "IdAttribute": "",
        "PositionAttribute": "",
        "LoginIdAttribute": "",
        "PictureAttribute": "",
        "SyncIntervalMinutes": 60,
        "SkipCertificateVerification": false,
        "PublicCertificateFile": "",
        "PrivateKeyFile": "",
        "QueryTimeout": 60,
        "MaxPageSize": 0,
        "LoginFieldName": "",
        "LoginButtonColor": "#0000",
        "LoginButtonBorderColor": "#2389D7",
        "LoginButtonTextColor": "#2389D7",
        "Trace": false
    },
    "ComplianceSettings": {
        "Enable": false,
        "Directory": "./data/",
        "EnableDaily": false,
        "BatchSize": 30000
    },
    "LocalizationSettings": {
        "DefaultServerLocale": "en",
        "DefaultClientLocale": "en",
        "AvailableLocales": ""
    },
    "SamlSettings": {
        "Enable": false,
        "EnableSyncWithLdap": false,
        "EnableSyncWithLdapIncludeAuth": false,
        "IgnoreGuestsLdapSync": false,
        "Verify": true,
        "Encrypt": true,
        "SignRequest": false,
        "IdpURL": "",
        "IdpDescriptorURL": "",
        "IdpMetadataURL": "",
        "ServiceProviderIdentifier": "",
        "AssertionConsumerServiceURL": "",
        "SignatureAlgorithm": "RSAwithSHA1",
        "CanonicalAlgorithm": "Canonical1.0",
        "ScopingIDPProviderId": "",
        "ScopingIDPName": "",
        "IdpCertificateFile": "",
        "PublicCertificateFile": "",
        "PrivateKeyFile": "",
        "IdAttribute": "",
        "GuestAttribute": "",
        "EnableAdminAttribute": false,
        "AdminAttribute": "",
        "FirstNameAttribute": "",
        "LastNameAttribute": "",
        "EmailAttribute": "",
        "UsernameAttribute": "",
        "NicknameAttribute": "",
        "LocaleAttribute": "",
        "PositionAttribute": "",
        "LoginButtonText": "SAML",
        "LoginButtonColor": "#34a28b",
        "LoginButtonBorderColor": "#2389D7",
        "LoginButtonTextColor": "#ffffff"
    },
    "NativeAppSettings": {
        "AppCustomURLSchemes": [
            "mmauth://",
            "mmauthbeta://"
        ],
        "AppDownloadLink": "https://mattermost.com/download/#mattermostApps",
        "AndroidAppDownloadLink": "https://mattermost.com/mattermost-android-app/",
        "IosAppDownloadLink": "https://mattermost.com/mattermost-ios-app/"
    },
    "ClusterSettings": {
        "Enable": false,
        "ClusterName": "",
        "OverrideHostname": "",
        "NetworkInterface": "",
        "BindAddress": "",
        "AdvertiseAddress": "",
        "UseIPAddress": true,
        "EnableGossipCompression": true,
        "EnableExperimentalGossipEncryption": false,
        "ReadOnlyConfig": true,
        "GossipPort": 8074,
        "StreamingPort": 8075,
        "MaxIdleConns": 100,
        "MaxIdleConnsPerHost": 128,
        "IdleConnTimeoutMilliseconds": 90000
    },
    "MetricsSettings": {
        "Enable": false,
        "BlockProfileRate": 0,
        "ListenAddress": ":8067"
    },
    "ExperimentalSettings": {
        "ClientSideCertEnable": false,
        "ClientSideCertCheck": "secondary",
        "LinkMetadataTimeoutMilliseconds": 5000,
        "RestrictSystemAdmin": false,
        "UseNewSAMLLibrary": false,
        "EnableSharedChannels": false,
        "EnableRemoteClusterService": false,
        "EnableAppBar": false,
        "PatchPluginsReactDOM": false
    },
    "AnalyticsSettings": {
        "MaxUsersForStatistics": 2500
    },
    "ElasticsearchSettings": {
        "ConnectionURL": "http://localhost:9200",
        "Username": "elastic",
        "Password": "changeme",
        "EnableIndexing": false,
        "EnableSearching": false,
        "EnableAutocomplete": false,
        "Sniff": true,
        "PostIndexReplicas": 1,
        "PostIndexShards": 1,
        "ChannelIndexReplicas": 1,
        "ChannelIndexShards": 1,
        "UserIndexReplicas": 1,
        "UserIndexShards": 1,
        "AggregatePostsAfterDays": 365,
        "PostsAggregatorJobStartTime": "03:00",
        "IndexPrefix": "",
        "LiveIndexingBatchSize": 1,
        "BatchSize": 10000,
        "RequestTimeoutSeconds": 30,
        "SkipTLSVerification": false,
        "Trace": ""
    },
    "BleveSettings": {
        "IndexDir": "",
        "EnableIndexing": false,
        "EnableSearching": false,
        "EnableAutocomplete": false,
        "BatchSize": 10000
    },
    "DataRetentionSettings": {
        "EnableMessageDeletion": false,
        "EnableFileDeletion": false,
        "EnableBoardsDeletion": false,
        "MessageRetentionDays": 365,
        "FileRetentionDays": 365,
        "BoardsRetentionDays": 365,
        "DeletionJobStartTime": "02:00",
        "BatchSize": 3000
    },
    "MessageExportSettings": {
        "EnableExport": false,
        "ExportFormat": "actiance",
        "DailyRunTime": "01:00",
        "ExportFromTimestamp": 0,
        "BatchSize": 10000,
        "DownloadExportResults": false,
        "GlobalRelaySettings": {
            "CustomerType": "A9",
            "SMTPUsername": "",
            "SMTPPassword": "",
            "EmailAddress": "",
            "SMTPServerTimeout": 1800
        }
    },
    "JobSettings": {
        "RunJobs": true,
        "RunScheduler": true,
        "CleanupJobsThresholdDays": -1,
        "CleanupConfigThresholdDays": -1
    },
    "ProductSettings": {
        "EnablePublicSharedBoards": false
    },
    "PluginSettings": {
        "Enable": true,
        "EnableUploads": false,
        "AllowInsecureDownloadURL": false,
        "EnableHealthCheck": true,
        "Directory": "./plugins",
        "ClientDirectory": "./client/plugins",
        "Plugins": {
            "playbooks": {
                "BotUserID": "wwuaf47dfi8amx7fkiqcyyuntr"
            }
        },
        "PluginStates": {
            "com.mattermost.apps": {
                "Enable": true
            },
            "com.mattermost.calls": {
                "Enable": true
            },
            "com.mattermost.nps": {
                "Enable": true
            },
            "com.mattermost.plugin-channel-export": {
                "Enable": true
            },
            "focalboard": {
                "Enable": true
            },
            "playbooks": {
                "Enable": true
            }
        },
        "EnableMarketplace": true,
        "EnableRemoteMarketplace": true,
        "AutomaticPrepackagedPlugins": true,
        "RequirePluginSignature": false,
        "MarketplaceURL": "https://api.integrations.mattermost.com",
        "SignaturePublicKeyFiles": [],
        "ChimeraOAuthProxyURL": ""
    },
    "DisplaySettings": {
        "CustomURLSchemes": [],
        "ExperimentalTimezone": true
    },
    "GuestAccountsSettings": {
        "Enable": false,
        "AllowEmailAccounts": true,
        "EnforceMultifactorAuthentication": false,
        "RestrictCreationToDomains": ""
    },
    "ImageProxySettings": {
        "Enable": false,
        "ImageProxyType": "local",
        "RemoteImageProxyURL": "",
        "RemoteImageProxyOptions": ""
    },
    "CloudSettings": {
        "CWSURL": "https://customers.mattermost.com",
        "CWSAPIURL": "https://portal.internal.prod.cloud.mattermost.com"
    },
    "ImportSettings": {
        "Directory": "./import",
        "RetentionDays": 30
    },
    "ExportSettings": {
        "Directory": "./export",
        "RetentionDays": 30
    }
}

 

ローカライズ設定

参考:https://docs.mattermost.com/configure/site-configuration-settings.html#localization

デフォルトでは言語が英語となっているので日本語に変更する。

 

TLSの有効化

標準では8065番ポートを使用して暗号化通信は行わないが、TLSを有効化してHTTPS(TCP/443)ポートを使用した暗号化通信を行うことが可能である。

その際SSL証明書が必要になるが、Let’s Encryptを使用して無料証明書を取得したり、独自の証明書を用意したりもできる。

今回はLet’s Encryptを使用する。Let’s Encryptを使用する場合、証明書等は自身で取得しなくても、Mattermostが自動で取得してくれる。取得タイミングはTLS設定をした後の初回アクセス時なので、TLS設定をした直後や証明書更新タイミングでは応答が遅くなる。

また、ローポートを使用するために次のコマンドの実行が必要である。

setcap cap_net_bind_service=+ep /opt/mattermost/bin/mattermost

 

SMTP設定

メール送信を有効化することは必須ではないが、有効にしないと画面上部にプレビュー版と表示されてしまうので、有効化しておく。

 

Mattermostの管理

Mattermostの使用を始める

まずは管理者として自身のアカウントを作成する必要がある。次に、ワークスペースを作成する。

  1. Mattermostを起動しているサーバのドメインにWebブラウザでアクセスする
  2. このままWebブラウザで進めるか、デスクトップアプリを使用するか選択する。アプリの場合はダウンロードする(インストール不要で使用できる)
  3. メールアドレス、アカウント名、パスワードを設定して登録する。アカウント名はデフォルトでチャットでの表示名になるが、英数字と一部の記号しか使用できず、最初はアルファベット小文字で始めなければならない。
    ユーザーが個別に設定変更することで表示をアカウント名でなく、氏名やニックネームに切り替えられる。
  4. チームを作成する。チームはワークスペースのことで、チーム配下にチャンネルを作成する。
    チームは基本的に1つのみ作成する。

 

チャンネルを作成する

左側サイドメニューのチーム名横の+アイコンから「新しいチャンネルを作成する」をクリックし、作成できる。

チャンネル名に日本語を使用したい場合はURLを自身で設定しなければならない。

 

ユーザーを登録する

左側サイドメニューの「メンバーを招待する」から招待したいメールアドレスを入力し、「招待」ボタンをクリックすれば招待メールが送られる。

なお、SMTPサーバーの設定をしていない場合は招待用のリンクを発行し、登録したいユーザーが自身でそのリンクからユーザー登録を行う必要がある。

左側サイドメニューのチーム名横の+アイコンから「招待する」をクリックし、「招待リンクのコピー」をクリックすることでクリップボードにリンクがコピーされる。そのリンクを招待したい相手に渡し、登録してもらう。

なお、無料版の場合は複数ユーザーをまとめてグループとして設定する機能が使えない。DBにはUserGroupsやGroupMembers等の関連すると思われるテーブル自体はあるが、このテーブルにレコードを挿入してみてもグループに対してメンションはできなかった。


Notice: Trying to get property 'queue' of non-object in /usr/local/wordpress/wp-includes/script-loader.php on line 2876

Warning: Invalid argument supplied for foreach() in /usr/local/wordpress/wp-includes/script-loader.php on line 2876