Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hubot can't connect to Rocket Chat #100

Closed
Muffo opened this issue Feb 21, 2016 · 13 comments
Closed

Hubot can't connect to Rocket Chat #100

Muffo opened this issue Feb 21, 2016 · 13 comments

Comments

@Muffo
Copy link

Muffo commented Feb 21, 2016

I am testing Rocket Chat for the first time and I am following this guide to Deploy with Docker

I have started Rocket Chat successfully and I am now trying to enable the Hubot.
I have created a user called bot and I have modified the file docker-compose.yml with the updated login information.

Here is my file:

mongo:
  image: mongo
# volumes:
#    - ./data/runtime/db:/data/db
#    - ./data/dump:/dump
  command: mongod --smallfiles --oplogSize 128

rocketchat:
  image: rocketchat/rocket.chat:latest
# volumes:
#    - ./uploads:/app/uploads
  environment:
    - PORT=3000
    - ROOT_URL=http://localhost:3000
    - MONGO_URL=mongodb://mongo:27017/rocketchat
  links:
    - mongo:mongo
  ports:
    - 3000:3000

# hubot, the popular chatbot (add the bot user first and change the password before starting this image)
hubot:
  image: rocketchat/hubot-rocketchat
  environment:
    - ROCKETCHAT_URL=localhost:3000
    - LISTEN_ON_ALL_PUBLIC=true
    - ROCKETCHAT_ROOM=''
    - ROCKETCHAT_USER=bot
    - ROCKETCHAT_PASSWORD=hubot
    # - RESPOND_TO_DM=true
    #- ROCKETCHAT_AUTH=password
    - 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
  links:
    - rocketchat:rocketchat
# 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

I have started the container with Hubot but it does not seem to respond to the command within Rocket Chat.
I am not sure what is the expected output, but it seems that he can't connect to localhost:3000 which is the URL I use to open Rocket Chat.

> docker-compose up hubot   
Recreating rocketchat_mongo_1...
Recreating rocketchat_rocketchat_1...
Recreating rocketchat_hubot_1...
Attaching to rocketchat_hubot_1
hubot_1 | hubot-help@0.1.3 node_modules/hubot-help
hubot_1 | 
hubot_1 | hubot-diagnostics@0.0.1 node_modules/hubot-diagnostics
hubot_1 | 
hubot_1 | hubot-links@0.0.1 node_modules/hubot-links
hubot_1 | 
hubot_1 | hubot-seen@0.2.3 node_modules/hubot-seen
hubot_1 | ├── timeago@0.1.0
hubot_1 | └── coffee-script@1.6.3
hubot_1 | [Sat Feb 20 2016 16:37:18 GMT+0000 (UTC)] INFO Starting Rocketchat adapter...
hubot_1 | [Sat Feb 20 2016 16:37:18 GMT+0000 (UTC)] INFO Once connected to rooms I will respond to the name: bot
hubot_1 | [Sat Feb 20 2016 16:37:18 GMT+0000 (UTC)] INFO Connecting To: localhost:3000

Do you have any suggestion?

Thanks!
Andrea

@NioTeX
Copy link
Contributor

NioTeX commented Feb 21, 2016

try ROCKETCHAT_URL=rocketchat:3000
that should be the correct URL, since the rocketchat docker is linked to the hubot-rocketchat one

@Muffo
Copy link
Author

Muffo commented Feb 22, 2016

OK, this makes sense!
I'll give it a try as soon as I have a chance, but this is probably what is
causing my problem.

Thanks!!

On Sun, 21 Feb 2016, 23:51 Nick Nagy notifications@github.com wrote:

try ROCKETCHAT_URL=rocketchat:3000
that should be the correct URL, since the rocketchat docker is linked to
the hubot-rocketchat one


Reply to this email directly or view it on GitHub
#100 (comment)
.

@Muffo
Copy link
Author

Muffo commented Feb 25, 2016

Hi!
I did the changes but I am getting stuck at the same point...

hubot_1 | [Wed Feb 24 2016 19:49:42 GMT+0000 (UTC)] INFO Connecting To: rocketchat:3000

@or1gb1u3
Copy link

Just for grins. did you add the hubot user to rocketchat then change the password.

@Muffo
Copy link
Author

Muffo commented Mar 14, 2016

@or1gb1u3 , I have added a user called bot and from the browser I am able to login with the password that I specified in the configuration file:

    - ROCKETCHAT_USER=bot
    - ROCKETCHAT_PASSWORD=hubot

@davemorrow1968
Copy link

Have you had any success?
I am experiencing the exact same issue.

@davemorrow1968
Copy link

This issue appears to be related purely to the YML file as the following works (hubot launches and connects) using the same configuration as contained in the yml file.

docker run -it -e ROCKETCHAT_URL=rocketchat.mydomain.com:3000 -e ROCKETCHAT_ROOM='' -e LISTEN_ON_ALL_PUBLIC=true -e ROCKETCHAT_USER=hubot -e ROCKETCHAT_PASSWORD=Passw0rd -e BOT_NAME=Hubot -e EXTERNAL_SCRIPTS=hubot-pugme,hubot-help rocketchat/hubot-rocketchat

@Muffo
Copy link
Author

Muffo commented Mar 21, 2016

@davemorrow1968 , I haven't done any progress with the issue.
I might try to run from the command line as you suggested and see if it makes any difference...

@mpede
Copy link

mpede commented Apr 8, 2016

I had the same issue and assumed that when the bot is trying to connect our rocketchat server isn't ready yet. A quick manual restart of the hubot container confirmed that as the bot was then able to connect. So I still fire up all containers at boot using docker-compose up but then restarting the hubot container 2-3 minutes later via root's crontab, added @reboot sleep 150 && docker restart docker_hubot_1 - this works fine for me now.
However - if I manually restart the bot container again at a later stage it usually brings down the rocketchat and mongo containers, not sure why. For getting the bot to connect after (re)boot however this seems to work so far. Hope this helps. (note this is using containers on a cloud VM, debian jessie, other distros: your mileage may vary)

@davemorrow1968
Copy link

@mpede Christian - your solution of using a crontab @reboot works flawlessly ! Thanks!

@mpede
Copy link

mpede commented Apr 16, 2016

glad to hear @davemorrow1968
Just adding that after several restarts during the last two weeks and one migration to a new VM this still works as expected on every single boot.

@Lochemage
Copy link

I've noticed the same problem as @mpede did with the initial startup, but was able to get the bot connected after the bootup is finished.

However, I've fallen into this same problem as the OP with the latest version update (0.28.0). Now it gets stuck in the same spot, attempting to connect.

@Lochemage
Copy link

I managed to get the bot working again by deleting and re-creating a new bot account, then removing the old hubot container and re-up'ing it again... don't know why.

Also, I have noticed when trying to log into the old bot, the log output is spammed with a history of every message it has ever received (I guess it initializes by reading it's entire message history?). Sometimes I've noticed it got a 137 error which I understand means "out of memory". Do not know if this is related, but with the new bot account, there is no more spam and it connects just fine. I hope this doesn't mean I have to re-create a new bot account every month or so...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants