Skip to content

CleverCloud/mattermost-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Mattermost on Clever Cloud

Clever Cloud - PaaS

This example shows how to deploy Mattermost on Clever Cloud using the Linux native runtime.

About the Application

Mattermost is an open-source messaging platform for secure team collaboration. This example deploys Mattermost on Clever Cloud using the Linux native runtime, which runs the official Mattermost binary directly — no Docker or Node.js wrapper needed.

The mise.toml file defines two tasks:

  • build: Downloads and extracts the Mattermost server binary
  • run: Starts the Mattermost server

A setup-cellar.sh script is also provided to create the S3 bucket on Cellar via s3cmd.

Prerequisites

Deploying on Clever Cloud

You have two options to deploy your application on Clever Cloud: using the Web Console or using the Clever Tools CLI.

Option 1: Deploy using the Web Console

1. Create an account on Clever Cloud

If you don't already have an account, go to the Clever Cloud console and follow the registration instructions.

2. Set up your application on Clever Cloud

  1. Log in to the Clever Cloud console
  2. Click on "Create" and select "An application"
  3. Choose Linux as the runtime environment
  4. Configure your application settings (name, region, etc.)

3. Create a Cellar add-on and bucket

  1. Create a Cellar add-on from the console
  2. In the Cellar add-on dashboard, click on "Create a bucket" and give it a name
  3. Add the environment variable CELLAR_ADDON_BUCKET with the name of your bucket

Create bucket option on Clever Cloud Console

4. Configure Environment Variables

In your application's settings, add the following environment variables:

Variable Required Description
MATTERMOST_VERSION Yes Mattermost version to deploy (e.g., 11.5.1)
MM_SERVICESETTINGS_LISTENADDRESS Yes Must be set to :8080
MM_SQLSETTINGS_DRIVERNAME Yes postgres or mysql
MM_SQLSETTINGS_DATASOURCE Yes Database connection string (see below)
MM_SQLSETTINGS_MAXOPENCONNS Yes Max open DB connections (see add-on dashboard > Information > Features)
CELLAR_ADDON_BUCKET Yes Name of your Cellar bucket
MM_FILESETTINGS_DRIVERNAME Yes Set to amazons3
MM_FILESETTINGS_AMAZONS3ACCESSKEYID Yes Cellar Key ID
MM_FILESETTINGS_AMAZONS3SECRETACCESSKEY Yes Cellar Key Secret
MM_FILESETTINGS_AMAZONS3BUCKET Yes Same as CELLAR_ADDON_BUCKET
MM_FILESETTINGS_AMAZONS3ENDPOINT Yes cellar-c2.services.clever-cloud.com

Database connection string format:

  • For PostgreSQL: <POSTGRESQL_ADDON_URI>?sslmode=disable&connect_timeout=10
  • For MySQL: <MYSQL_ADDON_URI>?charset=utf8mb4,utf8&writeTimeout=30s

5. Deploy Your Application

You can deploy your application using Git:

# Add Clever Cloud as a remote repository
git remote add clever git+ssh://git@push-par-clevercloud-customers.services.clever-cloud.com/app_<your-app-id>.git

# Push your code to deploy
git push clever master

Option 2: Deploy using Clever Tools CLI

1. Install Clever Tools

Install the Clever Tools CLI following the official documentation:

# Using npm
npm install -g clever-tools

# Or using Homebrew (macOS)
brew install clever-tools

2. Log in to your Clever Cloud account

clever login

3. Create a new application

# Initialize the current directory as a Clever Cloud Linux application
clever create --type linux <YOUR_APP_NAME>

4. Create a database add-on

# For PostgreSQL
clever addon create postgresql-addon <YOUR_DB_ADDON_NAME> --plan xxs_sml --link <YOUR_APP_NAME>

# Or for MySQL
clever addon create mysql-addon <YOUR_DB_ADDON_NAME> --plan s_sml --link <YOUR_APP_NAME>

5. Create a Cellar add-on

clever addon create cellar-addon <YOUR_CELLAR_ADDON_NAME> --plan s --link <YOUR_APP_NAME>

Set the bucket name (S3 bucket names are globally unique, so using your app ID avoids conflicts):

clever env set CELLAR_ADDON_BUCKET $(clever applications -j | jq -r '.[0].app_id' | tr '_' '-')

Create the bucket:

# Load env variables
eval "$(clever env -F shell)"
./setup-cellar.sh

6. Configure environment variables

# Mattermost version (check https://mattermost.com/download/)
clever env set MATTERMOST_VERSION "11.5.1"

# Mattermost must listen on port 8080
clever env set MM_SERVICESETTINGS_LISTENADDRESS ":8080"

# Database driver
clever env set MM_SQLSETTINGS_DRIVERNAME "postgres"

# Database connection string (replace with your add-on URI)
clever env set MM_SQLSETTINGS_DATASOURCE "$(clever env | grep POSTGRESQL_ADDON_URI | cut -d= -f2 | tr -d '"')?sslmode=disable&connect_timeout=10"

# Max open DB connections (check your add-on dashboard > Information > Features)
clever env set MM_SQLSETTINGS_MAXOPENCONNS "5"

# S3 storage (uses Cellar credentials injected by the linked add-on)
clever env set MM_FILESETTINGS_DRIVERNAME "amazons3"
clever env set MM_FILESETTINGS_AMAZONS3ACCESSKEYID "$(clever env | grep CELLAR_ADDON_KEY_ID | cut -d= -f2 | tr -d '"')"
clever env set MM_FILESETTINGS_AMAZONS3SECRETACCESSKEY "$(clever env | grep CELLAR_ADDON_KEY_SECRET | cut -d= -f2 | tr -d '"')"
clever env set MM_FILESETTINGS_AMAZONS3BUCKET "$(clever env | grep CELLAR_ADDON_BUCKET | cut -d= -f2 | tr -d '"')"
clever env set MM_FILESETTINGS_AMAZONS3ENDPOINT "cellar-c2.services.clever-cloud.com"

7. Deploy your application

clever deploy

8. Open your application in a browser

clever open

Mattermost Configuration

Beyond the variables listed above, Mattermost supports extensive configuration through environment variables using the MM_<SECTION>_<KEY> pattern. For example:

# Set the site URL
clever env set MM_SERVICESETTINGS_SITEURL "https://your-app.cleverapps.io"

# Enable email notifications
clever env set MM_EMAILSETTINGS_SENDEMAILNOTIFICATIONS "true"

Any setting from the Mattermost configuration file can be overridden this way. See the Mattermost configuration documentation for all available options.

Monitoring Your Application

Once deployed, you can monitor your application through:

  • Web Console: The Clever Cloud console provides logs, metrics, and other tools to help you manage your application.
  • CLI: Use clever logs to view application logs and clever status to check the status of your application.

Additional Resources

About

Run Mattermost on Clever Cloud

Topics

Resources

Stars

Watchers

Forks

Contributors

Languages