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

Get up and running on Heroku #2

Merged
merged 3 commits into from
Jul 1, 2013
Merged

Get up and running on Heroku #2

merged 3 commits into from
Jul 1, 2013

Conversation

michaelmior
Copy link
Contributor

This is a first pass at easily getting the app running on Heroku. With this merged into master, you should be able to

heroku create
git push heroku master
heroku run rake db:migrate
heroku open

You can see a demo at http://hubot-control.herokuapp.com/. Some node stuff still needs to be installed to actually get Hubot working, but I figured I would share what I've got so far. Note that this also includes a fix for #1 (I just ran rails g bootstrap:install)

@spajus
Copy link
Owner

spajus commented Jul 1, 2013

Looks nice, it will be awesome to see it fully operational on Heroku. Currently you can't do much, it crashes here: http://hubot-control.herokuapp.com/hubots/new

I'll take a look at this PR a little later.

@michaelmior
Copy link
Contributor Author

Yeah, I was still in the middle of working on this. Fixed the crash at least. Currently requires a custom buildpack that can run Rails and install node.js dependencies (I'm using https://github.com/rtgibbons/heroku-buildpack-ruby-nodejs). One issue is that Heroku doesn't let you publicly expose random ports, but perhaps this can be solved via simple proxy on the Rails side.

@michaelmior
Copy link
Contributor Author

Well, that and the fact that I still haven't successfully started a hubot instance. But I think it's almost there.

@crawfordcomeaux
Copy link
Contributor

@michaelmior Still having trouble getting a hubot running? If so, are you looking to run it locally or on Heroku and what adapter are you trying to run with?

@michaelmior
Copy link
Contributor Author

Trying to get it running on Heroku with the shell adapter. It seems to start fine and then die. I can give you access to the app if you'd like if you let me know what email address you use for Heroku. (Same goes for you @spajus)

@michaelmior
Copy link
Contributor Author

The issue may be Heroku killing the additional processes that get spawned. (Also just a note that updated commit is courtesy of @crawfordcomeaux :) )

@crawfordcomeaux
Copy link
Contributor

crawford.comeaux@gmail.com ...I'll see what I can do, but I'm new to hubot, so I'll need to figure out the shell adapter locally first. Also, from playing with the irc adapter, I can say you need to be wary of where you're getting the adapters from. Went through several different sources before realizing they all suffered from the same bug that was making my bot flood. 2 hours to learn I should change a single env var in an undocumented way.

@crawfordcomeaux
Copy link
Contributor

Everything I've read so far on the shell adapter says that it's not for production & really just meant for local testing. Is there a use case for trying to get it working on Heroku?

@michaelmior
Copy link
Contributor Author

It's the simplest adapter and a good test case. No one would actually use it in production, but it makes sense to start with the simplest adapter possible.

@crawfordcomeaux
Copy link
Contributor

The irc adapter's pretty easy to get up. I'd give it a shot & see if you have the same issues. I think you're probably right about Heroku killing the spawned processes.

@michaelmior
Copy link
Contributor Author

I've tried the IRC adapter as well. Again, just more opportunities for failure there, so I'd rather get the shell adapter working first. It's quite possible that getting this running in a straightforward way is not at all possible on Heroku, but I thought it was worth a shot.

@spajus
Copy link
Owner

spajus commented Jul 1, 2013

@michaelmior, you could try running a campfire adapter, it's built in and should require no extra dependencies. Shell adapter works a bit differently, and there is a special mode for that: http://hubot-control.herokuapp.com/hubots/1/interact

The goal is to be able to start a hubot and keep it up, if Heroku allows running extra processes in the background. hubot-control forks a new top-level process for starting Hubot, so that you can reboot or shutdown hubot-control app, and your Hubot will still be running. Not sure if that's easily achievable on Heroku.

@spajus
Copy link
Owner

spajus commented Jul 1, 2013

Looks like I got hubot-irc bot running: http://hubot-control.herokuapp.com/hubots/6

Had to add to package.json dependencies: "hubot-irc": ">= 0.1", remove everything from hubot-scripts.json and set variables.json to

{
  "HUBOT_IRC_NICK": "hubot_control",
  "HUBOT_IRC_ROOMS": "#hubot-irc",
  "HUBOT_IRC_SERVER": "irc.freenode.net"
}

return 8000, 9000
end
ports = Hubot.select("max(port) as port, max(test_port) as test_port").take!
return ports.port || 8000, ports.test_port || 9000
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This issue (#3) is solved in master. You should merge.

@crawfordcomeaux
Copy link
Contributor

I think I discovered the problem: ntwitter's used by hubot, but isn't set as a dependency in package.json.

@crawfordcomeaux
Copy link
Contributor

Adding ntwitter to hubot-control's package.json looks like it may have done the trick. I pushed the change to heroku & now crawbot at least spits something out into the log before dying.

Oddly enough, it seems like you guys are running the latest hubot (2.5.5), but that's supposed to be resolved in that version.

@@ -1,11 +1,10 @@
source 'https://rubygems.org'

ruby '2.0.0'
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it necessary to use ruby 2.0.0 for Heroku? It would be nicer to keep lower requirements for those who can't upgrade their rubies yet.

@spajus spajus merged commit 882c3df into spajus:master Jul 1, 2013
@spajus
Copy link
Owner

spajus commented Jul 1, 2013

Merged into master

@michaelmior
Copy link
Contributor Author

Note that this could probably use an extra section in the README as there are a couple extra steps beyond a typical Heroku install.

@spajus
Copy link
Owner

spajus commented Jul 1, 2013

Yes, I just linked README to this pull request for now.

@michaelmior
Copy link
Contributor Author

Okay, then I'll just point out that until the linked issue in the buildpath is resolved, you'll also need to run the following after creating the app.

heroku config:add PATH=/app/node_modules/.bin:/app/bin:/app/vendor/bundle/ruby/2.0.0/bin:/usr/local/bin:/usr/bin:/bin

@michaelmior michaelmior deleted the heroku branch July 1, 2013 19:19
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

Successfully merging this pull request may close these issues.

3 participants