If you've been following along with Getting Started, it's time to deploy so you can use it beyond just your local machine. Heroku is an easy and supported way to deploy hubot.
Install the Heroku Toolbelt to start, then follow their 'Getting Started' instructions, including logging in the first time:
% heroku login
Enter your Heroku credentials.
Email: [email protected]
Password:
Could not find an existing public key.
Would you like to generate one? [Yn]
Generating new SSH public key.
Uploading ssh public key /Users/you/.ssh/id_rsa.pub
Inside your new hubot directory, make sure you've created a git repository, and that your work is committed:
% git init
% git add .
% git commit -m "Initial commit"
Then create a Heroku application:
% heroku create
Creating rosemary-britches-123... done, stack is cedar
http://rosemary-britches-123.herokuapp.com/ | [email protected]:rosemary-britches-123.git
Git remote heroku added
Before you deploy the application, you'll need to configure some environment variables for hubot to use. The specific variables you'll need depends on which adapter and scripts you are using. For Campfire, with no other scripts, you'd need to set the following environment variables:
% heroku config:set HUBOT_CAMPFIRE_ACCOUNT=yourcampfireaccount
% heroku config:set HUBOT_CAMPFIRE_TOKEN=yourcampfiretoken
% heroku config:set HUBOT_CAMPFIRE_ROOMS=comma,separated,list,of,rooms,to,join
In addition, there is one special environment variable for Heroku. The default hubot Procfile marks the process as a 'web' process type, in order to support serving http requests (more on that in the scripting docs). The downside of this is that dynos will idle after an hour of inactivity. That means your hubot would leave after an hour of idle web traffic, and only rejoin when it does get traffic. This is extremely inconvenient since most interaction is done through chat, and hubot has to be online and in the room to respond to messages. To get around this, there's a special environment variable to make hubot regularly ping itself over http. If the app is deployed to http://rosemary-britches-123.herokuapp.com/, you'd configure:
% heroku config:set HEROKU_URL=http://rosemary-britches-123.herokuapp.com
At this point, you are ready to deploy and start chatting. With Heroku, that's a git push away:
% git push heroku master
You'll see some text flying, and eventually some success. You should be able to see your bot in your configured chat rooms at this point. If not, you can peek at the logs to try to debug:
% heroku logs
If you make any changes to your hubot, just commit and push them as before:
% git commit -am "Awesome scripts OMG"
% git push heroku master
Some scripts needs Redis to work, Heroku offers an addon called Redis Cloud, which has a free plan. To use it:
% heroku addons:add rediscloud