Mattermost Platform

Installing Mattermost to Heroku

If you’re short on time… 

… you should be able to get a preview instance of Mattermost running in under two minutes—guaranteed! Click the button to begin:

(And now for the full blog post!)

Why Use Mattermost and Heroku Together?

Heroku is a wonderful cloud platform that allows developers to provision and operate applications. It enables the kind of fast feedback loop that developers crave. There is a heavy layer of abstraction when using Heroku to run applications, but it’s a valid tradeoff considering its ability to bootstrap projects. 

In this article, we will provide the steps you need to take in order to get Mattermost running on the Heroku Cloud Platform. 

Installation Steps

Prerequisite: Please ensure that you are signed up for an account on Heroku. 

1. Click the Deploy To Heroku button to begin the deployment process. 

2. When you click the button, the Heroku Interface for creating an app will open.

3. Input a name for this Mattermost instance. Make sure that the validation check for the name passes. 

4. Scroll to the bottom to make use of the default settings (no external storage, built-in database) for the deployment. Click on the Deploy app button to begin the deployment.

5. Wait for all the steps to complete. A successful deployment will look like this:

Successful Heroku deployment

6. In order to access the Mattermost instance, click on the ➦View button. This will open a new browser window and initiate the configuration of the fresh Mattermost instance.

7. Fill in the required details and click on Create Account to create the first Admin account on the instance. Next, create a Team and confirm the Team URL. 

8. Congratulations! The instance is now ready to use.

How does this work?

To fully comprehend how this installation happens, you need to understand Buildpacks

Heroku was the first tech to popularize Buildpacks as a tool. Buildpacks provide the means and the mechanism to translate source code or binaries into an immutable artifact — known as a Slug in the Heroku-niverse — that can then be deployed onto a web server. 

Internally, Buildpacks are a collection of scripts that are executed in various stages defined as a “lifecycle.” They are designed to work with any language by parsing through the code and detecting the language, runtime, and/or framework. Next, they perform a compilation, which is the actual build, and finally export the artifact that gets released.

In this specific case, the installation makes use of what is known as an Inline Buildpack. Essentially, they go through the same stages but the function of the Buildpack is replicated within the application. This is accomplished by including the various scripts in a “bin” directory as part of the source itself. Thus, the app is capable of building and deploying itself. 

The Buildpack also exposes a lot of parameters that can be configured such as links to external databases, storage, domain servers, etc. In order to fully customize the installation, you can fine-tune these specific parameters. More details are available here

What can you do with this instance?

The Mattermost instance that is installed with the default configuration on Heroku is good only for a preview. In order to make use of the instance permanently, two important changes are required: 

1. Connecting to a database 

Make use of the config-Heroku-template-.json file and alter the SqlSettings parameter to connect to a data source by specifying the URL of the external database.

2. Connecting to external storage 

Under Config Variables, five parameters are available that you can use to configure access to AWS Amazon S3 storage. 

Unless you create both a persistent database and file storage, the instance will only be a preview one which will continuously recycle every time the Heroku dynos restart.

Conclusion

Installing Mattermost on Heroku is a great way to test the waters and get a feel for the tool firsthand. With a handful of config changes, it is possible to even run a production-grade instance of Mattermost on Heroku. 

Mattermost is open at its core and those interested in getting involved are welcome to learn more about the ways to contribute. Stop by our community server to say hello if you’re interested in connecting directly with our contributors.

mm

Ram Iyengar is an engineer by practice and an educator at heart. He enjoys helping engineering teams around the world discover new and creative ways to work.

We use cookies for advertising, social media and analytics purposes. Read about how we use cookies here. By continuing to use this site, you consent to our use of cookies.