Mattermost, Inc.

Problem following instructions installing Mattermost 2.2.0 in Ubuntu 14.04 + connecting 3 ubuntu machines

Hello everyone!

I am a newbie here, and a newbie in programming, and I got a task to install Mattermost on DigitalOcean VPS. Using Ubuntu 14.04. I know most of the problem is due to my lack of knowledge in programming/terminal/or reading documentation. And my purpose to install Mattermost is for my school district, so that teachers can try an alternative to teaching via Mattermost.

I am using:

So far here’s what I have done, and where I have failed:

Creating 3 machines

  • Go create 3 machines with Ubuntu 14.04 with 2GB of RAM
  • Completed the sudo apt-get update and sudo apt-get upgrade
  • I understood that there are 3 new IP that I got from my VPS provider

Tried Setting up database server (failed)

Completed step 1 to 13, and error is shown on the last step as pasted below:

root@Mattermost-dbserver:~# sudo /etc/init.d/postgresql reload
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LANGUAGE = (unset),
LC_ALL = (unset),
LC_CTYPE = “UTF-8”,
LANG = "en_US.UTF-8"
are supported and installed on your system.
perl: warning: Falling back to the standard locale (“C”).
Error: Invalid line 59 in /etc/postgresql/9.3/main/postgresql.conf: »listen_addresses = * # what IP address(es) to listen on;
«

  • No PostgreSQL clusters exist; see "man pg_createcluster"
    root@Mattermost-dbserver:~#

it only goes away when I removed the '*' and change it to 'localhost'

Tried to setup Mattermost Server

I dont understand the first 3 step

For the purposes of this guide we will assume this server has an IP address of 10.10.10.2
For the sake of making this guide simple we located the files at /home/ubuntu/mattermost. In the future we will give guidance for storing under /opt.
We have also elected to run the Mattermost Server as the ubuntu account for simplicity. We recommend setting up and running the service under a mattermost user account with limited permissions.

  • I managed to download and unzip the file
  • step 6 Failed
  • I managed to change the config on step 7
  • the rest does not work

Tried Setting up Nginx server

will update this post as soon as I completed it

solved the first part I mistakenly typed * instead of ‘*’

But now still stuck in installing the mattermost server

curl: (7) Failed to connect to 188.166.237.217 port 8065: Connection refused

Hi Doodlebaa,

I think the first 3 steps are bad formatting they are really notes about the process.

Can you post the output of the ./platform command? It will help debug your issue.

Christopher

Hello Christopher,

I am in the middle of rewriting of all steps that I took in my machine.
Maybe, just maybe, if possible and helpful this guide may be used to help Mattermost community.


End Product:

  • Using Mattermost for teachers to teach
  • Approximately 150 user per cohort for 10 cohorts = 1500 user

Please advise for better hardware setup, if necessary.


Install Ubuntu Server (x64) 14.04 LTS Machines in Digital Ocean

  • Go To Digital Ocean Hosting Page
  • Select Ubuntu 14.04x
  • Pick 2GB ram option
  • Choose server nearest to my users (Singapore)
  • Use SSH for increased security
  • Rename droplets to 3 names (Mattermost-DB, Mattermost-Server, and Mattermost-Nginx)

This step completed & succeeded

##Digital Ocean Specific Step “Preparing the Ubuntu Machine”:
Get Inside Terminal and type:

ssh root@10.10.10.1

Setting up locale (this is known problem in Digital Ocean)

  • export LANGUAGE=en_US.UTF-8
  • export LC_ALL=en_US.UTF-8
  • locale -a

Update system with latest security patches

  • sudo apt-get update
  • sudo apt-get upgrade

This step completed & Succeeded


Installing Mattermost DB Server

Get inside my Terminal:

ssh root@10.10.10.1

Install Postgres on Ubuntu Machine

  • sudo apt-get install postgresql postgresql-contrib

Login to psql shell and create a new mmuser user:

  • sudo -i -u postgres
  • psql
  • CREATE DATABASE mmdb;
  • CREATE USER mmuser WITH PASSWORD 'mmuser_password';
  • GRANT ALL PRIVILEGES ON DATABASE mmdb to mmuser;
  • \q
  • exit

This part will be edited again
Reminder: if you change mmuser and mmuser password, please remember to be consistet across the changes.

Allow Postgres to listen on all assigned IP Address

  • sudo vi /etc/postgresql/9.3/main/postgresql.conf
  • Uncomment ‘listen_addresses’ and change 'localhost to '*'
    remember in this part if you don’t understand how to use vi, you can use i to insert and esc then typing :wq! to save and quit.
    About this vi thing, I just learned about it and took about 6 hours to realize it.

Alter pg_hba.conf to allow connectionto Mattermost Server

  • sudo vi /etc/postgresql/9.3/main/pg_hba.conf
  • Add the following line to the ‘IPv4 local connections’
  • host all all 10.10.10.2/32 md5

