"heroku ps" shows no processes running - heroku

Seems like a simple question, but I haven't found the answer anywhere. Running heroku ps shows nothing. heroku restart executes successfully.

Have you tried scaling one of your process types? e.g. heroku ps:scale web=1
See https://devcenter.heroku.com/articles/scaling

I was doing a silly mistake. I was using
heroku run ps (since there were other commands that I was using as "run")
instead of
heroku ps. (ps is a heroku command and not a system command).
Removing run fixed the issue. Thanks.

Related

My Heroku-cli not recognizing commands. (Mac OS X)

When I run $"heroku help" in my Mac OS X Terminal, I get the following error from the Heroku Cli.
$ heroku help
▸ help is not a heroku command.
▸ Perhaps you meant help
▸ Run heroku help for a list of available commands.
And it applies to every heroku command except "heroku login".
$ heroku restart
▸ restart is not a heroku command.
▸ Perhaps you meant restart
▸ Run heroku help for a list of available commands.
etc...
Is anyone else experiencing the same problem? Or how do I fix it? Thanks.
I'm having the same issue (OSX) and was able to fix it. Here's what I did.
https://devcenter.heroku.com/articles/heroku-cli#troubleshooting
That link has some trouble shooting help. It referenced a log file so I went there.
cat ~/Library/Caches/heroku/error.log
Nothing obviously wrong for me, just references to "...is not a command", but the stack traces called out the following path.
/Users/[username]/.local/share/heroku/
I deleted that folder and did another reinstall of heroku.
Everything started working for me.
One thing I noticed was that although I had ungraded heroku and it said it was installing a new version, running the following command still declared the previous version I had installed.
heroku --version
so it sounds like it's a caching issue.

How to run auto restart in heroku for ruby scripts

In my Dev box on Nitrous, I am able to run God -c scripts.god -D to restart the two .rb files if they die.
I just run that and the processes for the most part stay alive.
But I cannot do the same in heroku. It seems when I run the god command the .god file does not open and generates an error in heroku.
Question:
How can I run God to restart failed processes in heroku as I do on my development Nitrous environment?
Or is there a recommended alternative way to watch heroku processes and restart them automatically when they fail?
On Heroku you shouldn't need to use a process supervisor like god. If all you need is to ensure your process is restarted if it crashes, Heroku can manage that fine.
It should be as simple as adding two entries in your procfile as workers. https://devcenter.heroku.com/articles/background-jobs-queueing
worker: bundle exec sidekiq
clock: bundle exec clockwork lib/clock.rb
slack_listener: bundle exec ruby lib/slack_bot.rb
You could possibly have issues, if your processing are crashing quite often. Dyno Crash Restart Policy
Your processes should start automatically when you access your website.
However, Heroku does provide commands to manage your processes, check out https://devcenter.heroku.com/articles/dynos for the complete list. E.g., to restart all processes, use the toolbelt command:
heroku ps:restart --app yourappname

heroku cedar console

I've been trying to get a heroku console session going on cedar and am having no joy.
The old way was:
heroku console
I understand the new way involves 2 steps:
heroku run bash
then
$ rails console
but at the heroku run bash stage i keep geting:
heroku run bash
Running `bash` attached to terminal... up, run.1
!
! Timeout awaiting process
so i checked there isn't a port blocking issue and
telnet rendezvous.heroku.com 5000
gives
Trying 50.19.103.36...
Connected to ec2-50-19-103-36.compute-1.amazonaws.com.
Escape character is '^]'.
which is as expected i think
what am i doing wrong and what do i need to do to get this console up and running?
Thanks!
PS I have tried - heroku run console - also, and that times out too.
In cedar every command that needs to be attached to terminal uses run.
ex:
heroku run console
heroku run rake db:migrate
When its not necessary to be attached don't use the run:
ex: heroku logs
The new way is heroku run console
Ok - it was obvious after a few hours of sleep. Simply had to update the heroku gem that had got corrupted somehow on my mac. If you have something like this problem, then do that first...

Why can't I start a Heroku console on the Cedar stack?

Trying to debug a new Heroku deployment - seems to be missing a db table. To do this, I'm running heroku run console but I get back :-
Running console attached to terminal... up, run.7
sh: console: not found
under both my Linux and Windows environments
What have I missed to get this working?
[Very late update : this is for a Java Heroku app, not a RoR one, so anything related to rails is a little lost on me]
on Celadon Cedar Stack it is changed to:
$ heroku run bash
$ heroku run bash
then
…#…:/app$ script/rails console
It worked for me. Though the second step is specific to Ruby on Rails – I don’t know the equivalent commands for other platforms and frameworks.
To run rails console, it's just:
heroku run rails console

Killing abandoned process on Heroku

I killed an IRB prompt in a not-so-graceful manner (started with heroku run irb), and now I've got a zombie process which I can't seem to kill:
Process State Command
------------ ------------------ ------------------------------
run.3 up for 2h irb -r ./init.rb
web.1 up for 0s thin -p $PORT -e $RACK_ENV -R $HER..
I've tried:
heroku restart
heroku ps:scale run=0
heroku ps:restart run.3
Anyone know how I can force quit it?
I noticed a new ps:stop command added to the Heroku command line client a few days ago:
https://github.com/heroku/heroku/commit/a6d9eb7f314bf2c5f162a508e8d764286fb577bb
I'm not sure if that change made it into version 2.9.0 but it would be worth a try.
Update
This is now in the Heroku Toolbelt. Just run:
heroku ps:stop <process id from heroku ps>
Example:
heroku ps:stop run.8729
Thanks James!! I needed to update my Heroku client first, and it worked like a charm.
$ sudo gem install heroku
$ heroku ps #to view processes
$ heroku stop <process name here>
edit: they've fixed this issue
Heroku doesn't have a way to kill abandoned run.x processes.
But it will be killed automatically after 24 hours.
If anyone else is struggling with killing using something like:
heroku run ps:stop run.789
Killing by id worked for me:
heroku ps:kill 61ff0687-eaf4-4299-9c65-f0b22af7ec67
I got the id using the platform api list dynos - https://devcenter.heroku.com/articles/platform-api-reference#dyno-list
Worked for a detached one-off that was abandoned.

Resources