From 5bb74573a1c251972b1faf768853a8eede0f5104 Mon Sep 17 00:00:00 2001
From: root <root@smtp.picasoft.net>
Date: Sat, 17 Dec 2016 15:29:03 +0100
Subject: [PATCH] Add new images

---
 {Databases Docker => database}/Dockerfile~    |   0
 .../Mongo/Dockerfile                          |   0
 {Databases Docker => database}/Mongo/README   |   0
 {Databases Docker => database}/Mongo/run.sh   |   0
 .../Mongo/runScript.sh                        |   0
 .../Mongo/set_mongodb_password.sh             |   0
 {Databases Docker => database}/README~        |   0
 .../Redis/Dockerfile                          |   0
 .../Redis/Dockerfile~                         |   0
 {Databases Docker => database}/Redis/README   |   0
 {Databases Docker => database}/Redis/README~  |   0
 .../Redis/runScript.sh                        |   0
 .../Redis/runScript.sh~                       |   0
 {Databases Docker => database}/runScript.sh~  |   0
 tx-apache/Dockerfile                          |   2 +-
 tx-dokuwiki/nginx.conf                        |  12 +-
 tx-etherpad/Dockerfile                        |   2 +-
 tx-etherpad/add/entrypoint.sh                 |  10 +-
 tx-kanboard/Dockerfile                        |   2 +-
 tx-mattermost/Dockerrun.aws.json              |  60 ++++++
 tx-mattermost/LICENSE                         | 176 ++++++++++++++++++
 tx-mattermost/README                          |   2 -
 tx-mattermost/README.aws.md                   |  13 ++
 tx-mattermost/README.md                       | 122 ++++++++++++
 tx-mattermost/README~                         |   0
 tx-mattermost/app/Dockerfile                  |  15 ++
 tx-mattermost/app/config.template.json        |  95 ++++++++++
 tx-mattermost/app/docker-entry.sh             |  33 ++++
 tx-mattermost/contrib/kubernetes/README.md    | 110 +++++++++++
 .../kubernetes/mattermost.deployment.yaml     |  61 ++++++
 .../contrib/kubernetes/mattermost.secret.yaml |  19 ++
 .../contrib/kubernetes/mattermost.svc.yaml    |  15 ++
 tx-mattermost/db/Dockerfile                   |  19 ++
 tx-mattermost/db/docker-entrypoint1.sh        |  45 +++++
 tx-mattermost/db/make_db.sh                   |  12 ++
 tx-mattermost/db/setup-wale.sh                |  11 ++
 tx-mattermost/docker-compose.yml              |  39 ++++
 tx-mattermost/web/Dockerfile                  |  22 +++
 tx-mattermost/web/docker-entry.sh             |  12 ++
 tx-mattermost/web/mattermost                  |  22 +++
 tx-mattermost/web/mattermost-ssl              |  39 ++++
 tx-nginx/Dockerfile                           |  26 +++
 tx-nginx/nginx.conf                           |  49 +++++
 tx-nginx/start.sh                             |   7 +
 tx-nginx/supervisord.conf                     |  23 +++
 45 files changed, 1058 insertions(+), 17 deletions(-)
 rename {Databases Docker => database}/Dockerfile~ (100%)
 rename {Databases Docker => database}/Mongo/Dockerfile (100%)
 rename {Databases Docker => database}/Mongo/README (100%)
 rename {Databases Docker => database}/Mongo/run.sh (100%)
 rename {Databases Docker => database}/Mongo/runScript.sh (100%)
 rename {Databases Docker => database}/Mongo/set_mongodb_password.sh (100%)
 rename {Databases Docker => database}/README~ (100%)
 rename {Databases Docker => database}/Redis/Dockerfile (100%)
 rename {Databases Docker => database}/Redis/Dockerfile~ (100%)
 rename {Databases Docker => database}/Redis/README (100%)
 rename {Databases Docker => database}/Redis/README~ (100%)
 rename {Databases Docker => database}/Redis/runScript.sh (100%)
 rename {Databases Docker => database}/Redis/runScript.sh~ (100%)
 rename {Databases Docker => database}/runScript.sh~ (100%)
 create mode 100644 tx-mattermost/Dockerrun.aws.json
 create mode 100644 tx-mattermost/LICENSE
 delete mode 100644 tx-mattermost/README
 create mode 100644 tx-mattermost/README.aws.md
 create mode 100644 tx-mattermost/README.md
 delete mode 100644 tx-mattermost/README~
 create mode 100644 tx-mattermost/app/Dockerfile
 create mode 100644 tx-mattermost/app/config.template.json
 create mode 100644 tx-mattermost/app/docker-entry.sh
 create mode 100644 tx-mattermost/contrib/kubernetes/README.md
 create mode 100644 tx-mattermost/contrib/kubernetes/mattermost.deployment.yaml
 create mode 100644 tx-mattermost/contrib/kubernetes/mattermost.secret.yaml
 create mode 100644 tx-mattermost/contrib/kubernetes/mattermost.svc.yaml
 create mode 100644 tx-mattermost/db/Dockerfile
 create mode 100755 tx-mattermost/db/docker-entrypoint1.sh
 create mode 100644 tx-mattermost/db/make_db.sh
 create mode 100644 tx-mattermost/db/setup-wale.sh
 create mode 100644 tx-mattermost/docker-compose.yml
 create mode 100644 tx-mattermost/web/Dockerfile
 create mode 100644 tx-mattermost/web/docker-entry.sh
 create mode 100644 tx-mattermost/web/mattermost
 create mode 100644 tx-mattermost/web/mattermost-ssl
 create mode 100644 tx-nginx/Dockerfile
 create mode 100644 tx-nginx/nginx.conf
 create mode 100755 tx-nginx/start.sh
 create mode 100644 tx-nginx/supervisord.conf

