Docker-Compse 를 이용하여 Rocket.Chat 사용하기
Rocket.Chat 오픈 소스 사용하기(feat. hubot 사용하기)
2022년 NHN Cloud 행사/프로모션 정보 공유 : https://doc.skill.or.kr/2022-NHN-Cloud-Event-Promotion
1. Rocket.Chat 이란 무엇인가?
Rocket.Chat 은 데이터 보호 수준이 높은 조직을 위해 JavaScript로 개발된 완전 맞춤형 오픈 소스 커뮤니케이션 플랫폼입니다.
We are a MERN based application enabling real-time conversations between colleagues, with other companies or with your customers, regardless of how they connect with you. The result is an increase in productivity and customer satisfaction rates.
Every day, tens of millions of users in over 150 countries and in organizations such as Deutsche Bahn, The US Navy, and Credit Suisse trust Rocket.Chat to keep their communications completely private and secure.
2. Rocket.Chat 의 주요기능은?
강력하고 유연한 커뮤니티케이션 도구
간편한 파일 공유, 제공 드래그 앤 드롭 지원.
오디오 파일 공유
화상 채팅 지원
별도의 채널 (공개, 비공개 옵션 지원)
종단 간 암호화 지원
무제한 메시지 기록 (자체 관리 구성을 위한 서버 스토리지에 따라 다름.)
RSS 통합
타사 응용 프로그램과 호
푸시 알람 지원
LiveChat 지원
연중 무휴 24시간 지원
다중 플랫폼 지원(Windows, macOS, Android, iOS 및 Gnu/Linux)
게스트 엑세스
3. Rocket.Chat 라이센스는?
3-1 Paid help
Pay for support - Pricing
Email: [email protected]
3-2 Seek free help
Patiently wait for a volunteer to consider helping you.
If you opt for community's help instead of paid support, please notice that:
Most people in the chat are volunteers who will try and help for free
Volunteers do this in their spare time and are not getting paid for this. Please respect them.
Just because it is urgent for you does mean that it is urgent for them
Please answer their questions patiently and help them try and understand your problem
Being rude to them will not help you at all
Please note that posting the same question in several channels will not help you
Please do not DM anyone unless you know them, or they DM you first
Please do not randomly use @ people or @all hoping to get attention
Abuse of these things will not get any help but can get you muted, blocked, or banned.
Don't open a bug yet. When you ask in the channels or forums then devs or other community helpers will tell you if you really need to open an issue. Frequently if there really is a problem you won't be the first one to experience it, so always check github carefully for duplicates. Use lots of different search terms and make sure you check closed Issues as well (see below).
Do not ask the same question in multiple channels. Use the channel (from mentioned) that you think is most relevant to your issues. Support, React-Native, Ubuntu Snap,Raspberry Pi, Omnichannel, Desktop, Federation
4. rocket.chat 공식 사이트
Rocket.Chat 공식 사이트 :
https://rocket.chat/
Rocket.Chat developer 공식 사이트 :
https://developer.rocket.chat/
Rocket.Chat Document 공식사이트 :
https://docs.rocket.chat/
5. docker-compose.yml 다운로드 및 파일 내용
5.1 Rocket.Chat 사이트에서 docker-compose.yml 다운로드 경로
curl -L https://go.rocket.chat/i/docker-compose.yml -O
5.2 docker-compose.yml 파일 내용
version: '2'
services:
rocketchat:
image: registry.rocket.chat/rocketchat/rocket.chat:latest
command: >
bash -c
"for i in `seq 1 30`; do
node main.js &&
s=$$? && break || s=$$?;
echo \"Tried $$i times. Waiting 5 secs...\";
sleep 5;
done; (exit $$s)"
restart: unless-stopped
volumes:
- ./uploads:/app/uploads
environment:
- PORT=3000
- ROOT_URL=http://localhost:3000
- MONGO_URL=mongodb://mongo:27017/rocketchat
- MONGO_OPLOG_URL=mongodb://mongo:27017/local
- REG_TOKEN=${REG_TOKEN}
# - MAIL_URL=smtp://smtp.email
# - HTTP_PROXY=http://proxy.domain.com
# - HTTPS_PROXY=http://proxy.domain.com
depends_on:
- mongo
ports:
- 3000:3000
labels:
- "traefik.backend=rocketchat"
- "traefik.frontend.rule=Host: your.domain.tld"
mongo:
image: mongo:4.0
restart: unless-stopped
volumes:
- ./data/db:/data/db
#- ./data/dump:/dump
command: mongod --smallfiles --oplogSize 128 --replSet rs0 --storageEngine=mmapv1
labels:
- "traefik.enable=false"
# this container's job is just run the command to initialize the replica set.
# it will run the command and remove himself (it will not stay running)
mongo-init-replica:
image: mongo:4.0
command: >
bash -c
"for i in `seq 1 30`; do
mongo mongo/rocketchat --eval \"
rs.initiate({
_id: 'rs0',
members: [ { _id: 0, host: 'localhost:27017' } ]})\" &&
s=$$? && break || s=$$?;
echo \"Tried $$i times. Waiting 5 secs...\";
sleep 5;
done; (exit $$s)"
depends_on:
- mongo
# hubot, the popular chatbot (add the bot user first and change the password before starting this image)
hubot:
image: rocketchat/hubot-rocketchat:latest
restart: unless-stopped
environment:
- ROCKETCHAT_URL=rocketchat:3000
- ROCKETCHAT_ROOM=GENERAL
- ROCKETCHAT_USER=bot
- ROCKETCHAT_PASSWORD=botpassword
- BOT_NAME=bot
# you can add more scripts as you'd like here, they need to be installable by npm
- EXTERNAL_SCRIPTS=hubot-help,hubot-seen,hubot-links,hubot-diagnostics
depends_on:
- rocketchat
labels:
- "traefik.enable=false"
volumes:
- ./scripts:/home/hubot/scripts
# this is used to expose the hubot port for notifications on the host on port 3001, e.g. for hubot-jenkins-notifier
ports:
- 3001:8080
#traefik:
# image: traefik:latest
# restart: unless-stopped
# command: >
# traefik
# --docker
# --acme=true
# --acme.domains='your.domain.tld'
# --acme.email='[email protected]'
# --acme.entrypoint=https
# --acme.storagefile=acme.json
# --defaultentrypoints=http
# --defaultentrypoints=https
# --entryPoints='Name:http Address::80 Redirect.EntryPoint:https'
# --entryPoints='Name:https Address::443 TLS.Certificates:'
# ports:
# - 80:80
# - 443:443
# volumes:
# - /var/run/docker.sock:/var/run/docker.sock
6. Docker-Compose 실행 방법 및 상태 확인
6.1 docker-compose 실행 방법
# docker-compose.exe up -d
[+] Running 3/5
- Network rocket-chat_default Created 0.1s
- Container rocket-chat_mongo_1 Started 4.3s
- Container rocket-chat_mongo-init-replica_1 Started 5.5s
- Container rocket-chat_hubot_1 Starting 5.7s
- Container rocket-chat_rocketchat_1 Starting 5.7s
docker-compse up -d 로 실행하였을때 hubot instance 는 실행 되지 않는다!!!!!!
Web Site 에 접속 하여 Bot 계정을 활성화 해야 함. Docker-Compse 를 이용하여 Rocket.Chat 사용하기
6.2 Containers 동작 방식
MongDB
서비스를 시작함.
mongo-init-replica
가 실행되고MongDB
연결하고 초기화하며 자체적으로 종료 됨.
mongo-init-replica
가 정상 종료 된 후rocketchat
서비스가 동작 함.
hubot
은 instance 는 시작 되지 않으며 추가 작업이 필요 함.(추가 설정이 필요 함)
MongDB 에서 계정을 생성 하여야 함.
rocketchat 에 연결 하여 bot 계정 생성 하여야 함.
hubot instance 에 접속 하여 hubot Install and setting 을 진행 하여야 함.
hubot instance 를 재시작 함.
instance log 를 보며 상태를 확인 함.
6.3 docker ps 현황
# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
7898b753a665 rocketchat/hubot-rocketchat:latest "/bin/sh -c 'node -e…" 2 minutes ago Restarting (1) 2 seconds ago rocket-chat_hubot_1
e8e8d1aca084 registry.rocket.chat/rocketchat/rocket.chat:latest "docker-entrypoint.s…" 2 minutes ago Up 2 minutes 0.0.0.0:3000->3000/tcp rocket-chat_rocketchat_1
fbfc4a77b6b1 mongo:4.0 "docker-entrypoint.s…" 2 minutes ago Up 2 minutes 27017/tcp rocket-chat_mongo_1
6.4 Rocket.Chat 접속 화면

