clojure worker-only app on heroku fails with Error R10

253 views Asked by At

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?

1

There are 1 answers

7
codefinger On BEST ANSWER

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.