Skip to content

Commit

Permalink
Merge pull request #1 from coltoneshaw/patch-1
Browse files Browse the repository at this point in the history
Feedback / Edits after testing.
  • Loading branch information
mrckndt authored Jun 15, 2021
2 parents 74e8d61 + 5b40a4d commit 4e0749c
Show file tree
Hide file tree
Showing 2 changed files with 88 additions and 24 deletions.
111 changes: 87 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,57 +14,120 @@ These steps are required for new Mattermost setups and don't include everything

### 1. Cloning the repository (as an alternative please download it as archive)
```
$ git clone https://github.com/mattermost/docker
$ cd docker
git clone https://github.com/mattermost/docker
cd docker
```

### 2. Create a *.env* file by copying and adjusting the env.example file
Docker will search for an *.env* file when no option specifies another environment file. Afterwards edit it with your preferred text editor.
```
$ cp env.example .env
cp env.example .env
```

Within the .env file make sure you edit at a minimum the below values. You can find a list of the Mattermost version tags here: [enterprise-edition](https://hub.docker.com/r/mattermost/mattermost-enterprise-edition/tags?page=1&ordering=last_updated) / [team-edition](https://hub.docker.com/r/mattermost/mattermost-team-edition/tags?page=1&ordering=last_updated). If you want to change the postgres user and pass, you will do so in this `.env` file as well.

```
## This domain must be a live domain that points to the server where Mattermost is installed.
DOMAIN=mm.example.com
## This will be 'mattermost-enterprise-edition' or 'mattermost-team-edition' based on the version of Mattermost you're installing.
MATTERMOST_IMAGE=mattermost-enterprise-edition
MATTERMOST_IMAGE_TAG=5.34
```


### 3. Create the needed directores and set permissions (this orientates on the previous *mattermost-docker* structure and the direcories can be changed in the *.env* file)

```
$ mkdir -p ./volumes/app/mattermost/{config,data,logs,plugins,client-plugins}
$ sudo chown -R 2000:2000 ./volumes/app/mattermost
mkdir -p ./volumes/app/mattermost/{config,data,logs,plugins,client-plugins}
sudo chown -R 2000:2000 ./volumes/app/mattermost
```

## (optinally) when using the provided nginx and if a certificate and key already exists
$ mkdir -p ./volumes/web/cert
### 4. Enable Docker
First ensure the docker daemon is enabled and running:
```
sudo systemctl enable --now docker
```

### 4. Placing the certificate and key (if using provided nginx)
Use either 4.1 or 4.2 for setting up SSL.
### 5. Placing the certificate and key (if using provided nginx)
Use either 4.1 or 4.2 for setting up SSL. Both methods require you to change the path to the Let's Encrypt config folders inside the *.env*.


#### 5.1 Pre-existing certificate and key

#### 4.1 Pre-existing certificate and key
```
$ cp PATH-TO-CERT.PEM ./volumes/web/cert/cert.pem
$ cp PATH-TO-KEY.PEM ./volumes/web/cert/key-no-password.pem
## When using the provided nginx and if a certificate and key already exists make the below directory
mkdir -p ./volumes/web/cert
## Then copy your existing certs into this directory.
cp PATH-TO-CERT.PEM ./volumes/web/cert/cert.pem
cp PATH-TO-KEY.PEM ./volumes/web/cert/key-no-password.pem
```
#### 4.2 Let's Encrypt
#### 5.2 Let's Encrypt
**TODO: add link to Let's Encrypt certificate guide**

For using Let's Encrypt you can follow this guide LINK or use the this Bash script scripts/issue-certificate.sh. Both
methods requires you to change the path to the Let's Encrypt config folders inside the *.env*.
For using Let's Encrypt you can follow this guide LINK or use the this Bash script scripts/issue-certificate.sh. Make sure to adjust `mm.example.com` to match your domain configured in step 2.
```
$ sudo docker volume create shared-webroot
$ bash scripts/issue-certificate.sh -d mm.example.com -o ${PWD}/certs
sudo docker volume create shared-webroot
bash scripts/issue-certificate.sh -d mm.example.com -o ${PWD}/certs
```

### 5. Run `docker-compose`
First ensure the docker daemon is enabled and running:
#### 5.3 Adjusting the `.env` file.
Once you've completed 5.1 or 5.2 you'll need to adjust the `.env` file accordingly. With 5.1 verify the first two lines below are uncommented in the `.env` file, with 5.2 comment out the first two lines and uncomment the last two lines.

```
CERT_PATH=./volumes/web/cert/cert.pem
KEY_PATH=./volumes/web/cert/key-no-password.pem
#CERT_PATH=./certs/etc/letsencrypt/live/${DOMAIN}/fullchain.pem
#KEY_PATH=./certs/etc/letsencrypt/live/${DOMAIN}/privkey.pem
```

### 6. Run `docker-compose`
Choose if you're running this docker image with NGINX or using your own proxy.

#### 6.1 Default (with nginx)
```
sudo docker-compose -f docker-compose.yml -f docker-compose.nginx.yml up -d
```

#### 6.2. Without nginx (for use behind an existing reverse proxy)
```
$ sudo systemctl enable --now docker
sudo docker-compose -f docker-compose.yml -f docker-compose.without-nginx.yml up -d
```

#### 5.1 Default (with nginx)
# Update Mattermost to the latest version

To update Mattermost to the latest version in this repo run the below commands. This will download a new image of the instance and update Mattermost.

```
sudo docker-compose down
git pull
## Based on what you followed in step 6
docker-compose -f docker-compose.yml -f docker-compose.nginx.yml up -d
## OR
docker-compose -f docker-compose.yml -f docker-compose.without-nginx.yml up -d
```

# Installing different versions of Mattermost
If you want to have a different version of Mattermost installed you will need to follow the below steps:

1. Open the `.env` file in your docker folder
2. Edit the line `MATTERMOST_IMAGE_TAG=5.34` to be equal to the version you want. Ex: (`MATTERMOST_IMAGE_TAG=5.35`).
- You can find a list of the Mattermost version tags here: [enterprise-edition](https://hub.docker.com/r/mattermost/mattermost-enterprise-edition/tags?page=1&ordering=last_updated) / [team-edition](https://hub.docker.com/r/mattermost/mattermost-team-edition/tags?page=1&ordering=last_updated).
3. `sudo docker-compose down`
4. `sudo docker-compose up -d`

# Removing The Docker Containers

Remove the containers

```
$ sudo /usr/local/bin/docker-compose -f docker-compose.yml -f docker-compose.nginx.yml up -d
docker-compose down
```

#### 5.2. Without nginx (for use behind an existing reverse proxy)
Remove the data and settings of your Mattermost instance
```
$ sudo /usr/local/bin/docker-compose -f docker-compose.yml -f docker-compose.without-nginx.yml up -d
sudo rm -rf volumes
```
1 change: 1 addition & 0 deletions env.example
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ MATTERMOST_LOGS_PATH=./volumes/app/mattermost/logs
MATTERMOST_PLUGINS_PATH=./volumes/app/mattermost/plugins
MATTERMOST_CLIENT_PLUGINS_PATH=./volumes/app/mattermost/client-plugins

## This will be 'mattermost-enterprise-edition' or 'mattermost-team-edition' based on the version of Mattermost you're installing.
MATTERMOST_IMAGE=mattermost-enterprise-edition
MATTERMOST_IMAGE_TAG=5.34

Expand Down

0 comments on commit 4e0749c

Please sign in to comment.