Site icon Learning & Doing

Cara Install Mattermost Server pada Amazon Linux

Mattermost

“Cara Install Mattermost Server pada Amazon Linux”

Pengantar

Mattermost adalah alat obrolan dan kolaborasi sumber terbuka dan gratis. Mattermost memiliki banyak keunggulan sebagai alat obrolan dan kolaborasi online seperti integrasi dengan alat online lainnya, bot yang dapat dikonfigurasi untuk alur kerja khusus dan banyak lagi. Alat ini populer dengan alat DevOps seperti Git.

Arsitektur Mattermost

Persyaratan

Install Mattermost Server pada Amazon Linux

sudo yum -y update
sudo reboot
sudo yum -y install @mariadb
sudo systemctl enable --now mariadb

Konfigurasi Mariadb

sudo mysql_secure_installation

Buat DB baru

mysql -u root -p
CREATE DATABASE mattermost;
GRANT ALL PRIVILEGES ON mattermost.* TO mattermost@localhost IDENTIFIED BY 'Str0ngPassw0rd';
FLUSH PRIVILEGES;
QUIT;
sudo useradd -d /opt/mattermost -U -M mattermost
wget https://releases.mattermost.com/6.0.1/mattermost-6.0.1-linux-amd64.tar.gz
tar xvf mattermost-6.0.1-linux-amd64.tar.gz
sudo mv mattermost /opt
sudo mkdir /opt/mattermost/data
sudo chown -R mattermost:mattermost /opt/mattermost
sudo chmod -R g+w /opt/mattermost
sudo vim /opt/mattermost/config/config.json
    Set the “DriverName” to mysql

    Configure the “DataSource” in the format "mmuser:<mmuser-password>@tcp(:3306)/mattermost?charset=utf8mb4,utf8&readTimeout=30s&writeTimeout=30s"
"SqlSettings": {
        "DriverName": "mysql",
        "DataSource": "mattermost:Str0ngPassw0rd@tcp(localhost:3306)/mattermost?charset=utf8mb4,utf8\u0026readTimeout=30s\u0026writeTimeout=30s",
        "DataSourceReplicas": [],
        "DataSourceSearchReplicas": [],
        "MaxIdleConns": 20,
        "ConnMaxLifetimeMilliseconds": 3600000,
        "MaxOpenConns": 300,
        "Trace": false,
        "AtRestEncryptKey": "",
        "QueryTimeout": 30
    },

Jalankan Mattermost server

cd /opt/mattermost
$ sudo -u mattermost ./bin/mattermost
{"level":"info","ts":1629019440.0392742,"caller":"app/server.go:269","msg":"Server is initializing...","go_version":"go1.15.5"}
{"level":"info","ts":1629019440.0393405,"caller":"app/web_hub.go:93","msg":"Starting websocket hubs","number_of_hubs":2}
{"level":"info","ts":1629019440.0397189,"caller":"i18n/i18n.go:93","msg":"Loaded system translations","for locale":"en","from locale":"/opt/mattermost/i18n/en.json"}
{"level":"info","ts":1629019440.0487335,"caller":"sqlstore/store.go:306","msg":"Pinging SQL","database":"master"}
{"level":"info","ts":1629019440.056872,"caller":"sqlstore/store.go:306","msg":"Pinging SQL","database":"migrations"}
{"level":"info","ts":1629019440.1456177,"caller":"app/server.go:579","msg":"Enterprise Build","enterprise_build":true}
{"level":"info","ts":1629019440.145637,"caller":"app/server.go:585","msg":"Printing current working","directory":"/opt/mattermost"}
{"level":"info","ts":1629019440.1456475,"caller":"app/server.go:586","msg":"Loaded config","source":"file:///opt/mattermost/config/config.json"}
{"level":"info","ts":1629019440.152936,"caller":"jobs/workers.go:135","msg":"Starting workers"}
{"level":"info","ts":1629019440.1530619,"caller":"jobs/schedulers.go:116","msg":"Starting schedulers."}
{"level":"info","ts":1629019440.161364,"caller":"mlog/log.go:237","msg":"Starting up plugins"}
{"level":"info","ts":1629019440.1614122,"caller":"app/plugin.go:258","msg":"Syncing plugins from the file store"}
{"level":"info","ts":1629019442.7709634,"caller":"app/license.go:88","msg":"License key from https://mattermost.com required to unlock enterprise features."}
{"level":"info","ts":1629019443.1491122,"caller":"mlog/sugar.go:21","msg":"Ensuring Surveybot exists","plugin_id":"com.mattermost.nps"}
{"level":"info","ts":1629019443.3604462,"caller":"app/server.go:1179","msg":"Starting Server..."}
{"level":"info","ts":1629019443.3606062,"caller":"app/server.go:1255","msg":"Server is listening on [::]:8065","address":"[::]:8065"}

Cek port

 ss -plunt | grep 8065

Konfigurasi Mattermost service

sudo tee /etc/systemd/system/mattermost.service<<EOF
[Unit]
Description=Mattermost
After=syslog.target network.target mariadb.service

[Service]
Type=notify
WorkingDirectory=/opt/mattermost
User=mattermost
ExecStart=/opt/mattermost/bin/mattermost
PIDFile=/var/run/mattermost.pid
TimeoutStartSec=3600
LimitNOFILE=49152

[Install]
WantedBy=multi-user.target
EOF
sudo sed -i 's/^SELINUX=.*/SELINUX=permissive/g' /etc/selinux/config
sudo systemctl daemon-reload
sudo systemctl enable --now mattermost

Install Nginx Proxy

sudo dnf -y install epel-release
sudo dnf -y install nginx
sudo systemctl enable --now nginx
sudo vi /etc/nginx/conf.d/mattermost.conf
pstream backend {
   server 127.0.0.1:8065;
   keepalive 32;
}

proxy_cache_path /var/cache/nginx levels=1:2 keys_zone=mattermost_cache:10m max_size=3g inactive=120m use_temp_path=off;

server {
   listen 80;
   server_name    mattermost.games.com;

   location ~ /api/v[0-9]+/(users/)?websocket$ {
       proxy_set_header Upgrade $http_upgrade;
       proxy_set_header Connection "upgrade";
       client_max_body_size 50M;
       proxy_set_header Host $http_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_buffers 256 16k;
       proxy_buffer_size 16k;
       client_body_timeout 60;
       send_timeout 300;
       lingering_timeout 5;
       proxy_connect_timeout 90;
       proxy_send_timeout 300;
       proxy_read_timeout 90s;
       proxy_pass http://backend;
   }

   location / {
       client_max_body_size 50M;
       proxy_set_header Connection "";
       proxy_set_header Host $http_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_buffers 256 16k;
       proxy_buffer_size 16k;
       proxy_read_timeout 600s;
       proxy_cache mattermost_cache;
       proxy_cache_revalidate on;
       proxy_cache_min_uses 2;
       proxy_cache_use_stale timeout;
       proxy_cache_lock on;
       proxy_http_version 1.1;
       proxy_pass http://backend;
   }
}
sudo nginx -t
sudo systemctl restart nginx

Tambahkan Firewall Rule

sudo firewall-cmd --add-service={http,https} --permanent
sudo firewall-cmd --reload

Akses GUI

mattermost.games.com

Penutup

Sahabat Blog Learning & Doing demikianlah penjelasan mengenai Cara Install Mattermost Server pada Amazon Linux. Semoga Bermanfaat . Sampai ketemu lagi di postingan berikut nya.

Exit mobile version