This repo is a collection of scripts to deploy Mattermost on Clever Cloud using a Node.js app out of the box.
In order to deploy this repo on Clever Cloud, you need the following:
- A Clever Cloud account
- A running database (either a MySQL or a PostrgeSQL add-on) on Clever Cloud
- A running Cellar add-on for object (S3) storage on Clever Cloud
Follow these steps to deploy Mattermost on Clever Cloud.
From the Clever Cloud console, go to your Cellar add-on's dashboard, enter the name of your bucket (it can be anything) and click on Create bucket*.
Mattermost is usually configured with a config.json
file, but you can override this file by injecting environment variables. On Clever Cloud, environment variables are injected dynamically, the following steps give you the ones you need to deploy Mattermost.
Check both your database add-on and your Cellar addon dashboard in the Console to get the environement variables' values.
- Create a new Node.js app
- Follow the creation tunnel until you get to the environment variables
- Set the following environment variables
MATTERMOST_VERSION="<your_desired_version>"
- The port to listen to :
MM_SERVICESETTINGS_LISTENADDRESS=":8080"
- Database connection string: Replace
< >
statement with the appropiate URI from your database environment variable:- For PostrgeSQL:
MM_SQLSETTINGS_DATASOURCE="<POSTGRESQL_ADDON_URI_value>?sslmode=disable&connect_timeout=10
- For MySQL:
MM_SQLSETTINGS_DATASOURCE=<MYSQL_ADDON_URI_value>?charset=utf8mb4,utf8&writeTimeout=30s"
- Database driver:
MM_SQLSETTINGS_DRIVERNAME="postgres"
or"mysql"
- The maximum open connections allowed to your database:
MM_SQLSETTINGS_MAXOPENCONNS="<maximum_connections_to_db>"
(find it in Add-on dashboard > Information > "Features" section)
- For PostrgeSQL:
- Your S3 credentials:
MM_FILESETTINGS_AMAZONS3ACCESSKEYID="<cellar_Key_ID>"
MM_FILESETTINGS_AMAZONS3BUCKET="<bucket_name>"
MM_FILESETTINGS_AMAZONS3ENDPOINT="cellar-c2.services.clever-cloud.com"
MM_FILESETTINGS_AMAZONS3SECRETACCESSKEY="<cellar_Key_Secret>"
MM_FILESETTINGS_DRIVERNAME="amazons3"
After configuring your variables, you are ready to push this repo to Clever Cloud. Once the deployment finishes, your Mattermost app stays connected to your database and will store assets in Cellar.
📌 Note: Since you are injecting the database and Cellar credentials in the environment variables, you don't need to connect the app to the add-ons in the console.
🎓 More questions on deployments? Read our doc.