# Team Collaboration Stack

> Complete team platform with Mattermost chat, Outline wiki, and MinIO file storage

- Category: Productivity & Collaboration
- Difficulty: intermediate
- Components: mattermost, outline, postgres, redis, minio
- Tags: mattermost, chat, wiki, outline, collaboration, team
- Source: https://docker.recipes/productivity/team-collaboration-stack

## Overview

Mattermost is an open-source team messaging platform designed as a Slack alternative, offering enterprise-grade security and self-hosted deployment. Originally developed by SpinPunch in 2016, Mattermost has become the go-to solution for organizations requiring full control over their communication data while maintaining modern chat functionality including channels, direct messages, file sharing, and extensive integrations. This stack combines Mattermost with Outline wiki for knowledge management and MinIO for S3-compatible object storage, creating a comprehensive team collaboration environment. The integration leverages PostgreSQL databases for both Mattermost and Outline, with Redis providing session management and caching for Outline, while MinIO handles file attachments and media storage across both platforms. This combination addresses the core challenge of fragmented team tools by providing chat, documentation, and file storage in a unified, self-hosted environment. Small to medium businesses, development teams, and organizations with strict data sovereignty requirements will find this stack particularly valuable, as it eliminates the need for multiple SaaS subscriptions while providing enterprise-level collaboration features under complete organizational control.

## Features

- Mattermost Team Edition with unlimited users and message history
- Outline wiki with real-time collaborative editing and markdown support
- S3-compatible MinIO storage for file attachments and media across both platforms
- PostgreSQL databases providing ACID compliance for message and document integrity
- Redis-powered caching for improved Outline performance and session management
- Mattermost plugin ecosystem supporting custom integrations and bots
- Outline's advanced search capabilities across all team documentation
- MinIO web console for direct file management and bucket administration

## Use cases

- Software development teams needing chat, documentation, and code artifact storage
- Healthcare organizations requiring HIPAA-compliant team communication and knowledge base
- Educational institutions wanting student collaboration tools without data sharing concerns
- Government agencies needing secure internal communication and document management
- Remote-first companies building comprehensive digital workplace infrastructure
- IT departments replacing multiple SaaS tools with self-hosted alternatives
- Startups requiring professional team tools without recurring subscription costs

## Prerequisites

- Minimum 4GB RAM (2GB for MinIO, 1GB each for PostgreSQL instances, remainder for other services)
- Available ports 3000, 8065, 9000, and 9001 on the host system
- Environment variables configured for database credentials and MinIO access keys
- Basic understanding of Mattermost team setup and user management
- Familiarity with S3 bucket concepts for MinIO storage configuration
- PostgreSQL administration knowledge for database maintenance and backups

## docker-compose.yml

```yaml
services:
  mattermost:
    image: mattermost/mattermost-team-edition:latest
    container_name: mattermost
    restart: unless-stopped
    ports:
      - "${MM_PORT:-8065}:8065"
    environment:
      - TZ=${TZ:-UTC}
      - MM_SQLSETTINGS_DRIVERNAME=postgres
      - MM_SQLSETTINGS_DATASOURCE=postgres://${DB_USER}:${DB_PASSWORD}@mattermost-db:5432/mattermost?sslmode=disable
      - MM_SERVICESETTINGS_SITEURL=http://localhost:${MM_PORT:-8065}
    volumes:
      - mattermost_data:/mattermost/data
      - mattermost_logs:/mattermost/logs
      - mattermost_config:/mattermost/config
      - mattermost_plugins:/mattermost/plugins
    depends_on:
      - mattermost-db

  mattermost-db:
    image: postgres:15-alpine
    container_name: mattermost-db
    restart: unless-stopped
    environment:
      - POSTGRES_USER=${DB_USER}
      - POSTGRES_PASSWORD=${DB_PASSWORD}
      - POSTGRES_DB=mattermost
    volumes:
      - mattermost_db_data:/var/lib/postgresql/data

  outline:
    image: outlinewiki/outline:latest
    container_name: outline
    restart: unless-stopped
    ports:
      - "${OUTLINE_PORT:-3000}:3000"
    environment:
      - SECRET_KEY=${OUTLINE_SECRET}
      - UTILS_SECRET=${OUTLINE_UTILS_SECRET}
      - DATABASE_URL=postgres://${DB_USER}:${DB_PASSWORD}@outline-db:5432/outline
      - REDIS_URL=redis://outline-redis:6379
      - URL=http://localhost:${OUTLINE_PORT:-3000}
      - AWS_ACCESS_KEY_ID=${MINIO_USER}
      - AWS_SECRET_ACCESS_KEY=${MINIO_PASSWORD}
      - AWS_S3_UPLOAD_BUCKET_URL=http://minio:9000
      - AWS_S3_UPLOAD_BUCKET_NAME=outline
    depends_on:
      - outline-db
      - outline-redis
      - minio

  outline-db:
    image: postgres:15-alpine
    container_name: outline-db
    restart: unless-stopped
    environment:
      - POSTGRES_USER=${DB_USER}
      - POSTGRES_PASSWORD=${DB_PASSWORD}
      - POSTGRES_DB=outline
    volumes:
      - outline_db_data:/var/lib/postgresql/data

  outline-redis:
    image: redis:7-alpine
    container_name: outline-redis
    restart: unless-stopped

  minio:
    image: minio/minio:latest
    container_name: collab-minio
    restart: unless-stopped
    ports:
      - "${MINIO_PORT:-9000}:9000"
      - "${MINIO_CONSOLE:-9001}:9001"
    environment:
      - MINIO_ROOT_USER=${MINIO_USER}
      - MINIO_ROOT_PASSWORD=${MINIO_PASSWORD}
    volumes:
      - minio_data:/data
    command: server /data --console-address ":9001"

volumes:
  mattermost_data:
  mattermost_logs:
  mattermost_config:
  mattermost_plugins:
  mattermost_db_data:
  outline_db_data:
  minio_data:
```

## .env

```bash
# Team Collaboration Stack
MM_PORT=8065
OUTLINE_PORT=3000
MINIO_PORT=9000
MINIO_CONSOLE=9001
TZ=UTC

# Database
DB_USER=collab
DB_PASSWORD=collab_password

# Outline secrets (generate with: openssl rand -hex 32)
OUTLINE_SECRET=your-secret-key
OUTLINE_UTILS_SECRET=your-utils-secret

# MinIO
MINIO_USER=minioadmin
MINIO_PASSWORD=minioadmin
```

## Usage notes

- Mattermost at http://localhost:8065 (create team)
- Outline wiki at http://localhost:3000
- MinIO Console at http://localhost:9001
- Configure SSO between Mattermost and Outline
- Create 'outline' bucket in MinIO for attachments
- Mattermost supports Slack-like integrations

## Troubleshooting

- Mattermost shows database connection error: Ensure mattermost-db container is fully started before Mattermost, check DB_USER and DB_PASSWORD variables match
- Outline fails to load with 'Redis connection failed': Verify outline-redis container is running and accessible, restart outline service if Redis was restarted
- File uploads fail in Outline: Check MinIO container is running, verify MINIO_USER and MINIO_PASSWORD match AWS credentials in Outline configuration
- MinIO console shows 'outline' bucket missing: Manually create the 'outline' bucket through MinIO console at localhost:9001 before uploading files
- Mattermost performance degrades over time: Monitor PostgreSQL container memory usage, consider increasing shared_buffers and work_mem settings
- Outline wiki shows 'Database migration failed': Stop Outline container, ensure outline-db is running and accessible, then restart Outline to retry migrations

