forked from icelander/mattermost_shared_data_recipe
-
Notifications
You must be signed in to change notification settings - Fork 0
/
mattermost_setup.sh
38 lines (29 loc) · 1.96 KB
/
mattermost_setup.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/bin/bash
apt-get -q -y update > /dev/null
apt-get -q -y install jq cifs-utils
mkdir -p /media/mmst-data
cat /vagrant/client_fstab >> /etc/fstab
mount -a
wget https://releases.mattermost.com/5.8.0/mattermost-5.8.0-linux-amd64.tar.gz
tar -xzf mattermost*.gz
rm mattermost*.gz
mv mattermost /opt
mkdir /opt/mattermost/data
ln -s /vagrant/license.txt /opt/mattermost/license.txt
mv /opt/mattermost/config/config.json /opt/mattermost/config/config.orig.json
jq '.ServiceSettings.LicenseFileLocation = "/opt/mattermost/license.txt"' /opt/mattermost/config/config.orig.json > /vagrant/config.tmp.json && mv /vagrant/config.tmp.json /vagrant/config.json
jq '.SqlSettings.DataSource = "mmuser:really_secure_password@tcp(192.168.33.101:3306)/mattermost?charset=utf8mb4,utf8\u0026readTimeout=30s\u0026writeTimeout=30s"' /vagrant/config.json > /vagrant/config.tmp.json && mv /vagrant/config.tmp.json /vagrant/config.json
jq '.ClusterSettings.Enable = true' /vagrant/config.json > /vagrant/config.tmp.json && mv /vagrant/config.tmp.json /vagrant/config.json
jq '.ClusterSettings.ClusterName = "Buster"' /vagrant/config.json > /vagrant/config.tmp.json && mv /vagrant/config.tmp.json /vagrant/config.json
jq '.ClusterSettings.OverrideHostname = "#IP_ADDR"' /vagrant/config.json > /vagrant/config.tmp.json && mv /vagrant/config.tmp.json /vagrant/config.json
jq '.ClusterSettings.ReadOnlyConfig = false' /vagrant/config.json > /vagrant/config.tmp.json && mv /vagrant/config.tmp.json /vagrant/config.json
jq '.FileSettings.Directory = "/media/mmst-data/"' /vagrant/config.json > /vagrant/config.tmp.json && mv /vagrant/config.tmp.json /vagrant/config.json
cp /vagrant/config.json /opt/mattermost/config/config.json
useradd --system --user-group mattermost
chown -R mattermost:mattermost /opt/mattermost
chmod -R g+w /opt/mattermost
cp /vagrant/mattermost.service /lib/systemd/system/mattermost.service
systemctl daemon-reload
/opt/mattermost/bin/mattermost version
echo "Starting Mattermost"
service mattermost start