6.5 docker-compose 폴더 설명
rocket.chat
docker-compose.yml
docker-compose 실행 파일
rocket.chat/data
mongodb data folder 및 files
rocket.chat/scripts
robot scripts files
rocket.chat/uploads
uploads files
7. Rocket.Chat 세부 설정
7.1 처음 해야 할 사항.
7.1.1. mongodb 로그 상태를 확인
# docker logs -f 1e4e0fb4f37a
2022-01-10T04:57:16.556+0000 I CONTROL [main] Automatically disabling TLS 1.0, to force-enable TLS 1.0 specify --sslDisabledProtocols 'none'
2022-01-10T04:57:16.560+0000 I CONTROL [initandlisten] MongoDB starting : pid=1 port=27017 dbpath=/data/db 64-bit host=1e4e0fb4f37a
2022-01-10T04:57:16.560+0000 I CONTROL [initandlisten] db version v4.0.27
2022-01-10T04:57:16.560+0000 I CONTROL [initandlisten] git version: d47b151b55f286546e7c7c98888ae0577856ca20
2022-01-10T04:57:16.560+0000 I CONTROL [initandlisten] OpenSSL version: OpenSSL 1.0.2g 1 Mar 2016
2022-01-10T04:57:16.560+0000 I CONTROL [initandlisten] allocator: tcmalloc
2022-01-10T04:57:16.560+0000 I CONTROL [initandlisten] modules: none
2022-01-10T04:57:16.560+0000 I CONTROL [initandlisten] build environment:
2022-01-10T04:57:16.560+0000 I CONTROL [initandlisten] distmod: ubuntu1604
2022-01-10T04:57:16.560+0000 I CONTROL [initandlisten] distarch: x86_64
2022-01-10T04:57:16.560+0000 I CONTROL [initandlisten] target_arch: x86_64
2022-01-10T04:57:16.560+0000 I CONTROL [initandlisten] options: { net: { bindIpAll: true }, replication: { oplogSizeMB: 128, replSet: "rs0" }, storage: { engine: "mmapv1", mmapv1: { smallFiles: true } } }
2022-01-10T04:57:16.577+0000 I STORAGE [initandlisten]
2022-01-10T04:57:16.578+0000 I STORAGE [initandlisten] ** WARNING: You have explicitly specified 'MMAPV1' storage engine in your
2022-01-10T04:57:16.578+0000 I STORAGE [initandlisten] ** config file or as a command line option. Support for the MMAPV1
2022-01-10T04:57:16.578+0000 I STORAGE [initandlisten] ** storage engine has been deprecated and will be removed in
2022-01-10T04:57:16.578+0000 I STORAGE [initandlisten] ** version 4.2. See http://dochub.mongodb.org/core/deprecated-mmapv1
## 생략 ##
2022-01-10T04:58:25.040+0000 I INDEX [conn23] build index on: rocketchat.rocketchat_avatars.files properties: { v: 2, key: { filename: 1, uploadDate: 1 }, name: "filename_1_uploadDate_1", ns: "rocketchat.rocketchat_avatars.files", background: false }
2022-01-10T04:58:25.040+0000 I INDEX [conn23] building index using bulk method; build may temporarily use up to 500 megabytes of RAM
2022-01-10T04:58:25.040+0000 I INDEX [conn23] build index done. scanned 0 total records. 0 secs
2022-01-10T04:58:25.046+0000 I STORAGE [conn16] createCollection: rocketchat.rocketchat_avatars.chunks with generated UUID: 1744e3df-1e18-4b1d-bf0f-08a73f29ec22
2022-01-10T04:58:25.059+0000 I INDEX [conn16] build index on: rocketchat.rocketchat_avatars.chunks properties: { v: 2, unique: true, key: { files_id: 1, n: 1 }, name: "files_id_1_n_1", ns: "rocketchat.rocketchat_avatars.chunks", background: false }
2022-01-10T04:58:25.059+0000 I INDEX [conn16] building index using bulk method; build may temporarily use up to 500 megabytes of RAM
2022-01-10T04:58:25.059+0000 I INDEX [conn16] build index done. scanned 0 total records. 0 secs
7.1.2 Rocket.Chat 로그 확인
# docker logs -f 4345bb3a319b
LocalStore: store created at
LocalStore: store created at
LocalStore: store created at
{"level":51,"time":"2022-01-10T05:15:12.246Z","pid":10,"hostname":"66324712c034","name":"Migrations","msg":"Not migrating, already at version 249"}
ufs: temp directory created at "/tmp/ufs"
Loaded the Apps Framework and loaded a total of 0 Apps!
+----------------------------------------------+
| SERVER RUNNING |
+----------------------------------------------+
| |
| Rocket.Chat Version: 4.2.2 |
| NodeJS Version: 12.22.1 - x64 |
| MongoDB Version: 4.0.27 |
| MongoDB Engine: mmapv1 |
| Platform: linux |
| Process Port: 3000 |
| Site URL: http://localhost:3000 |
| ReplicaSet OpLog: Enabled |
| Commit Hash: ab3baf2f31 |
| Commit Branch: HEAD |
| |
+----------------------------------------------+
+----------------------------------------------------------------------+
| DEPRECATION |
+----------------------------------------------------------------------+
| |
| YOUR CURRENT MONGODB VERSION (4.0.27) IS DEPRECATED. |
| IT WILL NOT BE SUPPORTED ON ROCKET.CHAT VERSION 5.0.0 AND GREATER, |
| PLEASE UPGRADE MONGODB TO VERSION 4.2 OR GREATER |
| |
+----------------------------------------------------------------------+
7.1.3 Hubot 로그 확인
npm info it worked if it ends with ok
npm info using [email protected]
npm info using [email protected]
npm info package.json [email protected] No license field.
npm info addNameTag [ 'hubot-seen', 'latest' ]
npm info addNameTag [ 'hubot-links', 'latest' ]
npm info attempt registry request try #1 at 5:51:26 AM
npm http request GET https://registry.npmjs.org/hubot-help
npm info attempt registry request try #1 at 5:51:26 AM
npm http request GET https://registry.npmjs.org/hubot-diagnostics
## 생략 ##
[email protected] node_modules/hubot-seen
└── [email protected]
npm info ok
npm info it worked if it ends with ok
npm info using [email protected]
npm info using [email protected]
npm info preinstall [email protected]
npm info package.json [email protected] No license field.
npm info build /home/hubot
npm info linkStuff [email protected]
npm info build /home/hubot/node_modules/hubot-links
npm info preinstall [email protected]
npm info linkStuff [email protected]
npm info install [email protected]
npm info postinstall [email protected]
npm info build /home/hubot/node_modules/hubot-rocketchat
npm info preinstall [email protected]
npm info linkStuff [email protected]
npm info install [email protected]
npm info postinstall [email protected]
npm info build /home/hubot/node_modules/hubot-seen
npm info preinstall [email protected]
npm info linkStuff [email protected]
npm info install [email protected]
npm info postinstall [email protected]
npm info install [email protected]
npm info postinstall [email protected]
npm info prepublish [email protected]
npm info ok
[Mon Jan 10 2022 05:52:35 GMT+0000 (UTC)] INFO Starting Rocketchat adapter version 1.0.11...
[Mon Jan 10 2022 05:52:35 GMT+0000 (UTC)] INFO Once connected to rooms I will respond to the name: bot
[Mon Jan 10 2022 05:52:35 GMT+0000 (UTC)] INFO Connecting To: rocketchat:3000
[Mon Jan 10 2022 05:52:35 GMT+0000 (UTC)] INFO Successfully connected!
[Mon Jan 10 2022 05:52:35 GMT+0000 (UTC)] INFO GENERAL
[Mon Jan 10 2022 05:52:35 GMT+0000 (UTC)] INFO Logging In
[Mon Jan 10 2022 05:52:35 GMT+0000 (UTC)] ERROR Unable to Login: {"isClientSafe":true,"error":403,"reason":"User not found","message":"User not found [403]","errorType":"Meteor.Error"} Reason: User not found
[Mon Jan 10 2022 05:52:35 GMT+0000 (UTC)] ERROR If joining GENERAL please make sure its using all caps.
[Mon Jan 10 2022 05:52:35 GMT+0000 (UTC)] ERROR If using LDAP, turn off LDAP, and turn on general user registration with email verification off.
로그를 확인 해 보니 "ERROR Unable to Login: {"isClientSafe":true,"error":403,"reason":"User not found","message":"User not found [403]","errorType":"Meteor.Error"} Reason: User not found" 의 상태가 발생 됨.
Bot 계정을 만들지 않아서 생기는 ERROR. Docker-Compse 를 이용하여 Rocket.Chat 사용하기
7.2 Rocket.Chat Web Site 확인
7.2.1 Rocket.Chat 접속 및 설정 하기





