Этот коммит содержится в:
=Corey Hulen
2015-09-29 09:12:09 -07:00
родитель cd9158ddb1
Коммит 86d8c41e4d

Просмотреть файл

@@ -3,17 +3,17 @@
## Install Ubuntu Server 14.04 LTS ## Install Ubuntu Server 14.04 LTS
1. Set up 3 machines with Ubuntu 14.04 with 2GB of RAM or more. The servers will be used for the Load Balancer, Mattermost, and Database. 1. Set up 3 machines with Ubuntu 14.04 with 2GB of RAM or more. The servers will be used for the Load Balancer, Mattermost, and Database.
1. Make sure the system is up to date with the most recent security patches. 1. Make sure the system is up to date with the most recent security patches.
* ```~$ sudo apt-get update``` * ``` sudo apt-get update```
* ```~$ sudo apt-get upgrade``` * ``` sudo apt-get upgrade```
## Setup Database Server ## Setup Database Server
1. For the purposes of this guide we will assume this server has an IP address of 10.10.10.1 1. For the purposes of this guide we will assume this server has an IP address of 10.10.10.1
1. Install PostgreSQL 9.3+ (or MySQL 5.2+) 1. Install PostgreSQL 9.3+ (or MySQL 5.2+)
* ```~$ sudo apt-get install postgresql postgresql-contrib``` * ``` sudo apt-get install postgresql postgresql-contrib```
1. PostgreSQL created a user account called `postgres`. You will need to log into that account with: 1. PostgreSQL created a user account called `postgres`. You will need to log into that account with:
* ```~$ sudo -i -u postgres``` * ``` sudo -i -u postgres```
1. You can get a PostgreSQL prompt by typing: 1. You can get a PostgreSQL prompt by typing:
* ```~$ psql``` * ``` psql```
1. Create the Mattermost database by typing: 1. Create the Mattermost database by typing:
* ```postgres=# CREATE DATABASE mattermost;``` * ```postgres=# CREATE DATABASE mattermost;```
1. Create the Mattermost user by typing: 1. Create the Mattermost user by typing:
@@ -23,37 +23,37 @@
1. You can exit out of PostgreSQL by typing: 1. You can exit out of PostgreSQL by typing:
* ```postgre=# \q``` * ```postgre=# \q```
1. You can exit the postgres account by typing: 1. You can exit the postgres account by typing:
* ```~$ exit``` * ``` exit```
## Setup Mattermost Server ## Setup Mattermost Server
1. For the purposes of this guide we will assume this server has an IP address of 10.10.10.2 1. For the purposes of this guide we will assume this server has an IP address of 10.10.10.2
1. Download the lastest Mattermost Server by typing: 1. Download the latest Mattermost Server by typing:
* ```~$ wget https://github.com/mattermost/platform/releases/download/v1.0.0/mattermost.tar.gz``` * ``` wget https://github.com/mattermost/platform/releases/download/v1.0.0/mattermost.tar.gz```
1. Unzip the Mattermost Server by typing: 1. Unzip the Mattermost Server by typing:
* ```~$ tar -xvzf mattermost.tar.gz``` * ``` tar -xvzf mattermost.tar.gz```
1. 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`. 1. 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`.
1. We have also elected to run the Mattermost Server as the `ubuntu` account for simplicity. We recommend settings up and running the service under a `mattermost` user account with limited permissions. 1. We have also elected to run the Mattermost Server as the `ubuntu` account for simplicity. We recommend settings up and running the service under a `mattermost` user account with limited permissions.
1. Create the stoarge directory for files. We assume you will have attached a large drive for storage of images and files. For this setup we will assume the directory is located at `/mattermost/data`. 1. Create the storage directory for files. We assume you will have attached a large drive for storage of images and files. For this setup we will assume the directory is located at `/mattermost/data`.
* Create the direcotry by typing: * Create the directory by typing:
* ```~$ sudo mkdir -p /mattermost/data``` * ``` sudo mkdir -p /mattermost/data```
* Set the ubuntu account as the directory owner by typing: * Set the ubuntu account as the directory owner by typing:
* ```~$ sudo chown -R ubuntu /mattermost``` * ``` sudo chown -R ubuntu /mattermost```
1. Configure Mattermost Server by editing the config.json file at /home/ubuntu/mattermost/config` 1. Configure Mattermost Server by editing the config.json file at /home/ubuntu/mattermost/config`
* ```~$ cd ~/mattermost/config``` * ``` cd ~/mattermost/config```
* Edit the file by typing: * Edit the file by typing:
* ```~$ vi config.json``` * ``` vi config.json```
* replace `DriverName": "mysql"` with `DriverName": "postgres"` * replace `DriverName": "mysql"` with `DriverName": "postgres"`
* replace `"DataSource": "mmuser:mostest@tcp(dockerhost:3306)/mattermost_test?charset=utf8mb4,utf8"` with `"DataSource": "postgres://mmuser:mmuser_password@10.10.10.1:5432/mattermost?sslmode=disable&connect_timeout=10"` * replace `"DataSource": "mmuser:mostest@tcp(dockerhost:3306)/mattermost_test?charset=utf8mb4,utf8"` with `"DataSource": "postgres://mmuser:mmuser_password@10.10.10.1:5432/mattermost?sslmode=disable&connect_timeout=10"`
* Optionally you may continue to edit configuration settings in `config.json` or use the System Console described in a later section to finish the configuration. * Optionally you may continue to edit configuration settings in `config.json` or use the System Console described in a later section to finish the configuration.
1. Test the Mattermost Server 1. Test the Mattermost Server
* ```~$ cd ~/mattermost/bin``` * ``` cd ~/mattermost/bin```
* Run the Mattermost Server by typing: * Run the Mattermost Server by typing:
* ```~$ ./platform``` * ``` ./platform```
* You should see a console log like `Server is listening on :8065` letting you know the service is running. * You should see a console log like `Server is listening on :8065` letting you know the service is running.
* Stop the server for now by typing `ctrl-c` * Stop the server for now by typing `ctrl-c`
1. Setup Mattermost to use the Ubuntu Upstart daemon which handles supervision of the Mattermost process. 1. Setup Mattermost to use the Ubuntu Upstart daemon which handles supervision of the Mattermost process.
* ```~$ sudo touch /etc/init/mattermost.conf``` * ``` sudo touch /etc/init/mattermost.conf```
* ```~$ sudo vi /etc/init/mattermost.conf``` * ``` sudo vi /etc/init/mattermost.conf```
* Copy the following lines into `/etc/init/mattermost.conf` * Copy the following lines into `/etc/init/mattermost.conf`
``` ```
start on runlevel [2345] start on runlevel [2345]
@@ -64,32 +64,32 @@ setuid ubuntu
exec bin/platform exec bin/platform
``` ```
* You can manage the process by typing: * You can manage the process by typing:
* ```~$ sudo start mattermost``` * ``` sudo start mattermost```
* Verify the service is running by typing: * Verify the service is running by typing:
* ```~$ curl http://10.10.10.2:8065``` * ``` curl http://10.10.10.2:8065```
* You should see a page titles *Mattermost - Signup* * You should see a page titles *Mattermost - Signup*
* You can also stop the process by running the command `~$ sudo stop mattermost`, but we will skip this step for now. * You can also stop the process by running the command ` sudo stop mattermost`, but we will skip this step for now.
## Setup Nginx Server ## Setup Nginx Server
1. For the purposes of this guide we will assume this server has an IP address of 10.10.10.3 1. For the purposes of this guide we will assume this server has an IP address of 10.10.10.3
1. We use Nginx for proxying request to the Mattermost Server. The main benefits are: 1. We use Nginx for proxying request to the Mattermost Server. The main benefits are:
* SSL terminiation * SSL termination
* http to https redirect * http to https redirect
* Port mapping :80 to :8065 * Port mapping :80 to :8065
* Standard request logs * Standard request logs
1. Install Nginx on Ubuntu with 1. Install Nginx on Ubuntu with
* ```~$ sudo apt-get install nginx``` * ``` sudo apt-get install nginx```
1. Verify Nginx is running 1. Verify Nginx is running
* ```~$ curl http://10.10.10.3``` * ``` curl http://10.10.10.3```
* You should see a *Welcome to nginx!* page * You should see a *Welcome to nginx!* page
1. You can manage Nginx with the following commands 1. You can manage Nginx with the following commands
* ```~$ sudo service nginx stop``` * ``` sudo service nginx stop```
* ```~$ sudo service nginx start``` * ``` sudo service nginx start```
* ```~$ sudo service nginx restart``` * ``` sudo service nginx restart```
1. Map a FQDN (fully qualified domain name) like **mattermost.example.com** to point to the Nginx server. 1. Map a FQDN (fully qualified domain name) like **mattermost.example.com** to point to the Nginx server.
1. Configure Nginx to proxy connections from the internet to the Mattermost Server 1. Configure Nginx to proxy connections from the internet to the Mattermost Server
* Create a configuration for Mattermost * Create a configuration for Mattermost
* ```~$ sudo touch /etc/nginx/sites-available/mattermost``` * ``` sudo touch /etc/nginx/sites-available/mattermost```
* Below is a sample configuration with the minimum settings required to configure Mattermost. * Below is a sample configuration with the minimum settings required to configure Mattermost.
* *
``` ```
@@ -109,21 +109,21 @@ exec bin/platform
} }
``` ```
* Remove the existing file with * Remove the existing file with
* ```~$ sudo rm /etc/nginx/sites-enabled/default``` * ``` sudo rm /etc/nginx/sites-enabled/default```
* Link the mattermost config by typing: * Link the mattermost config by typing:
* ```sudo ln -s /etc/nginx/sites-available/mattermost /etc/nginx/sites-enabled/mattermost``` * ```sudo ln -s /etc/nginx/sites-available/mattermost /etc/nginx/sites-enabled/mattermost```
* Restart Nginx by typing: * Restart Nginx by typing:
* ```~$ sudo service nginx restart``` * ``` sudo service nginx restart```
* Verify you can see Mattermost thru the proxy by typing: * Verify you can see Mattermost thru the proxy by typing:
* ```~$ curl http://localhost``` * ``` curl http://localhost```
* You should see a page titles *Mattermost - Signup* * You should see a page titles *Mattermost - Signup*
## Setup Nginx with SSL (Recommended) ## Setup Nginx with SSL (Recommended)
1. You will need a SSL cert from a certificate athority. 1. You will need a SSL cert from a certificate authority.
1. For simplicity we will generate a test certificate. 1. For simplicity we will generate a test certificate.
* ```~$ mkdir ~/cert``` * ``` mkdir ~/cert```
* ```~$ cd ~/cert``` * ``` cd ~/cert```
* ```~$ sudo openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout mattermost.key -out mattermost.crt``` * ``` sudo openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout mattermost.key -out mattermost.crt```
* Input the following info * Input the following info
``` ```
Country Name (2 letter code) [AU]:US Country Name (2 letter code) [AU]:US
@@ -184,4 +184,4 @@ exec bin/platform
* Set *Vary By HTTP Header* to X-Real-IP * Set *Vary By HTTP Header* to X-Real-IP
1. Feel free to modify other settings. 1. Feel free to modify other settings.
1. Restart the Mattermost Service by typing: 1. Restart the Mattermost Service by typing:
* ```~$ sudo restart mattermost``` * ``` sudo restart mattermost```