Skip to content

Mattermost Role

Team collaboration and notification platform deployed as a Podman container with PostgreSQL database.

Features

  • Rootless Podman deployment
  • PostgreSQL database container included
  • Optional TLS support
  • Systemd integration using Quadlets
  • Webhook and bot API support

Requirements

  • Podman 4.x or later
  • Systemd
  • User with sudo access

Quick Start

# Prepare
./manage-svc.sh mattermost prepare

# Deploy
./manage-svc.sh mattermost deploy

# Verify
./svc-exec.sh mattermost verify

Configuration

Key Variables

mattermost_postgres_password: "change_this_password"
mattermost_port: 8065
mattermost_site_url: ""
mattermost_enable_tls: false
mattermost_site_name: "Mattermost"

TLS Configuration

mattermost_enable_tls: true
mattermost_tls_cert_file: "/path/to/cert.pem"
mattermost_tls_key_file: "/path/to/key.pem"

Directory Structure

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

Usage

Access

After deployment, Mattermost is available at: - URL: http://localhost:8065 - With TLS: https://localhost:8065

Initial Setup

  1. Open browser to http://localhost:8065
  2. Create admin account
  3. Set up 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 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

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

Use Cases

  • Test result notifications
  • CI/CD integration testing
  • Bot development
  • Webhook testing
  • Team collaboration in development environments

Troubleshooting

Database Connection Issues

Check PostgreSQL is running:

podman logs mattermost-db

Port Already in Use

Change port in configuration:

mattermost_port: 8066

Removal

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

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

License

MIT

Author

Created by jackaltx and Claude.