diff --git a/Databases Docker/Dockerfile~ b/database/Dockerfile~
similarity index 100%
rename from Databases Docker/Dockerfile~
rename to database/Dockerfile~
diff --git a/Databases Docker/Mongo/Dockerfile b/database/Mongo/Dockerfile
similarity index 100%
rename from Databases Docker/Mongo/Dockerfile
rename to database/Mongo/Dockerfile
diff --git a/Databases Docker/Mongo/README b/database/Mongo/README
similarity index 100%
rename from Databases Docker/Mongo/README
rename to database/Mongo/README
diff --git a/Databases Docker/Mongo/run.sh b/database/Mongo/run.sh
similarity index 100%
rename from Databases Docker/Mongo/run.sh
rename to database/Mongo/run.sh
diff --git a/Databases Docker/Mongo/runScript.sh b/database/Mongo/runScript.sh
similarity index 100%
rename from Databases Docker/Mongo/runScript.sh
rename to database/Mongo/runScript.sh
diff --git a/Databases Docker/Mongo/set_mongodb_password.sh b/database/Mongo/set_mongodb_password.sh
similarity index 100%
rename from Databases Docker/Mongo/set_mongodb_password.sh
rename to database/Mongo/set_mongodb_password.sh
diff --git a/Databases Docker/README~ b/database/README~
similarity index 100%
rename from Databases Docker/README~
rename to database/README~
diff --git a/Databases Docker/Redis/Dockerfile b/database/Redis/Dockerfile
similarity index 100%
rename from Databases Docker/Redis/Dockerfile
rename to database/Redis/Dockerfile
diff --git a/Databases Docker/Redis/Dockerfile~ b/database/Redis/Dockerfile~
similarity index 100%
rename from Databases Docker/Redis/Dockerfile~
rename to database/Redis/Dockerfile~
diff --git a/Databases Docker/Redis/README b/database/Redis/README
similarity index 100%
rename from Databases Docker/Redis/README
rename to database/Redis/README
diff --git a/Databases Docker/Redis/README~ b/database/Redis/README~
similarity index 100%
rename from Databases Docker/Redis/README~
rename to database/Redis/README~
diff --git a/Databases Docker/Redis/runScript.sh b/database/Redis/runScript.sh
similarity index 100%
rename from Databases Docker/Redis/runScript.sh
rename to database/Redis/runScript.sh
diff --git a/Databases Docker/Redis/runScript.sh~ b/database/Redis/runScript.sh~
similarity index 100%
rename from Databases Docker/Redis/runScript.sh~
rename to database/Redis/runScript.sh~
diff --git a/Databases Docker/runScript.sh~ b/database/runScript.sh~
similarity index 100%
rename from Databases Docker/runScript.sh~
rename to database/runScript.sh~
diff --git a/tx-apache/Dockerfile b/tx-apache/Dockerfile
index 918698e3..bd6ed351 100644
--- a/tx-apache/Dockerfile
+++ b/tx-apache/Dockerfile
@@ -1,4 +1,4 @@
-FROM tx-debian
+FROM pica-debian
 MAINTAINER antoinebarbare@gmail.com
 
 # Install base packages
diff --git a/tx-dokuwiki/nginx.conf b/tx-dokuwiki/nginx.conf
index 5b072fc3..b4ceb7e9 100644
--- a/tx-dokuwiki/nginx.conf
+++ b/tx-dokuwiki/nginx.conf
@@ -35,12 +35,12 @@ http {
             try_files $uri $uri/ @dokuwiki;
         }
 
