make use of postgres image db init script, use their variable naming … (#100)

* make use of postgres image db init script, use their variable naming scheme, make setup-wale executable so it can actually run
This commit is contained in:
nikosch86 2017-02-24 01:32:24 +04:00 committed by Pan Luo
parent c6e177cdf2
commit 142b766cde
7 changed files with 18 additions and 27 deletions

View File

@ -13,7 +13,7 @@ install:
env:
- BUILD="docker-compose up -d"
- BUILD="docker run -d --name db mattermost-prod-db && sleep 5 && docker run -d --link db -p 80:80 --name app mattermost-prod-app"
- BUILD="docker run -d --name db -e POSTGRES_USER=mmuser -e POSTGRES_PASSWORD=mmuser_password -e POSTGRES_DB=mattermost mattermost-prod-db && sleep 5 && docker run -d --link db -p 80:80 --name app mattermost-prod-app"
script:
- curl -sSf http://localhost > /dev/null

View File

@ -1,22 +1,26 @@
# Production Docker deployment for Mattermost
This project enables deployment of a Mattermost server in a multi-node production configuration using Docker.
This project enables deployment of a Mattermost server in a multi-node production configuration using Docker.
[![Build Status](https://travis-ci.org/mattermost/mattermost-docker.svg?branch=master)](https://travis-ci.org/mattermost/mattermost-docker)
Notes:
Notes:
- To install this Docker project on AWS Elastic Beanstalk please see [AWS Elastic Beanstalk Guide](./README.aws.md).
- To install Mattermost without Docker directly onto a Linux-based operating systems, please see [Admin Guide](https://docs.mattermost.com/guides/administrator.html#installing-mattermost).
## Installation using Docker Compose
## Installation using Docker Compose
The following instructions deploy Mattermost in a production configuration using multi-node Docker Compose set up.
The following instructions deploy Mattermost in a production configuration using multi-node Docker Compose set up.
### Requirements
* [docker]
* [docker-compose]
### Database
make sure to set the appropriate values for `MM_USERNAME`, `MM_PASSWORD` and `MM_DBNAME`
### Install with SSL certificate
1. Open docker-compose.yml and set `MATTERMOST_ENABLE_SSL` to true.
@ -44,7 +48,7 @@ The following instructions deploy Mattermost in a production configuration using
environment:
- MATTERMOST_ENABLE_SSL=false
```
2. Build and run mattermost
docker-compose up -d

View File

@ -9,8 +9,7 @@ RUN apt-get update \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
ADD make_db.sh /docker-entrypoint-initdb.d/
ADD setup-wale.sh /docker-entrypoint-initdb.d/
COPY setup-wale.sh /docker-entrypoint-initdb.d/
COPY docker-entrypoint1.sh /
RUN chmod +x /docker-entrypoint1.sh

View File

@ -1,12 +0,0 @@
#!/bin/bash
set -e
MM_USERNAME=${MM_USERNAME:-mmuser}
MM_PASSWORD=${MM_PASSWORD:-mmuser_password}
MM_DBNAME=${MM_DBNAME:-mattermost}
psql -v ON_ERROR_STOP=1 --username "postgres" <<- EOSQL
CREATE DATABASE $MM_DBNAME;
CREATE USER $MM_USERNAME WITH PASSWORD '$MM_PASSWORD';
GRANT ALL PRIVILEGES ON DATABASE $MM_DBNAME to $MM_USERNAME;
EOSQL

0
db/setup-wale.sh Normal file → Executable file
View File

View File

@ -6,9 +6,9 @@ db:
- /etc/localtime:/etc/localtime:ro
# uncomment the following to enable backup
environment:
- MM_USERNAME=mmuser
- MM_PASSWORD=mmuser_password
- MM_DBNAME=mattermost
- POSTGRES_USER=mmuser
- POSTGRES_PASSWORD=mmuser_password
- POSTGRES_DB=mattermost
# - AWS_ACCESS_KEY_ID=XXXX
# - AWS_SECRET_ACCESS_KEY=XXXX
# - WALE_S3_PREFIX=s3://BUCKET_NAME/PATH

View File

@ -10,9 +10,9 @@ services:
- /etc/localtime:/etc/localtime:ro
# uncomment the following to enable backup
environment:
- MM_USERNAME=mmuser
- MM_PASSWORD=mmuser_password
- MM_DBNAME=mattermost
- POSTGRES_USER=mmuser
- POSTGRES_PASSWORD=mmuser_password
- POSTGRES_DB=mattermost
# - AWS_ACCESS_KEY_ID=XXXX
# - AWS_SECRET_ACCESS_KEY=XXXX
# - WALE_S3_PREFIX=s3://BUCKET_NAME/PATH
@ -28,7 +28,7 @@ services:
- ./volumes/app/mattermost/data:/mattermost/data:rw
- /etc/localtime:/etc/localtime:ro
environment:
# set same as db environment
# set same as db credentials and dbname
- MM_USERNAME=mmuser
- MM_PASSWORD=mmuser_password
- MM_DBNAME=mattermost