Mattermost: 4. Create the service

This documentation is part of the Automate with the CLI guide. You can view the complete guide here: Start Mattermost, retrieve its credentials, and modify its configuration programmatically using the Stackhero CLI.

Welcome to the Stackhero documentation

Stackhero offers a production-ready Mattermost cloud environment designed for seamless collaboration and enhanced data protection. Key benefits include:

  • Unlimited users and channels to support your team's growth without restrictions.
  • A dedicated SMTP email server with no extra limits, included by default.
  • Full control over your domain name, automatically secured with HTTPS (for example, https://chat.your-company.com).
  • Updates made simple, managed with a single click.
  • High performance and advanced security on a private, dedicated infrastructure: your data remains isolated and confidential.
  • Hosting available in both 🇪🇺 Europe and 🇺🇸 USA regions.

You can get started in just a few minutes. Stackhero takes care of installation, security, and operational management for your Mattermost cloud hosting, providing you with a secure and scalable collaboration platform with minimal effort.

Below is a sample script that creates a stack, adds your Mattermost service to it, waits for it to start, retrieves its configuration (including generated credentials), and then applies a new configuration.

#!/bin/bash
set -e

export STACKHERO_TOKEN="usr-xxxxxx:your-token"

serviceStore="mattermost"   # The Mattermost service store name (see step 2)
instance="..."                # An instance size from step 3
region="europe"               # A region name from step 3

# Create a stack for your service (uses your default organization; add --organization if needed)
stackId=$(stackhero --format=script stack-create \
  --name="My Mattermost stack")
echo "Stack created: ${stackId}"

# Add Mattermost to the stack (names are resolved automatically)
serviceId=$(stackhero --format=script service-add \
  --stack="My Mattermost stack" \
  --service-store="${serviceStore}" \
  --instance="${instance}" \
  --region="${region}")
echo "Service added: mattermost"

# Wait for the service to be fully operational (this may take a few minutes)
stackhero service-wait-for --service="mattermost"

# Retrieve the service configuration, including generated credentials
stackhero service-configuration-get --service="mattermost" --format=json