Rocket.Chat + MongoDB + Hubot
Open source team chat with chatbot integration.
Overview
Rocket.Chat is an open-source team communication platform that provides Slack-like messaging, video conferencing, file sharing, and extensive collaboration features. Originally developed in 2015 as a customizable alternative to proprietary team chat solutions, Rocket.Chat offers organizations complete control over their communication data and infrastructure while supporting thousands of concurrent users with real-time messaging, channels, direct messages, and integrations with over 300 third-party services.
This deployment combines Rocket.Chat with MongoDB's document database for flexible message and user data storage, while Hubot provides intelligent chatbot automation for common tasks like deployments, monitoring alerts, and team workflows. MongoDB's replica set configuration ensures high availability for chat history and user data, while NGINX handles SSL termination, static file serving, and load balancing to optimize performance under heavy concurrent user loads.
This stack is ideal for organizations requiring self-hosted team communication with advanced bot automation, companies needing GDPR compliance or data sovereignty, development teams wanting ChatOps integration for CI/CD workflows, and enterprises seeking cost-effective alternatives to Slack or Microsoft Teams with complete customization control.
Key Features
- Real-time messaging with MongoDB change streams for instant message delivery and presence updates
- Hubot ChatOps integration with customizable scripts for automated deployments, monitoring, and team workflows
- MongoDB replica set configuration providing automatic failover and data redundancy for chat history
- NGINX reverse proxy with WebSocket support for optimized real-time communication performance
- Rocket.Chat's extensive plugin ecosystem with over 300 integrations including GitHub, Jira, and CI/CD tools
- Multi-channel architecture supporting unlimited public channels, private groups, and direct messaging
- Built-in video conferencing with Jitsi Meet integration and screen sharing capabilities
- Advanced user management with LDAP/Active Directory integration and custom authentication providers
Common Use Cases
- 1DevOps teams implementing ChatOps workflows with Hubot automation for deployment notifications and server monitoring alerts
- 2Remote-first companies requiring self-hosted team communication with complete data ownership and GDPR compliance
- 3Software development teams needing integrated chat with GitHub webhooks, CI/CD notifications, and code review discussions
- 4Healthcare or financial organizations requiring HIPAA or SOX compliant team communication with on-premises data storage
- 5Educational institutions providing students and faculty with collaborative workspaces and course-specific communication channels
- 6Customer support teams using Rocket.Chat's omnichannel features with automated bot responses for common inquiries
- 7International organizations needing multilingual team communication with custom translation bots and region-specific channels
Prerequisites
- Docker Engine 20.10+ and Docker Compose v2 for container orchestration and networking support
- Minimum 4GB RAM (8GB recommended) to handle MongoDB replica set, Rocket.Chat application, and concurrent user sessions
- Available ports 80, 3000, and 27017 for NGINX, Rocket.Chat, and MongoDB inter-service communication
- SSL certificate and domain name for production deployment with proper WebSocket and real-time messaging support
- Basic understanding of MongoDB replica sets and Rocket.Chat administration for user management and bot configuration
- Environment variables configured for admin credentials, bot authentication, and database connection strings
For development & testing. Review security settings, change default credentials, and test thoroughly before production use. See Terms
docker-compose.yml
docker-compose.yml
1services: 2 rocketchat: 3 image: rocket.chat:latest4 environment: 5 - ROOT_URL=http://localhost6 - MONGO_URL=mongodb://mongodb:27017/rocketchat7 - MONGO_OPLOG_URL=mongodb://mongodb:27017/local8 - PORT=30009 - ADMIN_USERNAME=${ADMIN_USERNAME}10 - ADMIN_PASS=${ADMIN_PASS}11 - ADMIN_EMAIL=${ADMIN_EMAIL}12 volumes: 13 - rocketchat-uploads:/app/uploads14 ports: 15 - "3000:3000"16 depends_on: 17 - mongodb18 networks: 19 - rocketchat-network20 restart: unless-stopped2122 mongodb: 23 image: mongo:6.024 command: mongod --oplogSize 128 --replSet rs025 volumes: 26 - mongodb-data:/data/db27 networks: 28 - rocketchat-network29 restart: unless-stopped3031 mongo-init-replica: 32 image: mongo:6.033 command: >34 bash -c "sleep 10 && mongosh mongodb/rocketchat --eval 'rs.initiate()'"35 depends_on: 36 - mongodb37 networks: 38 - rocketchat-network3940 hubot: 41 image: rocketchat/hubot-rocketchat:latest42 environment: 43 - ROCKETCHAT_URL=rocketchat:300044 - ROCKETCHAT_ROOM=45 - ROCKETCHAT_USER=${BOT_USER}46 - ROCKETCHAT_PASSWORD=${BOT_PASSWORD}47 - BOT_NAME=bot48 - EXTERNAL_SCRIPTS=hubot-help,hubot-diagnostics49 depends_on: 50 - rocketchat51 networks: 52 - rocketchat-network53 restart: unless-stopped5455 nginx: 56 image: nginx:alpine57 volumes: 58 - ./nginx.conf:/etc/nginx/nginx.conf:ro59 ports: 60 - "80:80"61 depends_on: 62 - rocketchat63 networks: 64 - rocketchat-network65 restart: unless-stopped6667volumes: 68 rocketchat-uploads: 69 mongodb-data: 7071networks: 72 rocketchat-network: 73 driver: bridge.env Template
.env
1# Rocket.Chat2ADMIN_USERNAME=admin3ADMIN_PASS=secure_admin_password4ADMIN_EMAIL=admin@example.com56# Hubot7BOT_USER=hubot8BOT_PASSWORD=hubot_passwordUsage Notes
- 1Rocket.Chat at http://localhost:3000
- 2Setup wizard on first run
- 3Create bot user for Hubot
- 4MongoDB replica set required
- 5Mobile and desktop apps available
Individual Services(5 services)
Copy individual services to mix and match with your existing compose files.
rocketchat
rocketchat:
image: rocket.chat:latest
environment:
- ROOT_URL=http://localhost
- MONGO_URL=mongodb://mongodb:27017/rocketchat
- MONGO_OPLOG_URL=mongodb://mongodb:27017/local
- PORT=3000
- ADMIN_USERNAME=${ADMIN_USERNAME}
- ADMIN_PASS=${ADMIN_PASS}
- ADMIN_EMAIL=${ADMIN_EMAIL}
volumes:
- rocketchat-uploads:/app/uploads
ports:
- "3000:3000"
depends_on:
- mongodb
networks:
- rocketchat-network
restart: unless-stopped
mongodb
mongodb:
image: mongo:6.0
command: mongod --oplogSize 128 --replSet rs0
volumes:
- mongodb-data:/data/db
networks:
- rocketchat-network
restart: unless-stopped
mongo-init-replica
mongo-init-replica:
image: mongo:6.0
command: |
bash -c "sleep 10 && mongosh mongodb/rocketchat --eval 'rs.initiate()'"
depends_on:
- mongodb
networks:
- rocketchat-network
hubot
hubot:
image: rocketchat/hubot-rocketchat:latest
environment:
- ROCKETCHAT_URL=rocketchat:3000
- ROCKETCHAT_ROOM=
- ROCKETCHAT_USER=${BOT_USER}
- ROCKETCHAT_PASSWORD=${BOT_PASSWORD}
- BOT_NAME=bot
- EXTERNAL_SCRIPTS=hubot-help,hubot-diagnostics
depends_on:
- rocketchat
networks:
- rocketchat-network
restart: unless-stopped
nginx
nginx:
image: nginx:alpine
volumes:
- ./nginx.conf:/etc/nginx/nginx.conf:ro
ports:
- "80:80"
depends_on:
- rocketchat
networks:
- rocketchat-network
restart: unless-stopped
Quick Start
terminal
1# 1. Create the compose file2cat > docker-compose.yml << 'EOF'3services:4 rocketchat:5 image: rocket.chat:latest6 environment:7 - ROOT_URL=http://localhost8 - MONGO_URL=mongodb://mongodb:27017/rocketchat9 - MONGO_OPLOG_URL=mongodb://mongodb:27017/local10 - PORT=300011 - ADMIN_USERNAME=${ADMIN_USERNAME}12 - ADMIN_PASS=${ADMIN_PASS}13 - ADMIN_EMAIL=${ADMIN_EMAIL}14 volumes:15 - rocketchat-uploads:/app/uploads16 ports:17 - "3000:3000"18 depends_on:19 - mongodb20 networks:21 - rocketchat-network22 restart: unless-stopped2324 mongodb:25 image: mongo:6.026 command: mongod --oplogSize 128 --replSet rs027 volumes:28 - mongodb-data:/data/db29 networks:30 - rocketchat-network31 restart: unless-stopped3233 mongo-init-replica:34 image: mongo:6.035 command: >36 bash -c "sleep 10 && mongosh mongodb/rocketchat --eval 'rs.initiate()'"37 depends_on:38 - mongodb39 networks:40 - rocketchat-network4142 hubot:43 image: rocketchat/hubot-rocketchat:latest44 environment:45 - ROCKETCHAT_URL=rocketchat:300046 - ROCKETCHAT_ROOM=47 - ROCKETCHAT_USER=${BOT_USER}48 - ROCKETCHAT_PASSWORD=${BOT_PASSWORD}49 - BOT_NAME=bot50 - EXTERNAL_SCRIPTS=hubot-help,hubot-diagnostics51 depends_on:52 - rocketchat53 networks:54 - rocketchat-network55 restart: unless-stopped5657 nginx:58 image: nginx:alpine59 volumes:60 - ./nginx.conf:/etc/nginx/nginx.conf:ro61 ports:62 - "80:80"63 depends_on:64 - rocketchat65 networks:66 - rocketchat-network67 restart: unless-stopped6869volumes:70 rocketchat-uploads:71 mongodb-data:7273networks:74 rocketchat-network:75 driver: bridge76EOF7778# 2. Create the .env file79cat > .env << 'EOF'80# Rocket.Chat81ADMIN_USERNAME=admin82ADMIN_PASS=secure_admin_password83ADMIN_EMAIL=admin@example.com8485# Hubot86BOT_USER=hubot87BOT_PASSWORD=hubot_password88EOF8990# 3. Start the services91docker compose up -d9293# 4. View logs94docker compose logs -fOne-Liner
Run this command to download and set up the recipe in one step:
terminal
1curl -fsSL https://docker.recipes/api/recipes/rocketchat-complete/run | bashTroubleshooting
- Error 'Rocket.Chat can't connect to MongoDB': Ensure MongoDB replica set is initialized by checking mongo-init-replica container logs and waiting for rs.initiate() completion
- Hubot not responding to commands: Verify BOT_USER exists in Rocket.Chat with 'bot' role and BOT_PASSWORD matches the account credentials exactly
- MongoDB replica set failing to start: Check available disk space and ensure --oplogSize 128 parameter allows sufficient oplog storage for chat message replication
- NGINX 502 Bad Gateway errors: Confirm Rocket.Chat container is fully started on port 3000 and MongoDB connection is established before NGINX proxy attempts
- Real-time messaging delays or failures: Verify WebSocket connections aren't blocked by firewall and NGINX proxy_set_header Upgrade and Connection are properly configured
- Rocket.Chat admin setup wizard not appearing: Clear browser cache and ensure ROOT_URL environment variable matches the actual domain or IP being accessed
Community Notes
Loading...
Loading notes...
Download Recipe Kit
Get all files in a ready-to-deploy package
Includes docker-compose.yml, .env template, README, and license
Components
rocketchatmongodbhubotnginx
Tags
#rocketchat#chat#mongodb#chatbot#team-communication
Category
Message Queues & BrokersAd Space
Shortcuts: C CopyF FavoriteD Download