8. Hubot 설정 및 확인
8.1 docker-compose.yml 설정 확인
### 생략 ###
hubot:
image: rocketchat/hubot-rocketchat:latest
restart: unless-stopped
environment:
- ROCKETCHAT_URL=rocketchat:3000 # Web 접속 Port
- ROCKETCHAT_ROOM=GENERAL # GENERAL 에서 활성화
- ROCKETCHAT_USER=bot # Bot 계정
- ROCKETCHAT_PASSWORD=botpassword # Bot 비밀번호
- BOT_NAME=bot # Bot Name 정보
8.2 Rocket.Chat 에 Bot 계정 추가
8.2.1 Rocket.Chat 계정 관리

8.2.2 Rocket.Chat Bot 계정 추가
docker-compose.yml 에 설정한 Bot 의 이름과 비밀번호, 닉네임을 사용자 계정에 추가 (참고: 6.1)


9. Hubot 사용해 보기
9.1 Hubot-diagnostics 기능
hubot ping - Reply with pong
hubot adapter - Reply with the adapter
hubot echo - Reply back with
hubot time - Reply with current time
9.2 external-scripts.json 파일
# ls
Procfile README.md bin external-scripts.json hubot-scripts.json node_modules package.json scripts
# cat external-scripts.json
["hubot-help","hubot-seen","hubot-links","hubot-diagnostics"]
9.3 답변 추가 하기
9.3.1 diagnostics.coffee 에 답변 추가
# Description
# hubot scripts for diagnosing hubot
#
# Commands:
# hubot ping - Reply with pong
# hubot adapter - Reply with the adapter
# hubot echo <text> - Reply back with <text>
# hubot time - Reply with current time
#
# Author:
# Josh Nichols <[email protected]>
module.exports = (robot) ->
robot.respond /안녕하세요/i, (msg) ->
msg.send "반가워요"
robot.respond /하이/i, (msg) ->
msg.send "반가워요"
robot.respond /여기는 뭐 하는 사이트니/i, (msg) ->
msg.send "여기는 채팅사이트에요"
robot.respond /" "/i, (msg) ->
msg.send "놀아주세요"
robot.respond /"?"/i, (msg) ->
msg.send "심심해요. 놀아줘요?"
robot.respond /저기요/i, (msg) ->
msg.send "네. 저 여기 있어요."
robot.respond /어딧어/i, (msg) ->
msg.send "여기 있어요."
robot.respond /ADAPTER$/i, (msg) ->
msg.send robot.adapterName
robot.respond /ECHO (.*)$/i, (msg) ->
msg.send msg.match[1]
robot.respond /TIME$/i, (msg) ->
msg.send "Server time is: #{new Date()}"
9.4 Hubot Container Restart
# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
dfe211e2ca3c rocketchat/hubot-rocketchat:latest "/bin/sh -c 'node -e…" About an hour ago Up 5 minutes 0.0.0.0:3001->8080/tcp rocket-chat_hubot_1
5492e6042bd2 registry.rocket.chat/rocketchat/rocket.chat:latest "docker-entrypoint.s…" About an hour ago Up About an hour 0.0.0.0:3000->3000/tcp rocket-chat_rocketchat_1
027d7c934cef mongo:4.0 "docker-entrypoint.s…" About an hour ago Up About an hour 27017/tcp rocket-chat_mongo_1
# docker restart dfe211e2ca3c
9.5 Hubot Container Logs
# docker logs -f dfe211e2ca3c
## 생략 ##
npm info prepublish [email protected]
npm info ok
[Tue Jan 11 2022 05:03:04 GMT+0000 (UTC)] INFO Starting Rocketchat adapter version 1.0.11...
[Tue Jan 11 2022 05:03:04 GMT+0000 (UTC)] INFO Once connected to rooms I will respond to the name: bot
[Tue Jan 11 2022 05:03:04 GMT+0000 (UTC)] INFO Connecting To: rocketchat:3000
[Tue Jan 11 2022 05:03:04 GMT+0000 (UTC)] INFO Successfully connected!
[Tue Jan 11 2022 05:03:04 GMT+0000 (UTC)] INFO GENERAL
[Tue Jan 11 2022 05:03:04 GMT+0000 (UTC)] INFO Logging In
[Tue Jan 11 2022 05:03:04 GMT+0000 (UTC)] INFO Successfully Logged In
[Tue Jan 11 2022 05:03:04 GMT+0000 (UTC)] INFO Looking up Room ID for: GENERAL
[Tue Jan 11 2022 05:03:04 GMT+0000 (UTC)] INFO Joining Room: GENERAL
[Tue Jan 11 2022 05:03:04 GMT+0000 (UTC)] INFO rid: [ 'GENERAL' ]
[Tue Jan 11 2022 05:03:04 GMT+0000 (UTC)] INFO All rooms joined.
[Tue Jan 11 2022 05:03:04 GMT+0000 (UTC)] INFO Successfully joined room: GENERAL
[Tue Jan 11 2022 05:03:04 GMT+0000 (UTC)] INFO Preparing Meteor Subscriptions..
[Tue Jan 11 2022 05:03:04 GMT+0000 (UTC)] INFO Subscribing to Room: __my_messages__
[Tue Jan 11 2022 05:03:04 GMT+0000 (UTC)] INFO Successfully subscribed to messages
[Tue Jan 11 2022 05:03:04 GMT+0000 (UTC)] INFO Setting up reactive message list...
[Tue Jan 11 2022 05:03:04 GMT+0000 (UTC)] WARNING Loading scripts from hubot-scripts.json is deprecated and will be removed in 3.0 (https://github.com/github/hubot-scripts/issues/1113) in favor of packages for each script.
Your hubot-scripts.json is empty, so you just need to remove it.
9.6 Rocket.Chat 사이트의 General 에서 Bot 과 대화 하기

00. 오류 해결하기
00.1 REG_TOKEN Warring 발생
00.1.1 level=warning msg="The \"REG_TOKEN\" variable is not set. Defaulting to a blank string." 발생
00.1.2 level=warning msg="Found orphan containers ([rocket-chat_bot_rasa_1]) for this project. If you removed or renamed this service in your compose file, you can run this command with the --remove-orphans flag to clean it up."
# docker-compose.exe up -d
time="2022-01-10T13:57:10+09:00" level=warning msg="The \"REG_TOKEN\" variable is not set. Defaulting to a blank string."
time="2022-01-10T13:57:11+09:00" level=warning msg="Found orphan containers ([rocket-chat_bot_rasa_1]) for this project. If you removed or renamed this service in your compose file, you can run this command with the --remove-orphans flag to clean it up."
00.1.1-2 해결 방안
docker-compose.yml 에서 아래의 설정을 주석 처리 하여 다시 실행.
# - REG_TOKEN=${REG_TOKEN}
00.2 hubot ERROR Unable to Login
00.2.1 ERROR Unable to Login: {"isClientSafe":true,"error":403,"reason":"User not found","message":"User not found [403]","errorType":"Meteor.Error"} Reason: User not found
00.2.1 해결 방안
Rocket.Chat 에서 Bot 계정을 추가 하지 않아 발생한 문제임.
Docker-Compse 를 이용하여 Rocket.Chat 사용하기 을 참고 하시기 바랍니다.
2022년 NHN Cloud 행사/프로모션 정보 공유 : https://doc.skill.or.kr/2022-NHN-Cloud-Event-Promotion
Last updated
Was this helpful?