Deploying Mattermost on Northflank will allow you to manage and scale all of your Mattermost resources independently, and configure them for high availability for mission-critical purposes.
In this guide, you will learn how to deploy Mattermost on Northflank with PostgresSQL and MinIO® for persistent storage of data and files. We'll also look at deploying different versions of Mattermost, and adding and using a custom domain with your Mattermost service on Northflank.
Firstly, sign up or login to your Northflank account and create or select your team.
Click here to deploy an addon, and create or select the project you want to use. Selectpostgresql
as the type and name it Mattermost data
. Leave the other settings as default and click create addon. While your PostgreSQL addon is provisioning create another addon, this time select MinIO as the type. Enter Mattermost store
as the name, leave the other settings as default and and click create addon.
You'll also need to create a bucket for your Mattermost files. You can temporarily expose your MinIO instance publicly by selecting publicly accessible from the addon's settings page.
Open the addon's connection details page and copy the MINIO_CONSOLE_ENDPOINT
(or the external console endpoint, if publicly exposed). Paste the endpoint into your browser's address bar and open the page. Use the ADMIN_USERNAME
and ADMIN_PASSWORD
to log in, and create a new bucket with the name mattermost
in the console.
You can now update the settings so that your addon is no longer publicly accessible, and it will only be accessible from services running in your project.
Deploy a new service in your project, and select deployment. Enter the name `Mattermost` for the service and select external image as the deployment source.We'll deploy the image from the official Mattermost Docker Hub registry, enter mattermost/mattermost-team-edition:9.4
for this example. You can also use the tag latest
to deploy the most recently released image, or use the image mattermost-enterprise-edition
to deploy the enterprise edition.
In the networking configure the following ports:
8065
- HTTP (publicly expose)8443
- TCP8443
- UDP8045
- HTTP
The HTTP port will make your Mattermost service accessible via the browser, or Mattermost desktop and mobile apps. For this demo we will make it public from the start, but it would be sensible to securely forward the it with the Northflank CLI until the intial setup is completed.
The TCP and UDP ports enable voice calls on Mattermost, and 8045 to expose the Mattermost API.
Click create service to deploy the image. The container will deploy but the service will error, as it lacks the necessary environment variables.
Create a new secret group in your project. This will contain the connection details for your PostgreSQL and MinIO addons, as well as environment variables to configure your Mattermost deployment.Name the group Mattermost secrets
and select the env mode in the secrets editor. Copy the following into your own secret group:
MM_SERVICESETTINGS_SITEURL=""
MM_SQLSETTINGS_DRIVERNAME="postgres"
MM_FILESETTINGS_DRIVERNAME="amazons3"
MM_FILESETTINGS_MAXFILESIZE="104857600"
MM_FILESETTINGS_EXTRACTCONTENT=true
MM_FILESETTINGS_AMAZONS3SSL=true
MM_FILESETTINGS_AMAZONS3BUCKET="mattermost"
In the MM_SERVICESETTINGS_SITEURL
enter the Northflank-generated domain name for your Mattermost deployment. It will look something like this p01--mattermost–{random-string}.code.run
. This tells the Mattermost deployment what URL it is using, which is required to use integrations and other features.
The other environment variables configure the deployment to use the PostgreSQL and MinIO addons. If you named your MinIO bucket something else you will need to change the value of MM_FILESETTINGS_AMAZONS3BUCKET
to match it.
Click update configuration to save the secrets. As they are unrestricted they will be available to all resources in your project, including the Mattermost service.
Learn more about configuring Mattermost via environment variables in their documentation.
In your secret group open the linked addons page and configure on the PostgreSQL addon. Click the variable POSTGRES_URI
to add it to the secret group, and add an alias with the value MM_SQLSETTINGS_DATASOURCE
. Click update link to save the changes and make the database available in your Mattermost deployment.
Next click configure on your MinIO addon. You'll need to add the HOST
, PORT
, ACCESS_KEY
, and SECRET_KEY
variables. Give ACCESS_KEY
the alias MM_FILESETTINGS_AMAZONS3ACCESSKEYID
and SECRET_KEY
the alias MM_FILESETTINGS_AMAZONS3SECRETACCESSKEY
. Click update link to save these details, and then open your secrets editor in a new tab or window.
As the Mattermost deployment expects the S3-compatible service connection details without the protocol prefix (without http(s)://
), we must use the host and port connection details rather than the MinIO endpoint secret.
Add a new variable called MM_FILESETTINGS_AMAZONS3ENDPOINT
with the value ${NF_MINIO_MATTERMOST_STORE_HOST}:${NF_MINIO_MATTERMOST_STORE_HOST}
, which will pass the values from the linked addon to your Mattermost container in the required format.
Now that your addons have been configured and the necessary environment variables have been added you can return to your Mattermost deployment service and click rollout restart to redeploy the container. This will start a new instance that now has the environment variables.
You can click on the new container to view the logs, and when the container is ready you can access it using the public DNS listed in the header of the service.
You should be greeted with the Mattermost account creation screen and can now create your admin account, log in, and begin configuring your Mattermost deployment.
You can scale up components of your Mattermost deployment depending on your requirements, for example if your database or storage begins to fill up you can increase the disk size of your addons, or you can configure your addons and deployments for high availability to ensure that they can always be accessed.
You can increase your PostgreSQL and MinIO instances to take advantage of high availability features.
You can increase the number of Mattermost instances to ensure a container is always available to serve requests, and increase the compute plan of addons and deployments so individual containers can handle higher demand.
You can also schedule regular backups to meet compliance requirements and for peace of mind.
If you have a custom domain you can add it to your Northflank account to link it to your deployments.
When creating your Mattermost deployment, or from the ports & DNS page of your service, you can link the domain to the HTTP (8065
) port.
Update or add your domain in the MM_SERVICESETTINGS_SITEURL
variable in your secret group and restart the service to use your domain.
If you have an existing Mattermost deployment that you'd like to migrate to Northflank you can follow our documentation on migrating your PostgreSQL data and MinIO storage.
Northflank allows you to deploy your code and databases within minutes. Sign up for a Northflank account and create a free project to get started.
- Deployment of Docker containers
- Create your own stateful workloads
- Persistent volumes
- Observe & monitor with real-time metrics & logs
- Low latency and high performance
- Multiple read and write replicas
- Backup, restore and fork databases