Skip to content

Instantly share code, notes, and snippets.

@honza
Forked from sjl/foo.markdown
Created May 17, 2012 17:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save honza/2720204 to your computer and use it in GitHub Desktop.
Save honza/2720204 to your computer and use it in GitHub Desktop.

Let's say I make a piece of Clojure code that does something other than serve a website.

Example: a loop that checks twitter every 10 minutes for mentions of some product and emails them to me. You'd start it with lein run and it would run until killed, (Thread/sleep 1000)ing when it doesn't need to work.

Can I host this kind of thing, standalone, on Heroku? With the free plan?

So far it seems like the answer is yes. I just name it something other than 'web' in the procfile (so Heroku doesn't expect it to bind to a port) and then scale it to one process. So the procfile looks like:

scraper: lein run

And I'd run heroku scale web=0 scraper=1 to turn it on.

It would also get killed every so often because I'm on the free plan and I'd have to manually restart it each time, since there's no incoming web requests to keep it alive.

Does all that sound correct?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment