The Funtoo Linux project has transitioned to "Hobby Mode" and this wiki is now read-only.
Difference between revisions of "Package:Mattermost Server Binary"
m |
m |
||
Line 57: | Line 57: | ||
{{warning|Failing to set the correct permissions on the data folder will cause file uploads to fail, as well as forgetting to edit config.json to point to the right folder.}} | {{warning|Failing to set the correct permissions on the data folder will cause file uploads to fail, as well as forgetting to edit config.json to point to the right folder.}} | ||
{{warning|Mattermost currently exhibits strange behavior when launched through an init script. We'll use | {{warning|Mattermost currently exhibits strange behavior when launched through an init script. We'll use | ||
simple shell scripts with the start-stop-daemon command to emulate openRC.}} | simple shell scripts with the start-stop-daemon command to emulate openRC.}} | ||
Line 89: | Line 88: | ||
}} | }} | ||
Mattermost is now correctly installed. The only file that still requires editing is /opt/mattermost/config/config.json, which is the main configuration file. | |||
==Configuring MySQL== | ==Configuring MySQL== | ||
Login into MySQL: | |||
{{console|body= | |||
###i## mysql -u root -p | |||
}} | |||
Run the following command to create the mysql user for mattermost: | |||
{{console|body= | |||
mysql> create user 'mmuser'@'%' identified by 'mmuser-password'; | |||
}} | |||
the % means to listen on any ip address. This should be changed to a more secure default, like | |||
127.0.0.1 for localhost. | |||
Substitute the values for 'mmuser' and 'mmuser-password' with your own values. | |||
Create the Mattermost database: | |||
{{console|body= | |||
mysql> create database mattermost; | |||
}} | |||
Grant all privileges on the mattermost database to the user 'mmuser': | |||
{{console|body= | |||
mysql> grant all privileges on mattermost.* to 'mmuser'@'%'; | |||
}} | |||
Exit mysql: | |||
{{console|body= | |||
mysql> quit; | |||
}} | |||
Check what port mysql is listening on: | |||
{{console|body= | |||
###i## netstat -tlpn | |||
}} | |||
{{console|body= | |||
tcp 0 0 127.0.0.1:3306 0.0.0.0:* LISTEN 857/mysqld | |||
}} | |||
Mysql is listening on port 3306. We'll need this information in the next step. | |||
Now we need to configure the main configuration file to tell Mattermost to use MySQL and the created user and table. | |||
{{file|name=/opt/mattermost/config/config.json|desc=main configuration file file|body= | |||
"SqlSettings": { | |||
"DriverName": "mysql", | |||
"DataSource": "mmuser:mmpassword@tcp(127.0.0.1:3306)/mattermost?charset=utf8mb4,utf8", | |||
}} | |||
Save and exit the file. | |||
Test that Mattermost is working: | |||
{{console|body= | |||
###i## sudo -u mattermost ./platform | |||
}} | |||
{{EbuildFooter}} | {{EbuildFooter}} |
Revision as of 22:51, February 13, 2017
Mattermost Server Binary
We welcome improvements to this page. To edit this page, Create a Funtoo account. Then log in and then click here to edit this page. See our editing guidelines to becoming a wiki-editing pro.
The ebuild is currently not available. The article will directly use the binaries provided on the Mattermost website
Mattermost is a messaging client that offers persistent storage of messages and file sharing. It also allows integration of audio, video, images, gifs, code snippets into messages as well. It also allows audio and video calls through WebRTC. If IRC was raw text, Mattermost would be its rich text counterpart. Mattermost also works with all major operating systems and is also available as a mobile app and as a webpage. Mattermost can also bridge to IRC, which is a separate topic. We'll cover the basic configuration of Mattermost with MySQL, postfix, NGINX and SSL certificates obtained with Letsencrypt.
Prerequisites
Mattermost at the moment doesn't seem to support UNIX sockets. While configuring postfix (for user email verification) isn't required in preview mode, it's recommended if you're running Mattermost in production Please see http://www.funtoo.org/Package:Postfix on how to configure Postfix to use ports instead of UNIX sockets.
Please also see the article on NGINX on how to install it http://www.funtoo.org/Package:Nginx and see the article on how to install mysql http://www.funtoo.org/Package:MySQL
We'll assume Mattermost, Postfix, NGINX and MySQL are running on the same server. A separate guide on configuring Mattermost to run on multiple servers will be written at a certain point in the future. We'll assume the domain for Mattermost is chat.example.com, and we're installing Mattermost in /opt/mattermost.
We'll also assume you correctly obtained the SSL certificates for your website with Package:App-crypt/certbot and configured NGINX to use them.
Refer to the RHEL 6.6 guide to installing Mattermost. It'll be heavily referenced here. https://docs.mattermost.com/install/install-rhel-66.html
Installing Mattermost binaries
Let's get started. First, fetch the Mattermost binaries from the website and install them in /opt:
root # wget https://releases.mattermost.com/3.6.2/mattermost-3.6.2-linux-amd64.tar.gz
root # tar -xvf mattermost-3.6.2-linux-amd64.tar.gz -C /opt
Create the storage directory where all the files and images that are uploaded to Mattermost are stored. We'll use /var/mattermost/data as the data folder:
root # mkdir -p /var/mattermost/data
Edit the main configuration file to point to the right directory for storing files:
/opt/mattermost/config/config.json
- main configuration file file"FileSettings": {
"MaxFileSize": 52428800,
"DriverName": "local",
"Directory": "/var/mattermost/data/",
"EnablePublicLink": false,
Create a system user and group called mattermost to run the service:
root # sudo useradd --system --user-group mattermost root # sudo chown -R mattermost:mattermost /opt/mattermost root # sudo chmod -R g+w /opt/mattermost root # sudo chown -R mattermost:mattermost /var/mattermost/data
Failing to set the correct permissions on the data folder will cause file uploads to fail, as well as forgetting to edit config.json to point to the right folder.
Mattermost currently exhibits strange behavior when launched through an init script. We'll use simple shell scripts with the start-stop-daemon command to emulate openRC.
Create the start script:
/usr/sbin/start-mattermost
- start script file#!/bin/sh
echo "starting mattermost"
cd /opt/mattermost/bin/
start-stop-daemon --start --background --exec ./platform -u mattermost
make sure to make the scripts executable:
root # chmod +x /usr/sbin/start-mattermost
Create the stop script:
/usr/sbin/start-mattermost
- stop script file#!/bin/sh
echo "stopping mattermost"
cd /opt/mattermost/bin/
start-stop-daemon --stop --exec ./platform -u mattermost
make sure to make the scripts executable:
root # chmod +x /usr/sbin/stop-mattermost
These scripts have the disadvantage of mattermost being listed as "platform" in programs like top and htop. You can rename the binary /opt/mattermost/bin/platfrom to /opt/mattermost/bin/mattermost . Make sure to rename ./platform to ./mattermost in the above script.
Mattermost is now correctly installed. The only file that still requires editing is /opt/mattermost/config/config.json, which is the main configuration file.
Configuring MySQL
Login into MySQL:
root # mysql -u root -p
Run the following command to create the mysql user for mattermost:
mysql> create user 'mmuser'@'%' identified by 'mmuser-password';
the % means to listen on any ip address. This should be changed to a more secure default, like 127.0.0.1 for localhost. Substitute the values for 'mmuser' and 'mmuser-password' with your own values.
Create the Mattermost database:
mysql> create database mattermost;
Grant all privileges on the mattermost database to the user 'mmuser':
mysql> grant all privileges on mattermost.* to 'mmuser'@'%';
Exit mysql:
mysql> quit;
Check what port mysql is listening on:
root # netstat -tlpn
tcp 0 0 127.0.0.1:3306 0.0.0.0:* LISTEN 857/mysqld
Mysql is listening on port 3306. We'll need this information in the next step.
Now we need to configure the main configuration file to tell Mattermost to use MySQL and the created user and table.
/opt/mattermost/config/config.json
- main configuration file file"SqlSettings": {
"DriverName": "mysql",
"DataSource": "mmuser:mmpassword@tcp(127.0.0.1:3306)/mattermost?charset=utf8mb4,utf8",
Save and exit the file. Test that Mattermost is working:
root # sudo -u mattermost ./platform