Question

hubot rocket.chat adapter cannot be restarted without re-configuration

Posted October 19, 2016 1.2k views
Ubuntu

Every time when i started hubot, i have to do the following first before bin/hubot -a rocketchat? Why is that?

export ROCKETCHAT_USER=bot
export ROCKETCHAT_PASSWORD=bot
export ROCKETCHAT_AUTH=password

Also I did install redis and hubot-redis-brain, and from the following info i got when i log in hubot, the adapter did connect to redis:

[Wed Oct 19 2016 02:44:24 GMT+0000 (UTC)] INFO hubot-redis-brain: Using default redis on localhost:6379
[Wed Oct 19 2016 02:44:24 GMT+0000 (UTC)] INFO hubot-redis-brain: Data for hubot brain retrieved from Redis

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

×
1 answer

The lines before are environment variables. We use this to pass important information to the adapter so it knows how to connect to Rocket.Chat. Adding redis or redis brain doesn’t give the bot the ability to remember this.

So a common solution here would be to make use of a bash file. So create a file like start_hubot with contents like this:

#!/bin/bash

export ROCKETCHAT_USER=bot
export ROCKETCHAT_PASSWORD=bot
export ROCKETCHAT_AUTH=password
export HUBOT_YOUTUBE_API_KEY=<your token>

bin/hubot -a rocketchat

Then to make it executable run: chmod +x start_hubot

So then when you want to run hubot you can just do: ./start_hubot

Submit an Answer