(was "Can I issue a "heroku restart" from within my app that's running on 
Heroku")

Neil, you read my mind! Thanks for the answer. My only regret is that it's 
buried in a thread with advice for some poor soul who wants to use 
heroku:restart. Oh wait, I can rename the thread! :-)

How about "How can I call the Heroku API from inside my Heroku app?"

or "How can I have my web process "scale up" and "scale down" my worker 
process?"

I want to do this in response to a web request, so I don't have to pay for 
my worker process being awake 24/7.

Here's what I got:

# Gemfile

gem 'heroku'


# unix command line

heroku config:add HEROKU_APP_NAME="myapp" \
 HEROKU_EMAIL="[email protected]" \
 HEROKU_PASSWORD="secret"


# ruby

require 'heroku'
heroku = Heroku::Client.new(ENV["HEROKU_EMAIL"], ENV["HEROKU_PASSWORD"])
heroku.ps_scale(ENV["HEROKU_APP_NAME"], :type => "worker", :qty => 1)


If you don't want your app to be able to access all your other apps -- 
maybe you're on a team of untrustworthy rapscallions -- then sign up for a 
new heroku account with a new email address and password, and then add that 
heroku account as a collaborator.

I can point you to github source once I'm sure it all works in my latest 
app.

 - A

P.S. Thanks to https://github.com/pcapr/dyno-blitzer/issues/3 for 
deciphering the 422 error.

-- 
You received this message because you are subscribed to the Google Groups 
"Heroku" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/heroku/-/Ns6_CvJ4yHIJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/heroku?hl=en.

Reply via email to