DO NOT REMOVE the existing 127.0.0.0/32/md5

Reload Postgres Database

  • sudo /etc/init.d/postgresql reload

Attempt to connect

  • psql --host=10.10.10.1 --dbname=mattermost --username=mmuser --password
  • Password prompt will come out and enter mmuser_password as your password

To Close The setup

\q


@crspeller Hello Christopher

root@Mattermost-DB:~# ./platform
-bash: ./platform: No such file or directory
This is the result from the Mattermost DB 10.10.10.1

I actually fixed this problem before, but it happened again.

psql: could not connect to server: Connection refused
Is the server running on host “188.166.208.165” and accepting
TCP/IP connections on port 5432?

For the first issue. It looks like your on the wrong server? Should be on Mattermost-Server for running the platform command. Also you should do cd mattermost/bin then run ./platform. The platform binary is in the mattermost/bin directory.

For the second issue, are you running psql on the DB server? You should run it there.

Hello @crspeller Thank you so much for helping me.

I am actually a math postgrad who is trying to do programming on my own, since my programmer partner is hospitalized for quite some time. Sorry if my lack of knowledge surprise you.

I actually destroyed the droplet to do clean reinstall.

The psql is installed in Mattermost-DB

The ./platform is run in Mattermost-Server, and i got the problem here:

Here are the two guides i am using:

Hello @crspeller, I got blocked by akismet.

For the previous question, I did redo on the platform

root@Mattermost-Server:/opt/timmy/mattermost/mattermost/bin# ./platform
[15:16:57 EDT 2016/04/28] [INFO] (github.com/mattermost/platform/utils.GetTranslationsBySystemLocale:52) Loaded system translations for ‘en’ from ‘/opt/timmy/mattermost/mattermost/i18n/en.json’
[2016/04/28 15:16:57 EDT] [INFO] Current version is 2.2.0 (6671/Fri Apr 15 18:40:19 UTC 2016/8e883ad2f516820942cc0131241268c1ea909ff3)
[2016/04/28 15:16:57 EDT] [INFO] Enterprise Enabled: false
[2016/04/28 15:16:57 EDT] [INFO] Current working directory is /opt/timmy/mattermost/mattermost/bin
[2016/04/28 15:16:57 EDT] [INFO] Loaded config file from /opt/timmy/mattermost/mattermost/config/config.json
[2016/04/28 15:16:57 EDT] [INFO] Server is initializing…
[2016/04/28 15:16:57 EDT] [INFO] Pinging sql master database
[2016/04/28 15:16:57 EDT] [CRIT] Failed to ping db err:dial tcp: lookup dockerhost on 8.8.8.8:53: no such host
panic: Failed to open sql connection dial tcp: lookup dockerhost on 8.8.8.8:53: no such host

goroutine 1 [running]:
github.com/mattermost/platform/store.setupConnection(0xcc0a58, 0x6, 0xc82032b930, 0x5, 0xc820477db0, 0x48, 0xa, 0xa, 0xc820217900, 0xc81ffef197)
/go/src/github.com/mattermost/platform/store/sql_store.go:169 +0x894
github.com/mattermost/platform/store.NewSqlStore(0x0, 0x0)
/go/src/github.com/mattermost/platform/store/sql_store.go:61 +0x11c
github.com/mattermost/platform/api.NewServer()
/go/src/github.com/mattermost/platform/api/server.go:35 +0xe8
main.main()
/go/src/github.com/mattermost/platform/mattermost.go:67 +0x74d

goroutine 17 [syscall, locked to thread]:
runtime.goexit()
/usr/local/go/src/runtime/asm_amd64.s:1721 +0x1

goroutine 5 [syscall]:
os/signal.loop()
/usr/local/go/src/os/signal/signal_unix.go:22 +0x18
created by os/signal.init.1
/usr/local/go/src/os/signal/signal_unix.go:28 +0x37

goroutine 245 [select]:
github.com/alecthomas/log4go.NewFileLogWriter.func1(0xc820130f00)
/go/src/github.com/mattermost/platform/Godeps/_workspace/src/github.com/alecthomas/log4go/filelog.go:87 +0xabc
created by github.com/alecthomas/log4go.NewFileLogWriter
/go/src/github.com/mattermost/platform/Godeps/_workspace/src/github.com/alecthomas/log4go/filelog.go:119 +0x38b

goroutine 244 [chan receive]:
github.com/alecthomas/log4go.(*ConsoleLogWriter).run(0xc82036fae0, 0x7ff6cdddd1e8, 0xc820026010)
/go/src/github.com/mattermost/platform/Godeps/_workspace/src/github.com/alecthomas/log4go/termlog.go:33 +0x69
created by github.com/alecthomas/log4go.NewConsoleLogWriter
/go/src/github.com/mattermost/platform/Godeps/_workspace/src/github.com/alecthomas/log4go/termlog.go:26 +0xb5

