0

I'm following the instructions from Carin Meier's How I Start post and having an issue with running a clojure app that does not have a web component.

My Procfile has the suggested:

worker: lein trampoline run

but when I deploy, it says:

remote: -----> Discovering process types

remote: Procfile declares types -> worker

remote: Default types for Clojure (Leiningen 2) -> web

I'm not sure where that last line is coming from. Since my app does not connect to the web at all, it is killed:

Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch

Stopping process with SIGKILL

If it wasn't clear, I'm a n00b to Heroku...what am I missing? How do I remove the Default types for Clojure (Leiningen 2) -> web setting and the expectation that I'll bind to $PORT?

Nizam
  • 4,569
  • 3
  • 43
  • 60
Roger Allen
  • 2,262
  • 17
  • 29

1 Answers1

3

The Heroku Clojure buildpack assumes that you are deploying a web application, and automatically tries to create a "web" process type for you. This is a bad assumption and I will fix it (I'm the Clojure buildpack maintainer).

Despite the error you are seeing, your "worker" process should still be ok. That error just means the "web" process, which you don't have, isn't running.

You can run your worker in a synchronous one-off process like this:

$ heroku run worker

Or you can run it in the background (detached) like this:

$ heroku run:detached worker 

Or if you want it to run perpetually, you can run this:

$ heroku ps:scale worker=1

Regardless, you can check in on it by viewing the logs like this:

$ heroku logs --tail

Hope that helps.

codefinger
  • 10,088
  • 7
  • 39
  • 51
  • If you want to squelch the error before I fix it, you could add this line to your `Procfile`: `web: ruby -rwebrick -e'WEBrick::HTTPServer.new(:Port => $PORT, :DocumentRoot => Dir.pwd).start'` – codefinger Jun 08 '15 at 20:30
  • Thanks, I will try this later tonight! I must have other errors keeping my worker thread from running... – Roger Allen Jun 08 '15 at 21:15
  • heroku run worker kicks off my code, but I have other errors in the code, so I can't say if this totally handles my problem yet. Will circle back when my code works. – Roger Allen Jun 09 '15 at 05:27
  • Is there a bug-tracking report where I can follow progress on fixing this? – Roger Allen Jun 09 '15 at 05:27
  • If I add the "web:" command to the Procfile, that is the only thing that runs. Probably because I'm on the free plan? If I don't add it, the worker: command runs for about 1 minute--and the web worker starts up, tells me nothing has bound to the PORT and exits with status 137. Doesn't seem to me like the worker continues after that. – Roger Allen Jun 09 '15 at 06:32
  • The change has been made in this [commit](https://github.com/heroku/heroku-buildpack-clojure/commit/473e9908be28a1d107e4a9875aa315e40b22ab95). you can use it now by running `heroku buildpacks:set https://github.com/heroku/heroku-buildpack-clojure.git`. I'm not sure why you're only seeing the worker run for 1 minute. I don't think that's because of the free plan. – codefinger Jun 09 '15 at 22:44
  • Thank you. I am running longer than 1 minute issue by selecting 0 web + 1 worker from the resources GUI. Now, I'm hitting a twitter API issue... http://stackoverflow.com/questions/30736672/twitter-response-error-32-could-not-authenticate-you-from-heroku-but-not-de – Roger Allen Jun 10 '15 at 00:38