Skip to content

Commit 0cee362

Browse files
committed
Initial file setup
1 parent 4bf4c6c commit 0cee362

10 files changed

+477
-7
lines changed

source/guides/administrator.rst

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
Mattermost Administrator's Guide
2-
--------------------------------
2+
================================
33

44
In-depth documentation on installation, deployment and administration of Mattermost system.
55

6-
Install Guides
7-
==============
6+
Installing Mattermost
7+
---------------------
88

99
.. toctree::
1010
:maxdepth: 1
1111
:glob:
1212

13-
/install/requirements*
13+
/install/requirements.rst
14+
Installing on Ubuntu 14.04 LTS </install/install-ubuntu-1404-overview.rst>
1415
/install/docker-local*
1516
/install/docker-ebs*
1617
/install/ee-install*
17-
/install/prod-ubuntu*
1818
/install/prod-rhel*
1919
/install/prod*
2020
/install/setup-tls*
@@ -23,8 +23,18 @@ Install Guides
2323
/install/i18n*
2424
/install/desktop*
2525

26+
Configuring Mattermost
27+
----------------------
28+
29+
.. toctree::
30+
:maxdepth: 1
31+
32+
/install/config-mattermost-server.rst
33+
/install/config-tls-mattermost.rst
34+
/install/config-ssl-http2-nginx.rst
35+
2636
Deployment
27-
==========
37+
----------
2838

2939
.. toctree::
3040
:maxdepth: 1
@@ -43,7 +53,7 @@ Deployment
4353
/deployment/webrtc*
4454

4555
Administration
46-
==============
56+
--------------
4757

4858
.. toctree::
4959
:maxdepth: 1
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
Test setup and configure Mattermost Server
2+
==========================================
3+
4+
1. Navigate to ``https://mattermost.example.com`` and create a team and
5+
user.
6+
2. The first user in the system is automatically granted the
7+
``system_admin`` role, which gives you access to the System Console.
8+
3. From the ``town-square`` channel click the dropdown and choose the
9+
``System Console`` option
10+
4. Update **Notification** > **Email** settings to setup an SMTP email service. The example below assumes AmazonSES.
11+
12+
- Set *Send Email Notifications* to ``true``
13+
- Set *Require Email Verification* to ``true``
14+
- Set *Feedback Name* to ``No-Reply``
15+
- Set *Feedback Email* to ``mattermost@example.com``
16+
- Set *SMTP Username* to ``[YOUR_SMTP_USERNAME]``
17+
- Set *SMTP Password* to ``[YOUR_SMTP_PASSWORD]``
18+
- Set *SMTP Server* to ``email-smtp.us-east-1.amazonaws.com``
19+
- Set *SMTP Port* to ``465``
20+
- Set *Connection Security* to ``TLS``
21+
- Save the Settings
22+
23+
5. Update **File** > **Storage** settings:
24+
25+
- Change *Local Directory Location* from ``./data/`` to
26+
``/mattermost/data``
27+
28+
6. Update **General** > **Logging** settings:
29+
30+
- Set *Log to The Console* to ``false``
31+
32+
7. Feel free to modify other settings.
33+
8. Restart the Mattermost Service by typing:
34+
35+
- ``sudo restart mattermost``
Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
Set up NGINX with SSL (Recommended)
2+
===================================
3+
4+
1. You can use a free and an open certificate security like let's
5+
encrypt, this is how to proceed
6+
7+
- ``sudo apt-get install git``
8+
- ``git clone https://github.com/letsencrypt/letsencrypt``
9+
- ``cd letsencrypt``
10+
11+
2. Be sure that the port 80 is not use by stopping NGINX
12+
13+
- ``sudo service nginx stop``
14+
- ``netstat -na | grep ':80.*LISTEN'``
15+
- ``./letsencrypt-auto certonly --standalone``
16+
17+
3. This command will download packages and run the instance, after that
18+
you will have to give your domain name
19+
4. You can find your certificate in ``/etc/letsencrypt/live``
20+
5. Modify the file at ``/etc/nginx/sites-available/mattermost`` and add
21+
the following lines:
22+
23+
::
24+
25+
upstream backend {
26+
server 10.10.10.2:8065;
27+
}
28+
29+
server {
30+
listen 80;
31+
server_name mattermost.example.com;
32+
return 301 https://$server_name$request_uri;
33+
}
34+
35+
proxy_cache_path /var/cache/nginx levels=1:2 keys_zone=mattermost_cache:10m max_size=3g inactive=120m use_temp_path=off;
36+
37+
server {
38+
listen 443 ssl;
39+
server_name mattermost.example.com;
40+
41+
ssl on;
42+
ssl_certificate /etc/letsencrypt/live/yourdomainname/fullchain.pem;
43+
ssl_certificate_key /etc/letsencrypt/live/yourdomainname/privkey.pem;
44+
ssl_session_timeout 5m;
45+
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
46+
ssl_ciphers 'EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH';
47+
ssl_prefer_server_ciphers on;
48+
ssl_session_cache shared:SSL:10m;
49+
50+
location /api/v3/users/websocket {
51+
proxy_set_header Upgrade $http_upgrade;
52+
proxy_set_header Connection "upgrade";
53+
proxy_set_header X-Forwarded-Ssl on;
54+
client_max_body_size 50M;
55+
proxy_set_header Host $http_host;
56+
proxy_set_header X-Real-IP $remote_addr;
57+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
58+
proxy_set_header X-Forwarded-Proto $scheme;
59+
proxy_set_header X-Frame-Options SAMEORIGIN;
60+
proxy_buffers 256 16k;
61+
proxy_buffer_size 16k;
62+
proxy_read_timeout 600s;
63+
proxy_pass http://backend;
64+
}
65+
66+
location / {
67+
proxy_set_header X-Forwarded-Ssl on;
68+
client_max_body_size 50M;
69+
proxy_set_header Connection "";
70+
proxy_set_header Host $http_host;
71+
proxy_set_header X-Real-IP $remote_addr;
72+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
73+
proxy_set_header X-Forwarded-Proto $scheme;
74+
proxy_set_header X-Frame-Options SAMEORIGIN;
75+
proxy_buffers 256 16k;
76+
proxy_buffer_size 16k;
77+
proxy_read_timeout 600s;
78+
proxy_cache mattermost_cache;
79+
proxy_cache_revalidate on;
80+
proxy_cache_min_uses 2;
81+
proxy_cache_use_stale timeout;
82+
proxy_cache_lock on;
83+
proxy_pass http://backend;
84+
}
85+
}
86+
87+
88+
6. Be sure to restart NGINX
89+
* ``\ sudo service nginx start``
90+
7. Add the following line to cron so the cert will renew every month
91+
* ``crontab -e``
92+
* ``@monthly /home/ubuntu/letsencrypt/letsencrypt-auto certonly --reinstall --nginx -d yourdomainname && sudo service nginx reload``
93+
8. Check that your SSL certificate is set up correctly
94+
* Test the SSL certificate by visiting a site such as `https://www.ssllabs.com/ssltest/index.html <https://www.ssllabs.com/ssltest/index.html>`_
95+
* If there’s an error about the missing chain or certificate path, there is likely an intermediate certificate missing that needs to be included
96+
97+
Setup HTTP2
98+
------------
99+
100+
It is recommended to enable HTTP2 for enhanced performance.
101+
102+
1. Modify your NGINX configuration as above. Then,
103+
104+
- Change the line ``listen 443 ssl;`` to ``listen 443 ssl http2;``
105+
- Change the line ``proxy_pass http://10.10.10.2:8065;`` to ``proxy_pass https://10.10.10.2:8065;``
106+
107+
2. Restart NGINX
File renamed without changes.

