Mikey T.K.
Mikey T.K.

Reputation: 1160

How do I run a console app on Heroku?

I'm trying to deploy a ruby (NOT rails) app to Heroku. My procfile is laid out like so:

console: bundle exec ruby main.rb

However, my app never actually launches. The logs on the system are all quiet, I see nothing resembling any error output.

If I run the command as shown in the procfile on my local system, my program launches and runs exactly as it should.

More interestingly, if I run heroku console, the app immediately fires up on the console itself. Looks like some interaction with the procfile? How do I launch my app automatically without being connected to the console on Heroku and have the stdout captured?

Upvotes: 4

Views: 4092

Answers (1)

willglynn
willglynn

Reputation: 11520

If you want the console entry to run, you need to scale it:

$ heroku ps:scale console=1

That said, Heroku uses console to mean "the thing that I use to perform certain interactive administrative functions on my application", which is why heroku console runs the console Procfile entry and provides you a bidirectional pipe. You seem to have a different meaning -- "the thing which I need to always run to perform certain background tasks". (web also has special meaning to Heroku -- the routing mesh will send HTTP requests to web processes.) I would therefore also rename this, so that console still means "console".

You could choose main, for parity with main.rb, but instead I would encourage you to think about what this component actually does and instead give both the Procfile entry and main.rb a descriptive label.

Upvotes: 5

Related Questions