# Rocket.Chat Team Communication

> Team communication platform with Rocket.Chat, MongoDB replica set, and Hubot integration.

- Category: Productivity & Collaboration
- Difficulty: intermediate
- Components: rocketchat, mongodb, hubot, nginx
- Tags: rocketchat, chat, team, mongodb, collaboration
- Source: https://docker.recipes/productivity/rocketchat-stack

## Overview

Rocket.Chat is an open-source team communication platform that provides real-time messaging, file sharing, video conferencing, and collaboration features similar to Slack or Microsoft Teams. Originally launched in 2015, Rocket.Chat has become a popular self-hosted alternative for organizations seeking complete control over their communication infrastructure and data privacy. The platform supports unlimited users, channels, and messages while offering extensive customization options through apps, integrations, and API access.

This deployment combines Rocket.Chat with MongoDB's replica set configuration for high availability, Hubot for intelligent automation and bot interactions, and NGINX as a reverse proxy for SSL termination and load balancing. MongoDB replica sets ensure data redundancy and automatic failover, while Hubot extends the platform's functionality with automated responses, integrations, and workflow automation. NGINX handles incoming web traffic, provides SSL encryption, and can distribute load across multiple Rocket.Chat instances if needed.

This stack is ideal for development teams, remote organizations, and companies requiring on-premises chat solutions with enterprise-grade reliability. The combination provides everything needed for a production-ready team communication platform with bot automation capabilities, making it perfect for DevOps teams who want ChatOps integration, customer support teams needing bot assistance, and any organization prioritizing data sovereignty while maintaining modern collaboration features.

## Features

- Real-time messaging with channels, direct messages, and threaded conversations
- MongoDB replica set with automatic failover and data redundancy
- Hubot integration for automated responses, ChatOps workflows, and custom bot commands
- Built-in video conferencing with screen sharing and recording capabilities
- File sharing with drag-and-drop uploads and image preview
- Extensive app marketplace with integrations for Jira, GitHub, GitLab, and CI/CD tools
- NGINX reverse proxy with SSL termination and WebSocket support
- Multi-language support with real-time translation capabilities

## Use cases

- DevOps teams implementing ChatOps workflows with automated deployment notifications and server monitoring
- Remote-first companies needing self-hosted communication platform with video conferencing
- Healthcare organizations requiring HIPAA-compliant messaging with end-to-end encryption
- Educational institutions providing secure student and faculty communication channels
- Customer support teams using Hubot for automated ticket creation and FAQ responses
- Open source projects coordinating development with integrated GitHub/GitLab notifications
- Government agencies requiring air-gapped communication systems with full data control

## Prerequisites

- Minimum 4GB RAM (2GB for Rocket.Chat, 2GB for MongoDB replica set)
- SSL certificates for NGINX or domain configured for Let's Encrypt
- MongoDB root password and Hubot user credentials defined in environment variables
- Understanding of Rocket.Chat administration for initial setup and user management
- Basic knowledge of Hubot scripting for custom bot command development
- Ports 80, 443, and 3000 available for web traffic and Rocket.Chat access

## docker-compose.yml

```yaml
services:
  rocketchat:
    image: registry.rocket.chat/rocketchat/rocket.chat:latest
    environment:
      ROOT_URL: ${ROOT_URL}
      PORT: 3000
      MONGO_URL: mongodb://mongodb:27017/rocketchat?replicaSet=rs0
      MONGO_OPLOG_URL: mongodb://mongodb:27017/local?replicaSet=rs0
      DEPLOY_METHOD: docker
      DEPLOY_PLATFORM: docker-compose
    ports:
      - "3000:3000"
    volumes:
      - rocketchat_uploads:/app/uploads
    depends_on:
      - mongodb
    networks:
      - rocketchat-net
    restart: unless-stopped

  mongodb:
    image: bitnami/mongodb:5.0
    environment:
      MONGODB_REPLICA_SET_MODE: primary
      MONGODB_REPLICA_SET_NAME: rs0
      MONGODB_PORT_NUMBER: 27017
      MONGODB_INITIAL_PRIMARY_HOST: mongodb
      MONGODB_INITIAL_PRIMARY_PORT_NUMBER: 27017
      MONGODB_ADVERTISED_HOSTNAME: mongodb
      MONGODB_ROOT_PASSWORD: ${MONGODB_ROOT_PASSWORD}
      ALLOW_EMPTY_PASSWORD: "no"
    volumes:
      - mongodb_data:/bitnami/mongodb
    networks:
      - rocketchat-net
    restart: unless-stopped

  hubot:
    image: rocketchat/hubot-rocketchat:latest
    environment:
      ROCKETCHAT_URL: rocketchat:3000
      ROCKETCHAT_ROOM: GENERAL
      LISTEN_ON_ALL_PUBLIC: "true"
      ROCKETCHAT_USER: ${HUBOT_USER}
      ROCKETCHAT_PASSWORD: ${HUBOT_PASSWORD}
      BOT_NAME: rocketbot
      EXTERNAL_SCRIPTS: hubot-help,hubot-diagnostics
    depends_on:
      - rocketchat
    networks:
      - rocketchat-net
    restart: unless-stopped

  nginx:
    image: nginx:alpine
    ports:
      - "80:80"
      - "443:443"
    volumes:
      - ./nginx.conf:/etc/nginx/nginx.conf:ro
      - ./certs:/etc/nginx/certs:ro
    depends_on:
      - rocketchat
    networks:
      - rocketchat-net
    restart: unless-stopped

volumes:
  rocketchat_uploads:
  mongodb_data:

networks:
  rocketchat-net:
    driver: bridge
```

## .env

```bash
# Rocket.Chat
ROOT_URL=https://chat.example.com

# MongoDB
MONGODB_ROOT_PASSWORD=secure_mongo_password

# Hubot (create user in Rocket.Chat first)
HUBOT_USER=rocketbot
HUBOT_PASSWORD=secure_bot_password
```

## Usage notes

- Rocket.Chat at https://chat.example.com
- Create admin during first setup
- Create bot user for Hubot
- Supports video conferencing, file sharing

## Troubleshooting

- MongoDB replica set initialization failed: Ensure MONGODB_REPLICA_SET_NAME matches MONGO_URL replicaSet parameter
- Rocket.Chat shows 'Cannot connect to database': Wait for MongoDB to fully initialize replica set before starting Rocket.Chat
- Hubot not responding to commands: Verify HUBOT_USER exists in Rocket.Chat and has appropriate channel permissions
- File uploads not persisting: Check that rocketchat_uploads volume is properly mounted and has write permissions
- NGINX 502 Bad Gateway: Confirm Rocket.Chat container is running and accessible on port 3000 within Docker network
- Video calls not working: Ensure WebRTC ports are open and STUN/TURN servers are configured in Rocket.Chat admin panel

