Skip to content

Mattermost Role

Overview

The Mattermost role deploys a team collaboration and notification platform as a rootless Podman container with a PostgreSQL database. It features optional TLS support, systemd integration using Quadlets, and support for webhooks and bot APIs.

Requirements

  • Podman 4.x or later
  • Systemd
  • A user with sudo access

Installation / Quick Start

Orchestrator

# Prepare
./manage-svc.sh mattermost prepare

# Deploy
./manage-svc.sh mattermost deploy

# Verify
./svc-exec.sh mattermost verify

Role Variables / Configuration

Key Variables

Name Description Default
mattermost_postgres_password The password for the PostgreSQL database. change_this_password
mattermost_port The port to expose the Mattermost service on. 8065
mattermost_site_url The URL for the Mattermost site. ""
mattermost_enable_tls Whether to enable TLS. false
mattermost_site_name The name of the Mattermost site. Mattermost

TLS Configuration

Name Description Default
mattermost_tls_cert_file Path to the TLS certificate file. ""
mattermost_tls_key_file Path to the TLS key file. ""

Usage

After deployment, Mattermost is available at http://localhost:8065 (or https://localhost:8065 with TLS).

Initial Setup

  1. Open a browser to http://localhost:8065.
  2. Create an admin account.
  3. Set up a team and channels.

Integration Examples

Webhook Integration

# Send notification
curl -X POST http://localhost:8065/hooks/YOUR_WEBHOOK_ID \
  -H 'Content-Type: application/json' \
  -d '{"text":"Test notification from CI/CD"}'

Bot Integration

Mattermost supports bot accounts for automated interactions via the API.

Service Management

# Check status
systemctl --user status mattermost-pod

# View logs
podman logs mattermost-svc
podman logs mattermost-db

# Restart
systemctl --user restart mattermost-pod

Troubleshooting

Database Connection Issues

Check that the PostgreSQL container is running:

podman logs mattermost-db

Port Already in Use

Change the port in the configuration:

mattermost_port: 8066

Role-Specific Sections

Directory Structure

mattermost_data_dir/
├── config/          # Mattermost configuration
├── data/            # Application data
├── logs/            # Application logs
├── plugins/         # Server plugins
├── client/plugins/  # Client plugins
└── postgres/        # Database files

Backup

Database Backup

podman exec mattermost-db pg_dump -U mmuser mattermost > backup.sql

Full Backup

tar czf mattermost-backup-$(date +%Y%m%d).tar.gz ~/mattermost-data

Removal

# Keep data
./manage-svc.sh mattermost remove

# Delete everything
./manage-svc.sh mattermost remove -e mattermost_delete_data=true

Reference

License

MIT

Author

Created by jackaltx and Claude.