Set up your development environment for building, running, and testing Mattermost.
If you’re using Windows, we recommend using the Windows Subsystem for Linux (WSL) for Mattermost development. Go and Node must be run from within WSL, so you’ll need to install them in WSL even if you already have the Windows versions of them installed.
wsl --install
Install make
.
On Ubuntu, you can install build essential
tools which will also take care of installing the make
:
sudo apt install build-essential
Install Docker. If you don’t want to use Docker, you can follow this guide.
docker
commands under WSL2, if you receive the error The command 'docker' could not be found in this WSL 2 distro.
you may need to toggle the Use the WSL 2 based engine
off and on within Docker Settings after installation.Install Go.
Increase the number of available file descriptors. Update your shell’s initialization script (e.g. .bashrc
or .zshrc
), and add the following:
ulimit -n 8096
If you don’t have it already, install libpng with your preferred package manager.
If you are on ARM based Mac, you’ll need to install Rosetta to make libpng
work. Rosetta can be installed by the following command-
softwareupdate --install-rosetta
Clone the Mattermost source code from your fork:
git clone https://github.com/YOUR_GITHUB_USERNAME/mattermost.git
Install NVM and use it to install the required version of Node.js:
First, install NVM by following these instructions.
Then, use NVM to install the correct version of Node.js for the Mattermost web app (this should be run within the webapp
directory):
nvm install
Start the server:
cd server
make run-server
Test your environment:
curl http://localhost:8065/api/v4/system/ping
If successful, the curl
step will return a JSON object:
{"AndroidLatestVersion":"","AndroidMinVersion":"","DesktopLatestVersion":"","DesktopMinVersion":"","IosLatestVersion":"","IosMinVersion":"","status":"OK"}
Run the webapp and watch:
make run
Stop the server:
make stop-server
The stop-server
make target does not stop all the docker containers started by run-server
. To stop the running docker containers:
make stop-docker
Set your options:
Some behaviors can be customized such as running the server in the foreground as described in the config.mk
file in the server directory. See that file for details.
Install make
.
build essential
tools which will also take care of installing the make
:
sudo apt install build-essential
Set MM_NO_DOCKER
to true
in the server/config.mk
file.
Install PostgreSQL
Run psql postgres
. Then create mmuser
by running CREATE ROLE mmuser WITH LOGIN PASSWORD 'mostest';
Modify the role to give rights to create a database by running ALTER ROLE mmuser CREATEDB;
Confirm the role rights by running \du
Before creating the database, exit by running \q
Login again via mmuser
by running psql postgres -U mmuser
Create the database by running CREATE DATABASE mattermost_test;
and exit again with \q
Login again with psql postgres
and run GRANT ALL PRIVILEGES ON DATABASE mattermost_test TO mmuser;
to give all rights to mmuser
Install Go.
Increase the number of available file descriptors. Update your shell’s initialization script (e.g. .bashrc
or .zshrc
), and add the following:
ulimit -n 8096
If you don’t have it already, install libpng with your preferred package manager.
libpng
work. Rosetta can be installed by the following command-
softwareupdate --install-rosetta
Clone the Mattermost source code from your fork:
git clone https://github.com/YOUR_GITHUB_USERNAME/mattermost.git
Install NVM and use it to install the required version of Node.js:
webapp
directory):
nvm install
Start the server:
cd server
make run-server
Test your environment:
curl http://localhost:8065/api/v4/system/ping
If successful, the curl
step will return a JSON object:
{"AndroidLatestVersion":"","AndroidMinVersion":"","DesktopLatestVersion":"","DesktopMinVersion":"","IosLatestVersion":"","IosMinVersion":"","status":"OK"}
Run the webapp and watch:
make run
Stop the server:
make stop-server
Set your options:
Some behaviors can be customized such as running the server in the foreground as described in the config.mk
file in the server directory. See that file for details.