If you haven’t set up your developer environment, please do so before continuing with this section.
Join the Developers community channel to ask questions from community members and the Mattermost core team.
Here’s a general workflow a Mattermost developer working on the mattermost-server repository:
MM-####where #### is the ticket number if it is a Jira ticket, or
GH-####if it is a GitHub Issue without a Jira ticket.
make run-serverfrom the root directory of the server respository. This will start up the server at
http://localhost:8065. To get changes to the server it must be restarted with
make restart-server. If you want to test with the web app, you may also run
make runwhich will start the server and a watcher for changes to the web app.
make stopin the server repository, then run
make check-styleto check your syntax and
make testto run the tests.
make runwill run the server, symlink your mattermost-webapp folder and start a watcher for the web app
make stopstops the server and the web app watcher
make run-serverwill run only the server and not the client
make debug-serverwill run the server in the
make stop-serverstops only the server
make clean-dockerstops and removes your Docker images and is a good way to wipe your database
make cleancleans your local environment of temporary files
make nukewipes your local environment back to a completely fresh start
make packagecreates packages for distributing your builds and puts them in the
~/go/src/github.com/mattermost/mattermost-server/distdirectory. First you will need to run
make megacheckruns the tool megacheck against the code base to find potential issues in the code. Please note the results are guidelines, and not mandatory in all cases. If in doubt, ask in the Developers community channel.
Since running every single unit test takes a lot of time while making changes, you can run a subset of the serverside unit tests by using the following:
go test -v -run='<test name or regex>' ./<package containing test>
For example, if you wanted to run
api/post_test.go, you would run the following:
go test -v -run='TestPostUpdate' ./api
During development you may want to reset the database and generate random data for testing your changes. For this purpose, Mattermost has the following commands in the mattermost CLI:
Install the server with
go install ./cmd/mattermost in the server repository.
You can reset your database to the initial state using:
After that, you can generate random data to populate the Mattermost database using:
You can create an account using the following command:
mattermost user create --email firstname.lastname@example.org --username test1 --password mypassword
Optionally, you can make that account a System Admin with the following command:
mattermost user create --email email@example.com --username test1 --password mypassword --system_admin
When Docker starts, the SMTP server is available on port 2500. Username and password are not required.
You can access Inbucket webmail on port 9000.
For additional information on configuring an SMTP email server, including troubleshooting steps, see https://docs.mattermost.com/install/smtp-email-setup.html.
To test a locally compiled version of Mattermost with GitLab Omnibus, replace the following GitLab files: