Mattermost: 4. Create the service
This documentation is part of the Automate with the CLI guide. View the full guide here: Start Mattermost, retrieve its credentials, and change its configuration programmatically with the Stackhero CLI.
Welcome to the Stackhero documentation
Stackhero delivers a production-ready Mattermost cloud environment designed for seamless collaboration and strong data protection. Key advantages include:
- Unlimited users and channels for unrestricted team growth.
- A dedicated SMTP email server with no additional limits, included by default.
- Full control over your domain name, secured automatically with HTTPS (such as https://chat.your-company.com).
- Hassle-free updates managed in a single click.
- High performance and advanced security on a private, dedicated infrastructure: your data stays isolated and confidential.
- Hosting available in both 🇪🇺 Europe and 🇺🇸 USA regions.
You can get started in just minutes. Stackhero handles setup, security, and operational management for your Mattermost cloud hosting, providing a secure and scalable collaboration platform with minimal effort.
Here 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 running (this may take a couple of minutes)
stackhero service-wait-for --service="mattermost"
# Retrieve the service configuration, including generated credentials
stackhero service-configuration-get --service="mattermost" --format=json