Mattermost, Inc.

Installing GitLab from source and configuring GitLab Mattermost

Hi,

I’ve seen the documentation to enable mattermost from omnibus package. However, we have install from source. Is there a documentation how to enable it from gitlab source? If not, is there an unofficial guide to enabling it and running on the same server as gitlab?

1 Like

hi @alexjironkin,

Mattermost Beta2 will include production install instructions, along with new admin tools both for web and command line, draft is here: Mattermost Beta1 Production Install

GitLab Mattermost SSO configuration instructions can be found here: https://github.com/mattermost/platform/blob/master/doc/integrations/sso/gitlab-sso.md

The omnibus config settings would be the recommended deployment (e.g. require GitLab SSO for team creation, disable creation of teams from email accounts by default, etc.).

We’d recommend taking the GitLab Mattermost bits from the omnibus (rather than the latest Mattermost bits), because the config settings in omnibus will apply to that version specifically.

Please let us know if these work?

Hi,

I’ve followed the instructions in your linked post and it seemed to have setup correctly:

[09/16/15 15:55:52] [INFO] Loading config file at /data/apps/mattermost/mattermost/config/config.json
[09/16/15 15:55:52] [EROR] Misconfigured feedback email setting:
[09/16/15 15:55:52] [EROR] Email settings are not valid err=CheckMailSettings: No email settings present, mail will not be sent,
[09/16/15 15:55:52] [INFO] Server is initializing…
[09/16/15 15:55:52] [INFO] Pinging sql master database at ‘postgres://mmuser:mostest@158.119.147.72:5432/mattermost?sslmode=disable&connect_timeout=10’
[09/16/15 15:55:52] [INFO] Pinging sql replica-0 database at ‘postgres://mmuser:mostest@158.119.147.72:5432/mattermost?sslmode=disable&connect_timeout=10’
[09/16/15 15:55:53] [DEBG] Initializing user api routes
[09/16/15 15:55:53] [DEBG] Initializing team api routes
[09/16/15 15:55:53] [DEBG] Initializing channel api routes
[09/16/15 15:55:53] [DEBG] Initializing post api routes
[09/16/15 15:55:53] [DEBG] Initializing web socket api routes
[09/16/15 15:55:53] [DEBG] Initializing file api routes
[09/16/15 15:55:53] [DEBG] Initializing command api routes
[09/16/15 15:55:53] [DEBG] Initializing config api routes
[09/16/15 15:55:53] [DEBG] Parsing server templates at /data/apps/mattermost/mattermost/api/templates/
[09/16/15 15:55:53] [DEBG] Initializing web routes
[09/16/15 15:55:53] [DEBG] Using static directory at /data/apps/mattermost/mattermost/web/static/
[09/16/15 15:55:53] [DEBG] Parsing templates at /data/apps/mattermost/mattermost/web/templates/
[09/16/15 15:55:53] [INFO] Starting Server…
[09/16/15 15:55:53] [INFO] Server is listening on 8065
[09/16/15 15:55:53] [INFO] RateLimiter is enabled

However, when I tried to access via browser I got “No route to host”. I tried setting up proxypass on apache (like I have gitlab running) using “/mettermost” as suffix I got

[09/16/15 15:56:21] [DEBG] /mattermost
[09/16/15 15:56:21] [EROR] Couldn’t find team name=mattermost, teamURL=http://158.119.147.111:8065/mattermost, err=We couldn’t find the existing team

Which I am guessing didn’t work. I tried just setup virtual host on *:8065 setting Documentroot to “web”. But I get nothing.

However, if I try plain curl localhost:8065 or full ip address, I get an HTML page out. So I figured there is a problem with my apache config. Do you have an example for apache, nit nginx?

Alex

Hey @alexjironkin I’m not sure how much help this will be as my setup isn’t working either, but my installation seems to have different issues than yours. Here is how I setup my Apache virtual host:

<VirtualHost *:443>
	ServerName mattermost.alerque.com
	DocumentRoot /usr/share/webapps/mattermost/web

	SSLEngine on
	SSLCertificateFile    /etc/httpd/ssl.crt/alerque.com.crt
	SSLCertificateKeyFile /etc/httpd/ssl.key/alerque.com.key

	ProxyPreserveHost On

	RewriteEngine On
	RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f
	RewriteRule .* http://127.0.0.1:8065%{REQUEST_URI} [P,QSA]
	RequestHeader set X_Forwarded_Proto "https"

	<Location />
		Require all granted
		ProxyPassReverse https://mattermost.alerque.com/
	</Location>

	LogFormat "%{X-Forwarded-For}i %l %u %t \"%r\" %>s %b" common_forwarded
	ErrorLog  /var/log/httpd/mattermost.alerque.com_error.log
	CustomLog /var/log/httpd/mattermost.alerque.com_forwarded.log common_forwarded
	CustomLog /var/log/httpd/mattermost.alerque.com_access.log combined env=!dontlog
	CustomLog /var/log/httpd/mattermost.alerque.com.log combined