goroutine 246 [chan receive]:
database/sql.(*DB).connectionOpener(0xc820130fa0)
/usr/local/go/src/database/sql/sql.go:634 +0x45
created by database/sql.Open
/usr/local/go/src/database/sql/sql.go:481 +0x336
Fist of all… I got confused on several things for the second server

  1. which directory I should install mattermost on?
    Instead of /home/ubuntu/mattermost i wrote opt/timmy/mattermost
    then i downloaded the file there and use tar.gz there.

  2. How to create the ubuntu user, (in my case renamed timmy)?
    I used this line from rosehosting

sudo adduser --home /opt/timmy --shell /bin/bash --gecos ‘Mattermost application’ timmy
sudo install -d -m 755 -o timmy -g timmy /opt/timmy

Hello @crspeller and @it33 :smile:
Thanks for making Mattermost!

  • The Mattermost DB setup correctly
  • Nginx is setup correctly (nginx page come out, etc)
    One problem left, it seems connecting the 3 machines gives out error

Here’s the prompt after ./platform

2016/04/29 03:31:07 EDT] [INFO] Current version is 2.2.0 (6671/Fri Apr 15 18:40:19 UTC 2016/8e883ad2f516820942cc0131241268c1ea909ff3)
[2016/04/29 03:31:07 EDT] [INFO] Enterprise Enabled: false
[2016/04/29 03:31:07 EDT] [INFO] Current working directory is /opt/timmyterpinter/mattermost/mattermost/bin
[2016/04/29 03:31:07 EDT] [INFO] Loaded config file from /opt/timmyterpinter/mattermost/mattermost/config/config.json
[2016/04/29 03:31:07 EDT] [INFO] Server is initializing…
[2016/04/29 03:31:07 EDT] [INFO] Pinging sql master database
[2016/04/29 03:31:07 EDT] [CRIT] Failed to ping db err:dial tcp 188.166.253.88:5432: getsockopt: connection refused
panic: Failed to open sql connection dial tcp 188.166.253.88:5432: getsockopt: connection refused

goroutine 1 [running]:
github.com/mattermost/platform/store.setupConnection(0xcc0a58, 0x6, 0xc820327f30, 0x8, 0xc8200ea310, 0x68, 0xa, 0xa, 0xc8200e8500, 0xc81ffec76f)
/go/src/github.com/mattermost/platform/store/sql_store.go:169 +0x894
github.com/mattermost/platform/store.NewSqlStore(0x0, 0x0)
/go/src/github.com/mattermost/platform/store/sql_store.go:61 +0x11c
github.com/mattermost/platform/api.NewServer()
/go/src/github.com/mattermost/platform/api/server.go:35 +0xe8
main.main()
/go/src/github.com/mattermost/platform/mattermost.go:67 +0x74d

goroutine 17 [syscall, locked to thread]:
runtime.goexit()
/usr/local/go/src/runtime/asm_amd64.s:1721 +0x1

goroutine 20 [syscall]:
os/signal.loop()
/usr/local/go/src/os/signal/signal_unix.go:22 +0x18
created by os/signal.init.1
/usr/local/go/src/os/signal/signal_unix.go:28 +0x37

goroutine 199 [chan receive]:
database/sql.(*DB).connectionOpener(0xc820148320)
/usr/local/go/src/database/sql/sql.go:634 +0x45
created by database/sql.Open
/usr/local/go/src/database/sql/sql.go:481 +0x336

goroutine 197 [chan receive]:
github.com/alecthomas/log4go.(*ConsoleLogWriter).run(0xc8203afb40, 0x7f1652d5c1c0, 0xc82006c008)
/go/src/github.com/mattermost/platform/Godeps/_workspace/src/github.com/alecthomas/log4go/termlog.go:33 +0x69
created by github.com/alecthomas/log4go.NewConsoleLogWriter
/go/src/github.com/mattermost/platform/Godeps/_workspace/src/github.com/alecthomas/log4go/termlog.go:26 +0xb5

goroutine 198 [select]:
github.com/alecthomas/log4go.NewFileLogWriter.func1(0xc820148280)
/go/src/github.com/mattermost/platform/Godeps/_workspace/src/github.com/alecthomas/log4go/filelog.go:87 +0xabc
created by github.com/alecthomas/log4go.NewFileLogWriter
/go/src/github.com/mattermost/platform/Godeps/_workspace/src/github.com/alecthomas/log4go/filelog.go:119 +0x38b
root@Mattermost-Server:/opt/timmyterpinter/mattermost/mattermost/bin#

If you have the DB connection string correct in Mattermost, there isn’t a problem on our end. Likely you have to allow connections between the two machines in your hosting environment.