source/install/install-nginx.rst

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
Set up NGINX Server
2+
===================
3+
4+
1. For the purposes of this guide we will assume this server has an IP
5+
address of ``10.10.10.3``
6+
2. We use NGINX for proxying request to the Mattermost Server. The main
7+
benefits are:
8+
9+
- SSL termination
10+
- http to https redirect
11+
- Port mapping ``:80`` to ``:8065``
12+
- Standard request logs
13+
14+
15+
3. Install NGINX on Ubuntu with
16+
17+
- ``sudo apt-get install nginx``
18+
19+
4. Verify NGINX is running
20+
21+
- ``curl http://10.10.10.3``
22+
- You should see a *Welcome to NGINX!* page
23+
24+
5. You can manage NGINX with the following commands
25+
26+
- ``sudo service nginx stop``
27+
- ``sudo service nginx start``
28+
- ``sudo service nginx restart``
29+
30+
6. Map a FQDN (fully qualified domain name) like
31+
``mattermost.example.com`` to point to the NGINX server.
32+
7. Configure NGINX to proxy connections from the internet to the
33+
Mattermost Server
34+
35+
- Create a configuration for Mattermost
36+
- ``sudo touch /etc/nginx/sites-available/mattermost``
37+
- Below is a sample nginx configuration optimized for performance:
38+
39+
::
40+
41+
upstream backend {
42+
server 10.10.10.2:8065;
43+
}
44+
45+
proxy_cache_path /var/cache/nginx levels=1:2 keys_zone=mattermost_cache:10m max_size=3g inactive=120m use_temp_path=off;
46+
47+
server {
48+
listen 80;
49+
server_name mattermost.example.com;
50+
51+
location /api/v3/users/websocket {
52+
proxy_set_header Upgrade $http_upgrade;
53+
proxy_set_header Connection "upgrade";
54+
client_max_body_size 50M;
55+
proxy_set_header Host $http_host;
56+
proxy_set_header X-Real-IP $remote_addr;
57+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
58+
proxy_set_header X-Forwarded-Proto $scheme;
59+
proxy_set_header X-Frame-Options SAMEORIGIN;
60+
proxy_buffers 256 16k;
61+
proxy_buffer_size 16k;
62+
proxy_read_timeout 600s;
63+
proxy_pass http://backend;
64+
}
65+
66+
location / {
67+
client_max_body_size 50M;
68+
proxy_set_header Connection "";
69+
proxy_set_header Host $http_host;
70+
proxy_set_header X-Real-IP $remote_addr;
71+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
72+
proxy_set_header X-Forwarded-Proto $scheme;
73+
proxy_set_header X-Frame-Options SAMEORIGIN;
74+
proxy_buffers 256 16k;
75+
proxy_buffer_size 16k;
76+
proxy_read_timeout 600s;
77+
proxy_cache mattermost_cache;
78+
proxy_cache_revalidate on;
79+
proxy_cache_min_uses 2;
80+
proxy_cache_use_stale timeout;
81+
proxy_cache_lock on;
82+
proxy_pass http://backend;
83+
}
84+
}
85+
86+
87+
* Remove the existing file with
88+
* ``` sudo rm /etc/nginx/sites-enabled/default```
89+
* Link the mattermost config by typing:
90+
* ```sudo ln -s /etc/nginx/sites-available/mattermost /etc/nginx/sites-enabled/mattermost```
91+
* Restart NGINX by typing:
92+
* ``` sudo service nginx restart```
93+
* Verify you can see Mattermost thru the proxy by typing:
94+
* ``` curl http://localhost```
95+
* You should see a page titles *Mattermost - Signup*
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
Set up Mattermost Server
2+
========================
3+
4+
For the purposes of this guide we will assume this server has an IP address of ``10.10.10.2``
5+
6+
1. Create a mattermost user and group
7+
8+
- ``sudo adduser --system --group mattermost``
9+
10+
2. Change to the mattermost home directory.
11+
12+
``cd /home/mattermost``
13+
14+
3. Download `the latest version of the Mattermost Server <https://docs.mattermost.com/administration/upgrade.html#version-archive>`_ by typing:
15+
16+
- ``wget https://releases.mattermost.com/X.X.X/mattermost-X.X.X-linux-amd64.tar.gz``
17+
- Where ``vX.X.X`` is the latest version.
18+
19+
4. Extract the Mattermost Server files by typing:
20+
21+
- ``sudo tar -xvzf *.gz``
22+
23+
5. Change the user and group of the extracted files to mattermost
24+
25+
- ``sudo chown -R mattermost:mattermost mattermost/``
26+
27+
6. Create the storage directory for files. We assume you will have
28+
attached a large drive for storage of images and files. For this
29+
setup we will assume the directory is located at
30+
``/mattermost/data``.
31+
32+
- Create the directory by typing:
33+
- ``sudo mkdir -p /mattermost/data``
34+
- Set the mattermost account as the directory owner by typing:
35+
- ``sudo chown -R mattermost:mattermost /mattermost``
36+
37+
7. Configure Mattermost Server by editing the config.json file at
38+
``/home/mattermost/config``
39+
40+
- ``cd /home/mattermost/mattermost/config``
41+
- Edit the file by typing:
42+
- ``vi config.json``
43+
- If you are using PostgreSQL:
44+
- Set ``DriverName":`` to ``"postgres"``
45+
- Set ``"DataSource:"`` to the following value: ``"postgres://mmuser:mmuser_password@10.10.10.1:5432/mattermost?sslmode=disable&connect_timeout=10"``
46+
- If you are using MySQL:
47+
- Set ``DriverName":`` to ``"mysql"``
48+
- Set ``"DataSource":`` to the following value: ``"mmuser:mmuser_password@tcp(10.10.10.1:3306)/mattermost?charset=utf8"``
49+
- You can continue to edit configuration settings in
50+
``config.json`` or use the System Console described in a later
51+
section to finish the configuration.
52+
53+
8. Test the Mattermost Server
54+
55+
- ``cd ~/mattermost/bin``
56+
- Run the Mattermost Server by typing:
57+
- ``./platform``
58+
- You should see a console log like ``Server is listening on :8065``
59+
letting you know the service is running.
60+
- Stop the server for now by typing ``ctrl-c``
61+
62+
9. Setup Mattermost to use the Upstart daemon which handles supervision
63+
of the Mattermost process.
64+
65+
- ``sudo touch /etc/init/mattermost.conf``
66+
- ``sudo vi /etc/init/mattermost.conf``
67+
- Copy the following lines into ``/etc/init/mattermost.conf``
68+
69+
::
70+
71+
start on runlevel [2345]
72+
stop on runlevel [016]
73+
respawn
74+
limit nofile 50000 50000
75+
chdir /home/mattermost/mattermost
76+
setuid mattermost
77+
exec bin/platform
78+
79+
- You can manage the process by typing:
80+
- ``sudo start mattermost``
81+
- Verify the service is running by typing:
82+
- ``curl http://10.10.10.2:8065``
83+
- You should see a page titles *Mattermost - Signup*
84+
- You can also stop the process by running the command
85+
``sudo stop mattermost``, but we will skip this step for now.

0 commit comments

Comments
 (0)