</VirtualHost>

Note this is for Apache 2.4 and an SSL enabled virtual host. A separate config handles redirecting non SSL requests from port 80 to this virtual host. If you are not using SSL you would obviously drop the SSL* config items and run this on *:80 or your name based equivalent. Also it looks like you are trying to use a folder path rather than a dedicated subdomain so you will need to use different path specs for both the rewrite rule and the location block.

Again this may or may not actually be right as I have problems of my own, but I think I’m passed the error you are hitting because I at least get a functional site through the proxy.

I have rejigged apache conf and moved mattermost to separate server for now. But it all works like a charm.

Alex

@alexjironkin In order to make this thread really useful to future visitors can you note what config changes exactly solved your problem and whether you “jiggered” your Apache config to match the one I posted or whether you configured it differently? Or did you actually not solve this problem and only sidestep it by running on separate servers?

Sure.

My setup is running on Centos 6 and Apache 2.2 with user “mattermost”. The archive was extracted directly into the home folder.

THIS IS A VERY SIMPLE AND NAIVE SETUP TO GET MATTERMOST TO WORK. NOT SECURE.

<VirtualHost *:80>

        DocumentRoot /home/mattermost/web

        ProxyPreserveHost On

        RewriteEngine On
        RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f
        RewriteRule .* http://127.0.0.1:8065%{REQUEST_URI} [P,QSA]

        <Location />
                ProxyPassReverse http://127.0.0.1:8065/
        </Location>

        LogFormat "%{X-Forwarded-For}i %l %u %t \"%r\" %>s %b" common_forwarded
        ErrorLog  /var/log/httpd/mattermost_error.log
        CustomLog /var/log/httpd/mattermost_forwarded.log common_forwarded
        CustomLog /var/log/httpd/mattermost_access.log combined env=!dontlog
        CustomLog /var/log/httpd/mattermost.log combined
</VirtualHost>

Change SE policy:

setsebool httpd_can_network_connect true

I also had to enable SELinux for /home/mattermost/web using:

chcon -R -t httpd_sys_content_t /home/mattermost/web
chcon -R -t httpd_sys_content_t /home/mattermost
chcon -R -t httpd_sys_content_t /home

The conf from the linked post wouldn’t work for me on Centos so I made a simple init.d script:

#!/bin/bash
# mattermost daemon
# chkconfig: 345 20 80
# description: mattermost daemon
# processname: mattermost

DAEMON_PATH="/home/mattermost"
    
NAME=mattermost
DESC="Matter most team chat"
PIDFILE=/var/run/$NAME.pid
SCRIPTNAME=/etc/init.d/$NAME

case "$1" in
start)
        printf "%-50s" "Starting $NAME..."
        cd $DAEMON_PATH
        PID=`su -c './bin/platform > /dev/null 2>&1 & echo $!' mattermost`
        #echo "Saving PID" $PID " to " $PIDFILE
        if [ -z $PID ]; then
            printf "%s\n" "Fail"
        else
            echo $PID > $PIDFILE
            printf "%s\n" "Ok"
        fi
;;
status)
        printf "%-50s" "Checking $NAME..."
        if [ -f $PIDFILE ]; then
            PID=`cat $PIDFILE`
            if [ -z "`ps axf | grep ${PID} | grep -v grep`" ]; then
                printf "%s\n" "Process dead but pidfile exists"
            else
                echo "Running"
            fi
        else
            printf "%s\n" "Service not running"
        fi
;;
stop)
        printf "%-50s" "Stopping $NAME"
            PID=`cat $PIDFILE`
            cd $DAEMON_PATH
        if [ -f $PIDFILE ]; then
            kill -HUP $PID
            printf "%s\n" "Ok"
            rm -f $PIDFILE
        else
            printf "%s\n" "pidfile not found"
        fi
;;

restart)
        $0 stop
        $0 start
;;

*)
        echo "Usage: $0 {status|start|stop|restart}"
        exit 1
esac
1 Like

The server I have is also running Postgres 9.1 (the requirement in the link was 9.3+). For older and “more stable” distros like Centos, 9.2 sometimes is the latest version (or 9.1 in my case) I am not sure, if 9.3+ is a hard requirement and something will break down the line.