-        location @dokuwiki {
-            rewrite ^/_media/(.*) /lib/exe/fetch.php?media=$1 last;
-            rewrite ^/_detail/(.*) /lib/exe/detail.php?media=$1 last;
-            rewrite ^/_export/([^/]+)/(.*) /doku.php?do=export_$1&id=$2 last;
-            rewrite ^/(.*) /doku.php?id=$1 last;
-        }
+        #location @dokuwiki {
+        #    rewrite ^/_media/(.*) /lib/exe/fetch.php?media=$1 last;
+        #    rewrite ^/_detail/(.*) /lib/exe/detail.php?media=$1 last;
+        #    rewrite ^/_export/([^/]+)/(.*) /doku.php?do=export_$1&id=$2 last;
+        #    rewrite ^/(.*) /doku.php?id=$1 last;
+        #}
 
         location ~ \.php$ {
             try_files $uri =404;
diff --git a/tx-etherpad/Dockerfile b/tx-etherpad/Dockerfile
index 0ff17082..f602e42e 100644
--- a/tx-etherpad/Dockerfile
+++ b/tx-etherpad/Dockerfile
@@ -1,4 +1,4 @@
-FROM tx-debian:latest
+FROM pica-debian:latest
 MAINTAINER antoine@barbare.me
 
 ENV ETHERPAD_VERSION 1.6.0
diff --git a/tx-etherpad/add/entrypoint.sh b/tx-etherpad/add/entrypoint.sh
index f9b5fc80..e9351640 100644
--- a/tx-etherpad/add/entrypoint.sh
+++ b/tx-etherpad/add/entrypoint.sh
@@ -2,9 +2,7 @@
 set -e
 
 if [ -z "$MYSQL_PORT_3306_TCP_ADDR" ]; then
-	echo >&2 'error: missing MYSQL_PORT_3306_TCP environment variable'
-	echo >&2 '  Did you forget to --link some_mysql_container:mysql ?'
-	exit 1
+	: ${MYSQL_PORT_3306_TCP_ADDR:=mysql}
 fi
 
 # if we're linked to MySQL, and we're using the root user, and our linked
@@ -32,14 +30,14 @@ fi
 
 # Check if database already exists
 RESULT=`mysql -u${ETHERPAD_DB_USER} -p${ETHERPAD_DB_PASSWORD} \
-	-hmysql --skip-column-names \
+	-h${MYSQL_PORT_3306_TCP_ADDR} --skip-column-names \
 	-e "SHOW DATABASES LIKE '${ETHERPAD_DB_NAME}'"`
 
 if [ "$RESULT" != $ETHERPAD_DB_NAME ]; then
 	# mysql database does not exist, create it
 	echo "Creating database ${ETHERPAD_DB_NAME}"
 
-	mysql -u${ETHERPAD_DB_USER} -p${ETHERPAD_DB_PASSWORD} -hmysql \
+	mysql -u${ETHERPAD_DB_USER} -p${ETHERPAD_DB_PASSWORD} -h${MYSQL_PORT_3306_TCP_ADDR} \
 	      -e "create database ${ETHERPAD_DB_NAME}"
 fi
 
@@ -54,7 +52,7 @@ if [ ! -f settings.json ]; then
 	  "dbType" : "mysql",
 	  "dbSettings" : {
 			    "user"    : "${ETHERPAD_DB_USER}",
-			    "host"    : "mysql",
+			    "host"    : "${MYSQL_PORT_3306_TCP_ADDR}",
 			    "password": "${ETHERPAD_DB_PASSWORD}",
 			    "database": "${ETHERPAD_DB_NAME}"
 			  },
diff --git a/tx-kanboard/Dockerfile b/tx-kanboard/Dockerfile
index cf5c5162..8ad6ce18 100644
--- a/tx-kanboard/Dockerfile
+++ b/tx-kanboard/Dockerfile
@@ -1,4 +1,4 @@
-FROM tx-apache
+FROM pica-apache
 MAINTAINER antoinebarbare@gmail.com
 
 # Install base packages
diff --git a/tx-mattermost/Dockerrun.aws.json b/tx-mattermost/Dockerrun.aws.json
new file mode 100644
index 00000000..49d4191d
--- /dev/null
+++ b/tx-mattermost/Dockerrun.aws.json
@@ -0,0 +1,60 @@
+{
+    "AWSEBDockerrunVersion": "2",
+    "volumes": [
+        {
+            "name": "app-config",
+            "host": {
+                "sourcePath": "/var/app/current/app/mattermost/config"
+            }
+        },
+        {
+            "name": "app-data",
+            "host": {
+                "sourcePath": "/var/app/current/app/mattermost/data"
+            }
+        },
+        {
+            "name": "db-data",
+            "host": {
+                "sourcePath": "/var/app/current/db/mattermost/var/lib/postgresql/data"
+            }
+        }
+    ],
+    "containerDefinitions": [
+        {
+            "name": "app",
+            "image": "mattermost/mattermost-prod-app:latest",
+            "memory": 128,
+            "mountPoints": [
+                {
+                    "sourceVolume": "app-config",
+                    "containerPath": "/mattermost/config"
+                },
+                {
+                    "sourceVolume": "app-data",
+                    "containerPath": "/mattermost/data"
+                }
+            ],
+            "portMappings": [
+                {
+                    "hostPort": 80,
+                    "containerPort": 80
+                }
+            ],
+            "links": [
+                "db"
+            ]
+        },
+        {
+            "name": "db",
+            "image": "mattermost/mattermost-prod-db:latest",
+            "memory": 128,
+            "mountPoints": [
+                {
+                    "sourceVolume": "db-data",
+                    "containerPath": "/var/lib/postgresql/data"
+                }
+            ]
+        }
+    ]
+}
diff --git a/tx-mattermost/LICENSE b/tx-mattermost/LICENSE
new file mode 100644
index 00000000..d9a10c0d
--- /dev/null
+++ b/tx-mattermost/LICENSE
@@ -0,0 +1,176 @@
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
diff --git a/tx-mattermost/README b/tx-mattermost/README
deleted file mode 100644
index 1391aab3..00000000
--- a/tx-mattermost/README
+++ /dev/null
@@ -1,2 +0,0 @@
-Une version très complète et fonctionnelle ici :
-https://github.com/mattermost/mattermost-docker
\ No newline at end of file
diff --git a/tx-mattermost/README.aws.md b/tx-mattermost/README.aws.md
new file mode 100644
index 00000000..2a0a8678
--- /dev/null
+++ b/tx-mattermost/README.aws.md
@@ -0,0 +1,13 @@
+## Installation on AWS Elastic Beanstalk
+
+### Requirement
+
+* [The EB CLI](http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/eb-cli3.html)
+
+### Install
+
+```
+eb init
+eb create prod
+eb open prod
+```
diff --git a/tx-mattermost/README.md b/tx-mattermost/README.md
new file mode 100644
index 00000000..aabbb247
--- /dev/null
+++ b/tx-mattermost/README.md
@@ -0,0 +1,122 @@
+Dockerfiles for Mattermost in production
+
+See [README.aws.md](./README.aws.md) if you want to install it on AWS Elastic Beanstalk.
+
+[![Build Status](https://travis-ci.org/mattermost/mattermost-docker.svg?branch=master)](https://travis-ci.org/mattermost/mattermost-docker)
+
+## Requirements
+
+* [docker]
+* [docker-compose]
+
+## Installation
+
+### Install with SSL certificate
+
+1. Open docker-compose.yml and set `MATTERMOST_ENABLE_SSL` to true.
+
+    ```
+    environment:
+      - MATTERMOST_ENABLE_SSL=true
+    ```
+
+2. Put your SSL certificate as `./volumes/web/cert/cert.pem` and the private key that has
+   no password as `./volumes/web/cert/key-no-password.pem`. If you don't have
+   them you may generate a self-signed SSL certificate.
+
+3. Build and run mattermost
+
+    docker-compose up -d
+
+4. Open `https://your.domain` with your web browser.
+
+### Install without SSL certificate
+
+1. Open docker-compose.yml and set `MATTERMOST_ENABLE_SSL` to false.
+
+    ```
+    environment:
+      - MATTERMOST_ENABLE_SSL=false
+    ```
+    
+2. Build and run mattermost
+
+    docker-compose up -d
+
+3. Open `http://your.domain` with your web browser.
+
+## Starting/Stopping
+
+### Start
+
+    docker-compose start
+
+### Stop
+
+    docker-compose stop
+
+## Removing
+
+### Remove the containers
+
+    docker-compose stop && docker-compose rm
+
+### Remove the data and settings of your mattermost instance
+
+    sudo rm -rf volumes
+
+## Database Backup
+
+When AWS S3 environment variables are specified on db docker container, it enables [Wal-E](https://github.com/wal-e/wal-e) backup to S3.
+
+```bash
+docker run -d --name mattermost-db \
+    -e AWS_ACCESS_KEY_ID=XXXX \
+    -e AWS_SECRET_ACCESS_KEY=XXXX \
+    -e WALE_S3_PREFIX=s3://BUCKET_NAME/PATH \
+    -e AWS_REGION=us-east-1
+    -v ./volumes/db/var/lib/postgresql/data:/var/lib/postgresql/data
+    -v /etc/localtime:/etc/localtime:ro
+    db
+```
+
+All four environment variables are required. It will enable completed WAL segments sent to archive storage (S3). The base backup and clean up can be done through the following command:
+
+```bash
+# base backup
+docker exec mattermost-db su - postgres sh -c "/usr/bin/envdir /etc/wal-e.d/env /usr/local/bin/wal-e backup-push /var/lib/postgresql/data"
+# keep the most recent 7 base backups and remove the old ones
+docker exec mattermost-db su - postgres sh -c "/usr/bin/envdir /etc/wal-e.d/env /usr/local/bin/wal-e delete --confirm retain 7"
+```
+Those tasks can be executed through a cron job or systemd timer.
+
+## Upgrading to Team Edition 3.0.x from 2.x
+
+You need to migrate your database before upgrading mattermost to 3.0.x from
+2.x. Run these commands in the latest mattermost-docker directory.
+
+    docker-compose rm -f app
+    docker-compose build app
+    docker-compose run app -upgrade_db_30
+    docker-compose up -d
+
+See the [offical Upgrade Guide](http://docs.mattermost.com/administration/upgrade.html) for more details.
+
+## Known Issues
+
+* Do not modify the Listen Address in Service Settings.
+* Rarely 'app' container fails to start because of "connection refused" to
+  database. Workaround: Restart the container.
+
+## More informations
+
+If you want to know how to use docker-compose, see [the overview
+page](https://docs.docker.com/compose).
+
+If you want to run Mattermost on Kubernetes you can start with the [manifest examples in the kubernetes folder](contrib/kubernetes/README.md)
+
+For the server configurations, see [prod-ubuntu.rst] of mattermost.
+
+[docker]: http://docs.docker.com/engine/installation/
+[docker-compose]: https://docs.docker.com/compose/install/
+[prod-ubuntu.rst]: https://github.com/mattermost/docs/blob/master/source/install/prod-ubuntu.rst
diff --git a/tx-mattermost/README~ b/tx-mattermost/README~
deleted file mode 100644
index e69de29b..00000000
diff --git a/tx-mattermost/app/Dockerfile b/tx-mattermost/app/Dockerfile
new file mode 100644
index 00000000..5280102b
--- /dev/null
+++ b/tx-mattermost/app/Dockerfile
@@ -0,0 +1,15 @@
+FROM pica-debian
+
+RUN apt-get update && apt-get -y install curl netcat
+RUN mkdir -p /mattermost/data
+
+RUN curl https://releases.mattermost.com/3.5.1/mattermost-team-3.5.1-linux-amd64.tar.gz | tar -xvz
+
+RUN rm /mattermost/config/config.json
+COPY config.template.json /
+
+COPY docker-entry.sh /
+RUN chmod +x /docker-entry.sh
+ENTRYPOINT ["/docker-entry.sh"]
+
+EXPOSE 80
diff --git a/tx-mattermost/app/config.template.json b/tx-mattermost/app/config.template.json
new file mode 100644
index 00000000..70af3ec1
--- /dev/null
+++ b/tx-mattermost/app/config.template.json
@@ -0,0 +1,95 @@
+{
+    "ServiceSettings": {
+        "ListenAddress": ":80",
+        "MaximumLoginAttempts": 10,
+        "SegmentDeveloperKey": "",
+        "GoogleDeveloperKey": "",
+        "EnableOAuthServiceProvider": false,
+        "EnableIncomingWebhooks": false,
+        "EnableOutgoingWebhooks": false,
+        "EnablePostUsernameOverride": false,
+        "EnablePostIconOverride": false,
+        "EnableTesting": false,
+        "EnableSecurityFixAlert": true
+    },
+    "TeamSettings": {
+        "SiteName": "Mattermost",
+        "MaxUsersPerTeam": 50,
+        "EnableTeamCreation": true,
+        "EnableUserCreation": true,
+        "RestrictCreationToDomains": "",
+        "RestrictTeamNames": true,
+        "EnableTeamListing": false
+    },
+    "SqlSettings": {
+        "DriverName": "postgres",
+        "DataSource": "postgres://MM_USERNAME:MM_PASSWORD@DB_HOST:DB_PORT/MM_DBNAME?sslmode=disable&connect_timeout=10",
+        "DataSourceReplicas": [],
+        "MaxIdleConns": 10,
+        "MaxOpenConns": 10,
+        "Trace": false,
+        "AtRestEncryptKey": "7rAh6iwQCkV4cA1Gsg3fgGOXJAQ43QVg"
+    },
+    "LogSettings": {
+        "EnableConsole": false,
+        "ConsoleLevel": "INFO",
+        "EnableFile": true,
+        "FileLevel": "INFO",
+        "FileFormat": "",
+        "FileLocation": ""
+    },
+    "FileSettings": {
+        "DriverName": "local",
+        "Directory": "/mattermost/data/",
+        "EnablePublicLink": true,
+        "PublicLinkSalt": "A705AklYF8MFDOfcwh3I488G8vtLlVip",
+        "ThumbnailWidth": 120,
+        "ThumbnailHeight": 100,
+        "PreviewWidth": 1024,
+        "PreviewHeight": 0,
+        "ProfileWidth": 128,
+        "ProfileHeight": 128,
+        "InitialFont": "luximbi.ttf",
+        "AmazonS3AccessKeyId": "",
+        "AmazonS3SecretAccessKey": "",
+        "AmazonS3Bucket": "",
+        "AmazonS3Region": ""
+    },
+    "EmailSettings": {
+        "EnableSignUpWithEmail": true,
+        "SendEmailNotifications": false,
+        "RequireEmailVerification": false,
+        "FeedbackName": "",
+        "FeedbackEmail": "",
+        "SMTPUsername": "",
+        "SMTPPassword": "",
+        "SMTPServer": "",
+        "SMTPPort": "",
+        "ConnectionSecurity": "",
+        "InviteSalt": "bjlSR4QqkXFBr7TP4oDzlfZmcNuH9YoS",
+        "PasswordResetSalt": "vZ4DcKyVVRlKHHJpexcuXzojkE5PZ5eL",
+        "ApplePushServer": "",
+        "ApplePushCertPublic": "",
+        "ApplePushCertPrivate": ""
+    },
+    "RateLimitSettings": {
+        "EnableRateLimiter": true,
+        "PerSec": 10,
+        "MemoryStoreSize": 10000,
+        "VaryByRemoteAddr": true,
+        "VaryByHeader": ""
+    },
+    "PrivacySettings": {
+        "ShowEmailAddress": true,
+        "ShowFullName": true
+    },
+    "GitLabSettings": {
+        "Enable": false,
+        "Secret": "",
+        "Id": "",
+        "Scope": "",
+        "AuthEndpoint": "",
+        "TokenEndpoint": "",
+        "UserApiEndpoint": ""
+    }
+}
diff --git a/tx-mattermost/app/docker-entry.sh b/tx-mattermost/app/docker-entry.sh
new file mode 100644
index 00000000..27efe2e4
--- /dev/null
+++ b/tx-mattermost/app/docker-entry.sh
@@ -0,0 +1,33 @@
+#!/bin/bash
+config=/mattermost/config/config.json
+DB_HOST=${DB_HOST:-db}
+DB_PORT_5432_TCP_PORT=${DB_PORT_5432_TCP_PORT:-5432}
+MM_USERNAME=${MM_USERNAME:-mmuser}
+MM_PASSWORD=${MM_PASSWORD:-mmuser_password}
+MM_DBNAME=${MM_DBNAME:-mattermost}
+echo -ne "Configure database connection..."
+if [ ! -f $config ]
+then
+    cp /config.template.json $config
+    sed -Ei "s/DB_HOST/$DB_HOST/" $config
+    sed -Ei "s/DB_PORT/$DB_PORT_5432_TCP_PORT/" $config
+    sed -Ei "s/MM_USERNAME/$MM_USERNAME/" $config
+    sed -Ei "s/MM_PASSWORD/$MM_PASSWORD/" $config
+    sed -Ei "s/MM_DBNAME/$MM_DBNAME/" $config
+    echo OK
+else
+    echo SKIP
+fi
+
+echo "Wait until database $DB_HOST:$DB_PORT_5432_TCP_PORT is ready..."
+until nc -z $DB_HOST $DB_PORT_5432_TCP_PORT
+do
+    sleep 1
+done
+
+# Wait to avoid "panic: Failed to open sql connection pq: the database system is starting up"
+sleep 1
+
+echo "Starting platform"
+cd /mattermost/bin
+./platform $*
diff --git a/tx-mattermost/contrib/kubernetes/README.md b/tx-mattermost/contrib/kubernetes/README.md
new file mode 100644
index 00000000..ca5a2f98
--- /dev/null
+++ b/tx-mattermost/contrib/kubernetes/README.md
@@ -0,0 +1,110 @@
+Mattermost on Kubernetes
+=======
+
+You can use these manifests as a starting point to run Mattermost on Kubernetes.
+
+If you already have a Kubernetes cluster you can skip this first step.
+
+### Start local Kubernetes cluster
+
+To get started we can use [minikube](https://github.com/kubernetes/minikube/) to run a local kubernetes cluster.
+
+Download and install minikube and any dependancies for your operating system (see minikube readme). You will also need to install [kubectl](http://kubernetes.io/docs/user-guide/prereqs/).
+
+Start the minikube VM and Kubernetes API server
+
+```
+minikube start
+```
+
+### Start a Postgres database
+
+#### WARNING: The database is not backup up and will lose all data if the pod is restarted. Consider using a [persistent volume](http://kubernetes.io/docs/user-guide/persistent-volumes/) for storing pgdata
+
+This will run a postgres deployment with default values for database name, username, and password.
+
+```
+kubectl run postgres --image=postgres:9 \
+  --env="POSTGRES_PASSWORD=mmuser_password" \
+  --env="POSTGRES_DB=mattermost" \
+  --env="POSTGRES_USER=mmuser"
+```
+Expose the postgres database as a service named "db"
+```
+kubectl expose deployment postgres \
+  --name=db \
+  --port 5432 \
+  --target-port 5432
+```
+
+### Run Mattermost container
+
+The Mattermost application is split into three manifests.
+
+First, create the secret which will set the environment varibles for the main application container. If you changed the values for the Postgres container you will also need to set the values in mattermost.secret.yaml using the [manual steps for creating a secret](http://kubernetes.io/docs/user-guide/secrets/#creating-a-secret-manually).
+```
+kubectl create -f mattermost.secret.yaml
+```
+Next create the Mattermost deployment (main application) with
+```
+kubectl create -f mattermost.deployment.yaml
+```
+You should check that the pod started successfully with 
+```
+kubectl get po -l app=mattermost
+NAME                              READY     STATUS    RESTARTS   AGE
+mattermost-app-1605216003-fvnz1   1/1       Running   0          44m
+```
+
+Finally, you can expose the application with a service so you can easily access the application from a web browser. The example service is using a `type: NodePort` which means it will be exposed on a random high port on your cluster nodes (or minikube VM if you're using minikube). If you are running your Kubernetes cluster in AWS or GCE you should change the type to loadBalancer.
+```
+kubectl create -f mattermost.svc.yaml
+```
+Now you can get your VM's IP address with 
+```
+minikube ip
+192.168.99.100
+```
+and the exposed port for the application with
+```
+kubectl describe svc mattermost
+Name:                   mattermost
+Namespace:              default
+Labels:                 <none>
+Selector:               app=mattermost,tier=app
+Type:                   NodePort
+IP:                     10.0.0.194
+Port:                   http    80/TCP
+NodePort:               http    32283/TCP
+Endpoints:              172.17.0.4:80
+Session Affinity:       None
+No events.
+```
+Make sure the Endpoints shows an IP address. This should correlate to the pod IP started by the deployment.
+
+Now browse to your node IP and exposed NodePort in your browser to view the application or test it with curl
+
+```
+curl -L http://192.168.99.100:32283
+```
+
+### Optional steps
+
+ * If you want your data to be persistent you will need to make persistent volumes for Mattermost and Postgres.
+ * If you want to change advanced settings for the mattermost container you can make a [configMap](http://blog.kubernetes.io/2016/04/configuration-management-with-containers.html) for the /mattermost/config/config.json file
+ * If you want the application exposed on port 80 you can either specify the port in the service manifest or use an [ingress controller](http://kubernetes.io/docs/user-guide/ingress/#ingress-controllers) and an ingress map for the mattermost service. A sample ingress map would be
+```
+---
+apiVersion: extensions/v1beta1
+kind: Ingress
+metadata:
+  name: mattermost
+spec:
+  rules:
+  - host: mattermost
+    http:
+      paths:
+      - backend:
+          serviceName: mattermost
+          servicePort: 80
+```
diff --git a/tx-mattermost/contrib/kubernetes/mattermost.deployment.yaml b/tx-mattermost/contrib/kubernetes/mattermost.deployment.yaml
new file mode 100644
index 00000000..3ecdc5ad
--- /dev/null
+++ b/tx-mattermost/contrib/kubernetes/mattermost.deployment.yaml
@@ -0,0 +1,61 @@
+apiVersion: extensions/v1beta1
+kind: Deployment
+metadata:
+  name: mattermost-app
+  labels:
+    app: mattermost
+    tier: app
+  namespace: default
+spec:
+  replicas: 1
+  template:
+    metadata:
+      name: mattermost-app
+      labels:
+        app: mattermost
+        tier: app
+    spec:
+      containers:
+      - name: mattermost-app
+        image: "mattermost/mattermost-prod-app:3"
+        env:
+        - name: DB_HOST
+          valueFrom:
+            secretKeyRef:
+              name: mattermost.env
+              key: db-host
+        - name: DB_PORT
+          valueFrom:
+            secretKeyRef:
+              name: mattermost.env
+              key: db-port
+        - name: MM_USERNAME
+          valueFrom:
+            secretKeyRef:
+              name: mattermost.env
+              key: mm-username
+        - name: MM_PASSWORD
+          valueFrom:
+            secretKeyRef:
+              name: mattermost.env
+              key: mm-password
+        - name: MM_DBNAME
+          valueFrom:
+            secretKeyRef:
+              name: mattermost.env
+              key: mm-dbname
+        volumeMounts:
+        # optional persistant storage
+        #- name: appdata
+          #mountPath: /mattermost/data
+        - name: etclocaltime
+          mountPath: /etc/localtime
+          readOnly: true
+      volumes:
+      # optional persistant storage
+      #- name: appdata
+        #persistentVolumeClaim:
+        #  claimName: mattermost-app
+      - name: etclocaltime
+        hostPath:
+          path: /etc/localtime
diff --git a/tx-mattermost/contrib/kubernetes/mattermost.secret.yaml b/tx-mattermost/contrib/kubernetes/mattermost.secret.yaml
new file mode 100644
index 00000000..595b9c23
--- /dev/null
+++ b/tx-mattermost/contrib/kubernetes/mattermost.secret.yaml
@@ -0,0 +1,19 @@
+kind: Secret
+apiVersion: v1
+metadata:
+  name: mattermost.env
+  namespace: default
+type: Opaque
+data:
+  # see http://kubernetes.io/docs/user-guide/secrets/#creating-a-secret-using-kubectl-create-secret
+  # for creating secrets manually
+    # db
+  db-host: ZGI=
+    # 5432
+  db-port: NTQzMg==
+    # mmuser
+  mm-username: bW11c2Vy
+    # mmuser_password
+  mm-password: bW11c2VyX3Bhc3N3b3Jk
+    # mattermost
+  mm-dbname: bWF0dGVybW9zdA==
diff --git a/tx-mattermost/contrib/kubernetes/mattermost.svc.yaml b/tx-mattermost/contrib/kubernetes/mattermost.svc.yaml
new file mode 100644
index 00000000..b5e3fdcb
--- /dev/null
+++ b/tx-mattermost/contrib/kubernetes/mattermost.svc.yaml
@@ -0,0 +1,15 @@
+apiVersion: v1
+kind: Service
+metadata:
+  name: mattermost
+  namespace: default
+spec:
+  type: NodePort
+  ports:
+  - port: 80
+    targetPort: 80
+    protocol: TCP
+    name: http
+  selector:
+    app: mattermost
+    tier: app
diff --git a/tx-mattermost/db/Dockerfile b/tx-mattermost/db/Dockerfile
new file mode 100644
index 00000000..c35098d3
--- /dev/null
+++ b/tx-mattermost/db/Dockerfile
@@ -0,0 +1,19 @@
+FROM postgres:9.4
+
+RUN apt-get update \
+    && apt-get install -y python-dev lzop pv daemontools curl build-essential \
+    && curl --silent --show-error --retry 5 https://bootstrap.pypa.io/get-pip.py | python \
+    && pip install 'wal-e<1.0.0' \
+    && apt-get remove -y build-essential python-dev \
+    && apt-get autoremove -y \
+    && 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 docker-entrypoint1.sh /
+RUN chmod +x /docker-entrypoint1.sh
+
+ENTRYPOINT ["/docker-entrypoint1.sh"]
+
+CMD ["postgres"]
diff --git a/tx-mattermost/db/docker-entrypoint1.sh b/tx-mattermost/db/docker-entrypoint1.sh
new file mode 100755
index 00000000..e21fe899
--- /dev/null
+++ b/tx-mattermost/db/docker-entrypoint1.sh
@@ -0,0 +1,45 @@
+#!/bin/bash
+
+# if wal backup is not enabled, use minimal wal logging to reduce disk space
+: ${WAL_LEVEL:=minimal}
+: ${ARCHIVE_MODE:=off}
+: ${ARCHIVE_TIMEOUT:=60}
+# PGDATA is defined in upstream postgres dockerfile
+
+function update_conf () {
+    if [ -f $PGDATA/postgresql.conf ]; then
+        sed -i "s/wal_level =.*$/wal_level = $WAL_LEVEL/g" $PGDATA/postgresql.conf
+        sed -i "s/archive_mode =.*$/archive_mode = $ARCHIVE_MODE/g" $PGDATA/postgresql.conf
+    fi
+}
+
+if [ "${1:0:1}" = '-'  ]; then
+    set -- postgres "$@"
+fi
+
+if [ "$1" = 'postgres'  ]; then
+    VARS=(AWS_ACCESS_KEY_ID AWS_SECRET_ACCESS_KEY WALE_S3_PREFIX AWS_REGION)
+
+    for v in ${VARS[@]}; do
+        if [ "${!v}" = "" ]; then
+            echo "$v is required for Wal-E but not set. Skipping Wal-E setup."
+            update_conf
+            . /docker-entrypoint.sh
+            exit
+        fi
+    done
+
+    umask u=rwx,g=rx,o=
+    mkdir -p /etc/wal-e.d/env
+
+    for v in ${VARS[@]}; do
+        echo "${!v}" > /etc/wal-e.d/env/$v
+    done
+    chown -R root:postgres /etc/wal-e.d
+
+    WAL_LEVEL=archive
+    ARCHIVE_MODE=on
+
+    update_conf
+    . /docker-entrypoint.sh
+fi
diff --git a/tx-mattermost/db/make_db.sh b/tx-mattermost/db/make_db.sh
new file mode 100644
index 00000000..b1059605
--- /dev/null
+++ b/tx-mattermost/db/make_db.sh
@@ -0,0 +1,12 @@
+#!/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/tx-mattermost/db/setup-wale.sh b/tx-mattermost/db/setup-wale.sh
new file mode 100644
index 00000000..7f2584f9
--- /dev/null
+++ b/tx-mattermost/db/setup-wale.sh
@@ -0,0 +1,11 @@
+#!/bin/bash
+
+# wal-e specific
+echo "wal_level = $WAL_LEVEL" >> $PGDATA/postgresql.conf
+echo "archive_mode = $ARCHIVE_MODE" >> $PGDATA/postgresql.conf
+echo "archive_command = 'envdir /etc/wal-e.d/env /usr/local/bin/wal-e wal-push %p'" >> $PGDATA/postgresql.conf
+echo "archive_timeout = $ARCHIVE_TIMEOUT" >> $PGDATA/postgresql.conf
+
+# no cron in the image, use systemd timer on host instead
+#su - postgres -c "crontab -l | { cat; echo \"0 3 * * * /usr/bin/envdir /etc/wal-e.d/env /usr/local/bin/wal-e backup-push /var/lib/postgresql/data\"; } | crontab -"
+#su - postgres -c "crontab -l | { cat; echo \"0 4 * * * /usr/bin/envdir /etc/wal-e.d/env /usr/local/bin/wal-e delete --confirm retain 7\"; } | crontab -"
diff --git a/tx-mattermost/docker-compose.yml b/tx-mattermost/docker-compose.yml
new file mode 100644
index 00000000..e01768a6
--- /dev/null
+++ b/tx-mattermost/docker-compose.yml
@@ -0,0 +1,39 @@
+db:
+  build: db
+  restart: always
+  volumes:
+    - ./volumes/db/var/lib/postgresql/data:/var/lib/postgresql/data
+    - /etc/localtime:/etc/localtime:ro
+  # uncomment the following to enable backup
+  environment:
+    - MM_USERNAME=mmuser
+    - MM_PASSWORD=mmuser_password
+    - MM_DBNAME=mattermost
+  #  - AWS_ACCESS_KEY_ID=XXXX
+  #  - AWS_SECRET_ACCESS_KEY=XXXX
+  #  - WALE_S3_PREFIX=s3://BUCKET_NAME/PATH
+  #  - AWS_REGION=us-east-1
+app:
+  build: app
+  links:
+    - db:db
+  restart: always
+  volumes:
+    - ./volumes/app/mattermost/config:/mattermost/config:rw
+    - ./volumes/app/mattermost/data:/mattermost/data:rw
+    - /etc/localtime:/etc/localtime:ro
+web:
+  build: web
+  ports:
+    - "80:80"
+    - "443:443"
+  links:
+    - app:app
+  restart: always
+  volumes:
+      # This directory must have cert files
+    - ./volumes/web/cert:/cert:ro
+    - /etc/localtime:/etc/localtime:ro
+  environment:
+    - MATTERMOST_ENABLE_SSL=false
+    - PLATFORM_PORT_80_TCP_PORT=80
diff --git a/tx-mattermost/web/Dockerfile b/tx-mattermost/web/Dockerfile
new file mode 100644
index 00000000..21300667
--- /dev/null
+++ b/tx-mattermost/web/Dockerfile
@@ -0,0 +1,22 @@
+FROM pica-debian
+
+RUN apt-get update && apt-get install -y nginx
+
+RUN rm /etc/nginx/sites-enabled/default
+
+COPY mattermost /etc/nginx/sites-available/
+COPY mattermost-ssl /etc/nginx/sites-available/
+ADD docker-entry.sh /
+
+RUN chmod +x /docker-entry.sh
+
+# You can see the logs using `docker-compose logs web`.
+RUN ln -sf /dev/stdout /var/log/nginx/access.log
+RUN ln -sf /dev/stderr /var/log/nginx/error.log
+
+# Define working directory.
+WORKDIR /etc/nginx
+
+ENTRYPOINT /docker-entry.sh
+
+EXPOSE 80 443
diff --git a/tx-mattermost/web/docker-entry.sh b/tx-mattermost/web/docker-entry.sh
new file mode 100644
index 00000000..f0898cdf
--- /dev/null
+++ b/tx-mattermost/web/docker-entry.sh
@@ -0,0 +1,12 @@
+#!/bin/bash
+echo Starting Nginx
+sed -Ei "s/APP_PORT/$PLATFORM_PORT_80_TCP_PORT/" /etc/nginx/sites-available/mattermost
+sed -Ei "s/APP_PORT/$PLATFORM_PORT_80_TCP_PORT/" /etc/nginx/sites-available/mattermost-ssl
+sed -Ei "s/APP_HOST/$APP_HOST/" /etc/nginx/sites-available/mattermost
+sed -Ei "s/APP_HOST/$APP_HOST/" /etc/nginx/sites-available/mattermost-ssl
+
+if [ "$MATTERMOST_ENABLE_SSL" = true ]; then
+    ssl="-ssl"
+fi
+ln -s /etc/nginx/sites-available/mattermost$ssl /etc/nginx/sites-enabled/mattermost
+nginx -g 'daemon off;'
diff --git a/tx-mattermost/web/mattermost b/tx-mattermost/web/mattermost
new file mode 100644
index 00000000..18fd3e85
--- /dev/null
+++ b/tx-mattermost/web/mattermost
@@ -0,0 +1,22 @@
+map $http_x_forwarded_proto $proxy_x_forwarded_proto {
+  default $http_x_forwarded_proto;
+  ''      $scheme;
+}
+
+server {
+    listen 80;
+
+    location / {
+        gzip off;
+
+        client_max_body_size 50M;
+        proxy_set_header Upgrade $http_upgrade;
+        proxy_set_header Connection "upgrade";
+        proxy_set_header Host $http_host;
+        proxy_set_header X-Real-IP $remote_addr;
+        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
+        proxy_set_header X-Forwarded-Proto $proxy_x_forwarded_proto;
+        proxy_set_header X-Frame-Options SAMEORIGIN;
+        proxy_pass http://APP_HOST:APP_PORT;
+    }
+}
diff --git a/tx-mattermost/web/mattermost-ssl b/tx-mattermost/web/mattermost-ssl
new file mode 100644
index 00000000..4ec471fa
--- /dev/null
+++ b/tx-mattermost/web/mattermost-ssl
@@ -0,0 +1,39 @@
+# server {
+#     listen         80;
+#     server_name    mattermost.example.com;
+#     return         301 https://$server_name$request_uri;
+# }
+
+map $http_x_forwarded_proto $proxy_x_forwarded_proto {
+  default $http_x_forwarded_proto;
+  ''      $scheme;
+}
+
+server {
+    listen 443;
+
+    ssl on;
+    ssl_certificate /cert/cert.pem;
+    ssl_certificate_key /cert/key-no-password.pem;
+    ssl_session_timeout 5m;
+    ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
+    ssl_ciphers HIGH:MEDIUM:!SSLv2:!PSK:!SRP:!ADH:!AECDH;
+    ssl_prefer_server_ciphers on;
+
+    location / {
+        gzip off;
+        proxy_set_header X-Forwarded-Ssl on;
+
+        client_max_body_size 50M;
+        proxy_set_header Upgrade $http_upgrade;
+        proxy_set_header Connection "upgrade";
+        proxy_set_header Host $http_host;
+        proxy_set_header X-Real-IP $remote_addr;
+        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
+        proxy_set_header X-Forwarded-Proto $proxy_x_forwarded_proto;
+        proxy_set_header X-Frame-Options SAMEORIGIN;
+        proxy_pass http://APP_HOST:APP_PORT;
+    }
+}
+
+# See https://github.com/mattermost/docs/blob/master/source/install/prod-ubuntu.rst for the SSL configuration
diff --git a/tx-nginx/Dockerfile b/tx-nginx/Dockerfile
new file mode 100644
index 00000000..4b95a4b6
--- /dev/null
+++ b/tx-nginx/Dockerfile
@@ -0,0 +1,26 @@
+FROM pica-debian
+MAINTAINER antoine@barbare.me
+
+RUN echo "deb http://packages.dotdeb.org jessie all" > /etc/apt/sources.list.d/dotdeb.list && \
+wget -O- https://www.dotdeb.org/dotdeb.gpg | apt-key add - && \
+apt-get update -y && apt-get install -y php7.0 php7.0-fpm php7.0-gd php7.0-xml nginx supervisor curl tar
+
+RUN mkdir -p /run/nginx && \
+    mkdir -p /var/www
+
+ADD nginx.conf /etc/nginx/nginx.conf
+ADD supervisord.conf /etc/supervisord.conf
+ADD start.sh /start.sh
+
+RUN echo "cgi.fix_pathinfo = 0;" >> /etc/php/7.0/fpm/php.ini && \
+    sed -i -e "s|;daemonize\s*=\s*yes|daemonize = no|g" /etc/php/7.0/fpm/php-fpm.conf && \
+    sed -i -e "s|listen\s*=\s*127\.0\.0\.1:9000|listen = /var/run/php-fpm7.sock|g" /etc/php/7.0/fpm/pool.d/www.conf && \
+    sed -i -e "s|;listen\.owner\s*=\s*|listen.owner = |g" /etc/php/7.0/fpm/pool.d/www.conf && \
+    sed -i -e "s|;listen\.group\s*=\s*|listen.group = |g" /etc/php/7.0/fpm/pool.d/www.conf && \
+    sed -i -e "s|;listen\.mode\s*=\s*|listen.mode = |g" /etc/php/7.0/fpm/pool.d/www.conf && \    
+    chmod +x /start.sh
+
+EXPOSE 80
+VOLUME ["/var/www"]
+
+CMD /start.sh
diff --git a/tx-nginx/nginx.conf b/tx-nginx/nginx.conf
new file mode 100644
index 00000000..8a8b9137
--- /dev/null
+++ b/tx-nginx/nginx.conf
@@ -0,0 +1,49 @@
+daemon off;
+
+user www-data;
+worker_processes  1;
+
+error_log  stderr error;
+
+events {
+    worker_connections  1024;
+}
+
+http {
+    include       mime.types;
+    default_type  application/octet-stream;
+
+    sendfile        on;
+    #tcp_nopush     on;
+
+    #keepalive_timeout  0;
+    keepalive_timeout  65;
+
+    #gzip  on;
+
+    server {
+        listen 80;
+
+        root /var/www/html;
+        index index.php index.html index.htm;
+
+        client_max_body_size 100M;
+        client_body_buffer_size 128k;
+
+        location ~ \.php$ {
+            try_files $uri =404;
+            fastcgi_pass unix:/run/php/php7.0-fpm.sock;
+            fastcgi_index index.php;
+            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
+            include fastcgi_params;
+        }
+
+        location ~ /\.ht {
+            deny all;
+        }
+
+        location ~ /(data|conf|bin|inc)/ {
+            deny all;
+        }
+    }
+}
diff --git a/tx-nginx/start.sh b/tx-nginx/start.sh
new file mode 100755
index 00000000..3fab0158
--- /dev/null
+++ b/tx-nginx/start.sh
@@ -0,0 +1,7 @@
+#!/bin/sh
+
+set -e
+
+chown -R www-data /var/www
+
+exec /usr/bin/supervisord -c /etc/supervisord.conf
diff --git a/tx-nginx/supervisord.conf b/tx-nginx/supervisord.conf
new file mode 100644
index 00000000..92bca8b4
--- /dev/null
+++ b/tx-nginx/supervisord.conf
@@ -0,0 +1,23 @@
+[supervisord]
+nodaemon=true
+
+[supervisorctl]
+serverurl=unix:///var/run/supervisor.sock
+
+[unix_http_server]
+file=/var/run/supervisor.sock
+
+[rpcinterface:supervisor]
+supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
+
+[program:php]
+command=/usr/sbin/php-fpm7.0
+stdout_logfile=/dev/stdout
+stdout_logfile_maxbytes=0
+redirect_stderr=true
+
+[program:nginx]
+command=/usr/sbin/nginx
+stdout_logfile=/dev/stdout
+stdout_logfile_maxbytes=0
+redirect_stderr=true
-- 
GitLab