User Tools

Site Tools


blog

Setup up Mattermost with existing Gitlab

Based on

I was trying to set up mattermost with Gitlab I have installed on an Apache2 server in Ubuntu from source. The follow procedure proved to work for me.

Install Docker

  • Download and install Docker
    sudo apt-get update
    sudo apt-get install wget
    wget -qO- https://get.docker.com/ | sh
    sudo usermod -aG docker <username>
    sudo service docker start
    newgrp docker
  • Set up your dockerhost address by editing your /etc/hosts file to include the following line
    127.0.0.1 dockerhost
  • Install build essentials
    apt-get install build-essential

Install Go

If you installed the Gitlab 8+, you should already have GO installed.

Install Node.js

curl -sL https://deb.nodesource.com/setup_5.x | sudo -E bash -
sudo apt-get install -y nodejs

Install mysql server 5.6 or above

sudo apt-get update
sudo apt-get install mysql-server-5.6

After that, create a databased called mattermost

Mattermost Server

  • Download the latest Mattermost Server by typing:
    wget https://releases.mattermost.com/2.2.0/mattermost-team-2.2.0-linux-amd64.tar.gz
    tar -xvzf mattermost.tar.gz
  • Create the storage directory for files.
    sudo mkdir -p /mattermost/data
    sudo chown -R username /mattermost
  • Configure Mattermost Server by editing the config.json file at mattermost/config
    • cd ~/mattermost/config
    • Edit the file by typing: nano config.json
    • replace DataSource“: “mmuser:mostest@tcp(dockerhost:3306)/mattermost?charset=utf8mb4,utf8 with your own mysql database name and password
  • Test the Mattermost Server
    cd ~/mattermost/bin
    ./platform

    You should see a console log like

    Server is listening on :8065

    if it runs correctly.

  • Stop the server for now by pressing ctrl-c
  • Setup Mattermost to use the Upstart daemon which handles supervision of the Mattermost process.
    sudo nano /etc/init/mattermost.conf

    Copy the following lines into /etc/init/mattermost.conf

    start on runlevel [2345]
    stop on runlevel [016]
    respawn
    chdir /home/ubuntu/mattermost
    setuid ubuntu
    exec bin/platform
  • Test the setup by starting the service using
    sudo start mattermost

    Verify the service is running by typing: curl

    http://127.0.0.1:8065

    You should see a page titles Mattermost - Signup if running correctly.

Setup up the Apache2 server

  • Create a config file using
    sudo nano /etc/apache2/sites-available/mattermost.conf
  • In the file, include the following (note to change your domain name):
     <VirtualHost *:80>
      ServerName mattermost.xxx.org
    
      ProxyPreserveHost On
      RewriteEngine     On
    
      RewriteCond %{REQUEST_URI}  ^/api/v1/websocket      [NC,OR]
      RewriteCond %{HTTP:UPGRADE} ^WebSocket$             [NC,OR]
      RewriteCond %{HTTP:CONNECTION} ^Upgrade$            [NC]
      RewriteRule .* ws://127.0.0.1:8065%{REQUEST_URI}   [P,QSA,L]
    
      RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME}    !-f
      RewriteRule .* http://127.0.0.1:8065%{REQUEST_URI} [P,QSA,L]
    
      # Be sure to uncomment the next 2 lines if https is used
      # RequestHeader set X-Forwarded-Proto "https"
      # Header set Strict-Transport-Security "max-age=31536000; includeSubDomains"
    
    
      # Prevent apache from sending incorrect 304 status updates
      RequestHeader unset If-Modified-Since
      RequestHeader unset If-None-Match
    
      <Location /api/v1/websocket>
         Require all granted
         ProxyPassReverse ws://127.0.0.1:8065/api/v1/websocket
         ProxyPassReverseCookieDomain 127.0.0.1 mattermost.xxx.org
      </Location>
    
      <Location />
         Require all granted
         ProxyPassReverse http://127.0.0.1:8065/
         ProxyPassReverseCookieDomain 127.0.0.1 mattermost.xxx.org
      </Location>
    </VirtualHost>
     
  • Start the service by using
    sudo a2enmod proxy
    sudo a2enmod proxy_balancer
    sudo a2enmod proxy_http
    sudo a2enmod mod_proxy_wstunnel
    sudo a2enmod headers
    sudo a2ensite mattermost
    sudo service apache2 reload

Then you can point to mattermost in your web browser.

Using Gitlab as Single-Sign-On

2016/04/22 16:37 · johnny · 0 Comments · 0 Linkbacks

LyX on Mac error converting to loadable format

When installing LyX on Mac, one might experience the error “error converting to loadable format” when including pdf files. This is likely because of missing of ImageMagick. To fix the problem, you will need to install ImageMagick. To do it, the following steps need to follow.

  1. Install Xcode from App store.
  2. Once you have Xcode installed, open a terminal, run xcode-select –install, and click the Install button to install the required command line developer tools.
  3. Install ImageMagick using sudo port install ImageMagick in terminal
2016/03/29 13:18 · johnny · 0 Comments · 0 Linkbacks

Delete large number of files

I had to delete thousands of files. The command “rm” simply took forever. Then I learned you can use rsync to do the job.

First, create an empty directory such as

mkdir empty

Then, rsync it with the folder you want to delete using

rsync -av --delete empty/    todelete/

This is super fast comparing to rm.

Using perl

perl -e 'for(<*>){((stat)[9]<(unlink))}'
2016/02/03 10:39 · johnny · 0 Comments · 0 Linkbacks

Record desktop videos using VLC media player

https://www.vlchelp.com/how-to-record-desktop/

To record mouse, add the following options instead

:screen-follow-mouse :screen-mouse-image=file:///C:/Users/Pictures/Mouse.png
2015/09/11 13:52 · johnny · 0 Comments · 0 Linkbacks

<< Newer entries | Older entries >>


Note. Everything on this blog only reflects my personal view which may or may not be true and is not related to any organization or institute.

blog.txt · Last modified: 2024/09/17 13:50 by johnny