From 142b766cde2029cf0af88f47c0424dad30865428 Mon Sep 17 00:00:00 2001 From: nikosch86 Date: Fri, 24 Feb 2017 01:32:24 +0400 Subject: [PATCH] =?UTF-8?q?make=20use=20of=20postgres=20image=20db=20init?= =?UTF-8?q?=20script,=20use=20their=20variable=20naming=20=E2=80=A6=20(#10?= =?UTF-8?q?0)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * make use of postgres image db init script, use their variable naming scheme, make setup-wale executable so it can actually run --- .travis.yml | 2 +- README.md | 14 +++++++++----- db/Dockerfile | 3 +-- db/make_db.sh | 12 ------------ db/setup-wale.sh | 0 docker-compose-v1.yml | 6 +++--- docker-compose.yml | 8 ++++---- 7 files changed, 18 insertions(+), 27 deletions(-) delete mode 100644 db/make_db.sh mode change 100644 => 100755 db/setup-wale.sh diff --git a/.travis.yml b/.travis.yml index 04ced96..e974eab 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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 diff --git a/README.md b/README.md index d9231c3..73a0a8c 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/db/Dockerfile b/db/Dockerfile index c35098d..4d707d2 100644 --- a/db/Dockerfile +++ b/db/Dockerfile @@ -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 diff --git a/db/make_db.sh b/db/make_db.sh deleted file mode 100644 index b105960..0000000 --- a/db/make_db.sh +++ /dev/null @@ -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 diff --git a/db/setup-wale.sh b/db/setup-wale.sh old mode 100644 new mode 100755 diff --git a/docker-compose-v1.yml b/docker-compose-v1.yml index a561e19..94c9202 100644 --- a/docker-compose-v1.yml +++ b/docker-compose-v1.yml @@ -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 diff --git a/docker-compose.yml b/docker-compose.yml index 075678b..d46d613 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -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