Re: heroku-api

2013-02-04 Thread Keith Rarick
FWIW, I think exit code definitely belongs in the Heroku API.
That's a longstanding known deficiency. I hope we can fix it
soon, but can't make any promises.

On Sat, Feb 2, 2013 at 9:35 PM, Daniel Doubrovkine dbl...@dblock.org wrote:
 I published heroku-commander (https://github.com/dblock/heroku-commander)
 that wraps `heroku config -s` among other things. I still think this gem
 shouldn't exist and the functionality rolled into the heroku-client -
 @geemus, you might want to give this some thought. For the exit code part it
 would require cooperation from the server-side, but for the client-side
 credentials, not so much.

 cheers
 dB.


 On Thu, Dec 27, 2012 at 2:23 PM, Daniel Doubrovkine dbl...@dblock.org
 wrote:

 Indeed, maybe this does belong in a gem. Either way one wants to be able
 to do programmatically everything that the `heroku` command does without
 having to call it.


 On Thu, Dec 27, 2012 at 1:53 PM, geemus wes...@heroku.com wrote:

 I think Daniels approach is the easiest currently (thanks dB!). Perhaps
 we should create a gem for doing looking up the implied app as I'm reticent
 to say it belong in heroku-api.

 As for config you should be able to use the netrc gem and read the
 credentials for 'api.heroku.com' in order to get them.

 Hope that helps.


 On Tuesday, December 25, 2012 8:12:01 AM UTC-6, dB. wrote:

 We've asked a similar question a while ago, and the best we could come
 up with is a hack to run `heroku config -s`.

 config = {}
 config_output = `heroku config -s#{app_param}`.chomp


 if ($?.to_i != 0)


   raise error running heroku config: #{$?}


   $stderr.puts config_output


 end
 config_output.each_line do |line|


   parts = line.split(=, 2)


   raise invalid line #{line} if (parts.size != 2)


   config[parts[0].strip] = parts[1].strip


 end
 config


 On Mon, Dec 24, 2012 at 9:42 PM, Francois fha...@gmail.com wrote:

 hi,
  i wrote a gem a year or so ago that adds some rake tasks to a
 RefineryCMS rails project 
 (https://github.com/rounders/refinerycms-s3assets)
 . The rake tasks are meant to be run in development and they are for 
 copying
 production s3 assets to development.

 Using the heroku gem, my gem reads the s3-related heroku config vars in
 order to determine which s3 bucket to fetch the assets from and which s3
 credentials to use. Specifically the config vars are obtained as follows:

  base = Heroku::Command::BaseWithApp.new
  config_vars = base.heroku.config_vars(base.app)

 It is my understanding that the heroku gem should no longer be used and
 that we should instead use the heroku-api gem. But as far as I can tell 
 the
 heroku-api gem does not automatically handle figuring out the current 
 heroku
 app as the heroku gem does. And there is also the issue of authentication,
 though that one isn't as much of an issue since I can ask users to set 
 their
 HEROKU_API_KEY environment variable.

 Is there a recommended way to obtain the config vars of an app via a
 rake task without asking the user to hard code or specify the name of 
 their
 heroku app without using the heroku gem?

 - Thanks,
 Francois









 --
 You received this message because you are subscribed to the Google
 Groups Heroku group.

 To unsubscribe from this group, send email to
 heroku+un...@googlegroups.com

 For more options, visit this group at
 http://groups.google.com/group/heroku?hl=en_US?hl=en




 --

 dB. | Moscow - Geneva - Seattle - New York
 dblock.org - @dblockdotorg

 --
 You received this message because you are subscribed to the Google
 Groups Heroku group.

 To unsubscribe from this group, send email to
 heroku+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/heroku?hl=en_US?hl=en




 --

 dB. | Moscow - Geneva - Seattle - New York
 dblock.org - @dblockdotorg




 --

 dB. | Moscow - Geneva - Seattle - New York
 dblock.org - @dblockdotorg

 --
 --
 You received this message because you are subscribed to the Google
 Groups Heroku group.

 To unsubscribe from this group, send email to
 heroku+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/heroku?hl=en_US?hl=en

 ---
 You received this message because you are subscribed to the Google Groups
 Heroku Community group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to heroku+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.



-- 
-- 
You received this message because you are subscribed to the Google
Groups Heroku group.

To unsubscribe from this group, send email to
heroku+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/heroku?hl=en_US?hl=en

--- 
You received this message because you are subscribed to the Google Groups 
Heroku Community group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to heroku+unsubscr...@googlegroups.com.
For more

Re: heroku-api

2013-02-04 Thread Daniel Doubrovkine
Thanks Keith. In the related realm, the exit code of a run:detached is
something one should be able to retrieve, as well as knowing whether that
process finished or not, in a reliable way.

On Sat, Feb 2, 2013 at 11:04 PM, Keith Rarick k...@heroku.com wrote:

 FWIW, I think exit code definitely belongs in the Heroku API.
 That's a longstanding known deficiency. I hope we can fix it
 soon, but can't make any promises.

 On Sat, Feb 2, 2013 at 9:35 PM, Daniel Doubrovkine dbl...@dblock.org
 wrote:
  I published heroku-commander (https://github.com/dblock/heroku-commander
 )
  that wraps `heroku config -s` among other things. I still think this gem
  shouldn't exist and the functionality rolled into the heroku-client -
  @geemus, you might want to give this some thought. For the exit code
 part it
  would require cooperation from the server-side, but for the client-side
  credentials, not so much.
 
  cheers
  dB.
 
 
  On Thu, Dec 27, 2012 at 2:23 PM, Daniel Doubrovkine dbl...@dblock.org
  wrote:
 
  Indeed, maybe this does belong in a gem. Either way one wants to be able
  to do programmatically everything that the `heroku` command does without
  having to call it.
 
 
  On Thu, Dec 27, 2012 at 1:53 PM, geemus wes...@heroku.com wrote:
 
  I think Daniels approach is the easiest currently (thanks dB!). Perhaps
  we should create a gem for doing looking up the implied app as I'm
 reticent
  to say it belong in heroku-api.
 
  As for config you should be able to use the netrc gem and read the
  credentials for 'api.heroku.com' in order to get them.
 
  Hope that helps.
 
 
  On Tuesday, December 25, 2012 8:12:01 AM UTC-6, dB. wrote:
 
  We've asked a similar question a while ago, and the best we could come
  up with is a hack to run `heroku config -s`.
 
  config = {}
  config_output = `heroku config -s#{app_param}`.chomp
 
 
  if ($?.to_i != 0)
 
 
raise error running heroku config: #{$?}
 
 
$stderr.puts config_output
 
 
  end
  config_output.each_line do |line|
 
 
parts = line.split(=, 2)
 
 
raise invalid line #{line} if (parts.size != 2)
 
 
config[parts[0].strip] = parts[1].strip
 
 
  end
  config
 
 
  On Mon, Dec 24, 2012 at 9:42 PM, Francois fha...@gmail.com wrote:
 
  hi,
   i wrote a gem a year or so ago that adds some rake tasks to a
  RefineryCMS rails project (
 https://github.com/rounders/refinerycms-s3assets)
  . The rake tasks are meant to be run in development and they are for
 copying
  production s3 assets to development.
 
  Using the heroku gem, my gem reads the s3-related heroku config vars
 in
  order to determine which s3 bucket to fetch the assets from and
 which s3
  credentials to use. Specifically the config vars are obtained as
 follows:
 
   base = Heroku::Command::BaseWithApp.new
   config_vars = base.heroku.config_vars(base.app)
 
  It is my understanding that the heroku gem should no longer be used
 and
  that we should instead use the heroku-api gem. But as far as I can
 tell the
  heroku-api gem does not automatically handle figuring out the
 current heroku
  app as the heroku gem does. And there is also the issue of
 authentication,
  though that one isn't as much of an issue since I can ask users to
 set their
  HEROKU_API_KEY environment variable.
 
  Is there a recommended way to obtain the config vars of an app via a
  rake task without asking the user to hard code or specify the name
 of their
  heroku app without using the heroku gem?
 
  - Thanks,
  Francois
 
 
 
 
 
 
 
 
 
  --
  You received this message because you are subscribed to the Google
  Groups Heroku group.
 
  To unsubscribe from this group, send email to
  heroku+un...@googlegroups.com
 
  For more options, visit this group at
  http://groups.google.com/group/heroku?hl=en_US?hl=en
 
 
 
 
  --
 
  dB. | Moscow - Geneva - Seattle - New York
  dblock.org - @dblockdotorg
 
  --
  You received this message because you are subscribed to the Google
  Groups Heroku group.
 
  To unsubscribe from this group, send email to
  heroku+unsubscr...@googlegroups.com
  For more options, visit this group at
  http://groups.google.com/group/heroku?hl=en_US?hl=en
 
 
 
 
  --
 
  dB. | Moscow - Geneva - Seattle - New York
  dblock.org - @dblockdotorg
 
 
 
 
  --
 
  dB. | Moscow - Geneva - Seattle - New York
  dblock.org - @dblockdotorg
 
  --
  --
  You received this message because you are subscribed to the Google
  Groups Heroku group.
 
  To unsubscribe from this group, send email to
  heroku+unsubscr...@googlegroups.com
  For more options, visit this group at
  http://groups.google.com/group/heroku?hl=en_US?hl=en
 
  ---
  You received this message because you are subscribed to the Google Groups
  Heroku Community group.
  To unsubscribe from this group and stop receiving emails from it, send an
  email to heroku+unsubscr...@googlegroups.com.
  For more options, visit https://groups.google.com/groups/opt_out.
 
 

 --
 --
 You received this message because you are subscribed to the Google

Re: heroku-api

2013-02-04 Thread geemus
Thanks for the great feedback and sharing code to help others who might be 
encountering this. Prioritization is always tricky and this is one of those 
things that has been on our radar but hasn't quite topped the list yet. 
Hopefully we'll be able to move toward a better solution from the server 
end to make this cleaner and provide for detached processes soon, but as 
per Keith no promises.

Kind of an aside, but a couple other things you might check out in case you 
were unaware of them:

For direct interactions I would probably recommend the heroku-api gem 
instead of Heroku::Client, see: https://github.com/heroku/heroku.rb. 
Although I think it may have the same credentials issue you mentioned. I 
think that can be gotten around using the netrc gem (which is what the 
toolbelt does internally also). Happy to provide details if you need them. 

From there I think you can also use the rendezvous gem to connect to a 
process and stream stuff if needed (this mimics the attached behavior). 
There may be some pieces missing from one/both, but they may help fill in 
some gaps compared to the client as they were written for outside 
programmatic usage (whereas Client is mostly used by the toolbelt).

On Monday, February 4, 2013 9:05:29 AM UTC-6, dB. wrote:

 Thanks Keith. In the related realm, the exit code of a run:detached is 
 something one should be able to retrieve, as well as knowing whether that 
 process finished or not, in a reliable way.

 On Sat, Feb 2, 2013 at 11:04 PM, Keith Rarick k...@heroku.comjavascript:
  wrote:

 FWIW, I think exit code definitely belongs in the Heroku API.
 That's a longstanding known deficiency. I hope we can fix it
 soon, but can't make any promises.

 On Sat, Feb 2, 2013 at 9:35 PM, Daniel Doubrovkine 
 dbl...@dblock.orgjavascript: 
 wrote:
  I published heroku-commander (
 https://github.com/dblock/heroku-commander)
  that wraps `heroku config -s` among other things. I still think this gem
  shouldn't exist and the functionality rolled into the heroku-client -
  @geemus, you might want to give this some thought. For the exit code 
 part it
  would require cooperation from the server-side, but for the client-side
  credentials, not so much.
 
  cheers
  dB.
 
 
  On Thu, Dec 27, 2012 at 2:23 PM, Daniel Doubrovkine 
  dbl...@dblock.orgjavascript:
 
  wrote:
 
  Indeed, maybe this does belong in a gem. Either way one wants to be 
 able
  to do programmatically everything that the `heroku` command does 
 without
  having to call it.
 
 
  On Thu, Dec 27, 2012 at 1:53 PM, geemus wes...@heroku.comjavascript: 
 wrote:
 
  I think Daniels approach is the easiest currently (thanks dB!). 
 Perhaps
  we should create a gem for doing looking up the implied app as I'm 
 reticent
  to say it belong in heroku-api.
 
  As for config you should be able to use the netrc gem and read the
  credentials for 'api.heroku.com' in order to get them.
 
  Hope that helps.
 
 
  On Tuesday, December 25, 2012 8:12:01 AM UTC-6, dB. wrote:
 
  We've asked a similar question a while ago, and the best we could 
 come
  up with is a hack to run `heroku config -s`.
 
  config = {}
  config_output = `heroku config -s#{app_param}`.chomp
 
 
  if ($?.to_i != 0)
 
 
raise error running heroku config: #{$?}
 
 
$stderr.puts config_output
 
 
  end
  config_output.each_line do |line|
 
 
parts = line.split(=, 2)
 
 
raise invalid line #{line} if (parts.size != 2)
 
 
config[parts[0].strip] = parts[1].strip
 
 
  end
  config
 
 
  On Mon, Dec 24, 2012 at 9:42 PM, Francois fha...@gmail.com wrote:
 
  hi,
   i wrote a gem a year or so ago that adds some rake tasks to a
  RefineryCMS rails project (
 https://github.com/rounders/refinerycms-s3assets)
  . The rake tasks are meant to be run in development and they are 
 for copying
  production s3 assets to development.
 
  Using the heroku gem, my gem reads the s3-related heroku config 
 vars in
  order to determine which s3 bucket to fetch the assets from and 
 which s3
  credentials to use. Specifically the config vars are obtained as 
 follows:
 
   base = Heroku::Command::BaseWithApp.new
   config_vars = base.heroku.config_vars(base.app)
 
  It is my understanding that the heroku gem should no longer be used 
 and
  that we should instead use the heroku-api gem. But as far as I can 
 tell the
  heroku-api gem does not automatically handle figuring out the 
 current heroku
  app as the heroku gem does. And there is also the issue of 
 authentication,
  though that one isn't as much of an issue since I can ask users to 
 set their
  HEROKU_API_KEY environment variable.
 
  Is there a recommended way to obtain the config vars of an app via a
  rake task without asking the user to hard code or specify the name 
 of their
  heroku app without using the heroku gem?
 
  - Thanks,
  Francois
 
 
 
 
 
 
 
 
 
  --
  You received this message because you are subscribed to the Google
  Groups Heroku group.
 
  To unsubscribe from this group, send

Re: heroku-api

2013-02-02 Thread Daniel Doubrovkine
I published heroku-commander (https://github.com/dblock/heroku-commander)
that wraps `heroku config -s` among other things. I still think this gem
shouldn't exist and the functionality rolled into the heroku-client -
@geemus, you might want to give this some thought. For the exit code part
it would require cooperation from the server-side, but for the client-side
credentials, not so much.

cheers
dB.

On Thu, Dec 27, 2012 at 2:23 PM, Daniel Doubrovkine dbl...@dblock.orgwrote:

 Indeed, maybe this does belong in a gem. Either way one wants to be able
 to do programmatically everything that the `heroku` command does without
 having to call it.


 On Thu, Dec 27, 2012 at 1:53 PM, geemus wes...@heroku.com wrote:

 I think Daniels approach is the easiest currently (thanks dB!). Perhaps
 we should create a gem for doing looking up the implied app as I'm reticent
 to say it belong in heroku-api.

 As for config you should be able to use the netrc gem and read the
 credentials for 'api.heroku.com' in order to get them.

 Hope that helps.


 On Tuesday, December 25, 2012 8:12:01 AM UTC-6, dB. wrote:

 We've asked a similar question a while ago, and the best we could come
 up with is a hack to run `heroku config -s`.

 config = {}
 config_output = `heroku config -s#{app_param}`.chomp

 if ($?.to_i != 0)

   raise error running heroku config: #{$?}

   $stderr.puts config_output

 end
 config_output.each_line do |line|

   parts = line.split(=, 2)

   raise invalid line #{line} if (parts.size != 2)

   config[parts[0].strip] = parts[1].strip

 end
 config


 On Mon, Dec 24, 2012 at 9:42 PM, Francois fha...@gmail.com wrote:

 hi,
  i wrote a gem a year or so ago that adds some rake tasks to a
 RefineryCMS rails project (https://github.com/rounders/**
 refinerycms-s3assets https://github.com/rounders/refinerycms-s3assets)
 . The rake tasks are meant to be run in development and they are for
 copying production s3 assets to development.

 Using the heroku gem, my gem reads the s3-related heroku config vars in
 order to determine which s3 bucket to fetch the assets from and which s3
 credentials to use. Specifically the config vars are obtained as follows:

  base = Heroku::Command::BaseWithApp.**new
  config_vars = base.heroku.config_vars(base.**app)

 It is my understanding that the heroku gem should no longer be used and
 that we should instead use the heroku-api gem. But as far as I can tell the
 heroku-api gem does not automatically handle figuring out the current
 heroku app as the heroku gem does. And there is also the issue of
 authentication, though that one isn't as much of an issue since I can ask
 users to set their HEROKU_API_KEY environment variable.

 Is there a recommended way to obtain the config vars of an app via a
 rake task without asking the user to hard code or specify the name of their
 heroku app without using the heroku gem?

 - Thanks,
 Francois









  --
 You received this message because you are subscribed to the Google
 Groups Heroku group.

 To unsubscribe from this group, send email to
 heroku+un...@**googlegroups.com

 For more options, visit this group at
 http://groups.google.com/**group/heroku?hl=en_US?hl=enhttp://groups.google.com/group/heroku?hl=en_US?hl=en




 --

 dB. | Moscow - Geneva - Seattle - New York
 dblock.org http://www.dblock.org - 
 @dblockdotorghttp://twitter.com/#!/dblockdotorg

  --
 You received this message because you are subscribed to the Google
 Groups Heroku group.

 To unsubscribe from this group, send email to
 heroku+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/heroku?hl=en_US?hl=en




 --

 dB. | Moscow - Geneva - Seattle - New York
 dblock.org http://www.dblock.org - 
 @dblockdotorghttp://twitter.com/#!/dblockdotorg




-- 

dB. | Moscow - Geneva - Seattle - New York
dblock.org http://www.dblock.org -
@dblockdotorghttp://twitter.com/#!/dblockdotorg

-- 
-- 
You received this message because you are subscribed to the Google
Groups Heroku group.

To unsubscribe from this group, send email to
heroku+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/heroku?hl=en_US?hl=en

--- 
You received this message because you are subscribed to the Google Groups 
Heroku Community group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to heroku+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: heroku-api

2012-12-27 Thread geemus
I think Daniels approach is the easiest currently (thanks dB!). Perhaps we 
should create a gem for doing looking up the implied app as I'm reticent to 
say it belong in heroku-api.

As for config you should be able to use the netrc gem and read the 
credentials for 'api.heroku.com' in order to get them.

Hope that helps.

On Tuesday, December 25, 2012 8:12:01 AM UTC-6, dB. wrote:

 We've asked a similar question a while ago, and the best we could come up 
 with is a hack to run `heroku config -s`.

 config = {}
 config_output = `heroku config -s#{app_param}`.chomp
 if ($?.to_i != 0)
   raise error running heroku config: #{$?}
   $stderr.puts config_output
 end
 config_output.each_line do |line|
   parts = line.split(=, 2)
   raise invalid line #{line} if (parts.size != 2)
   config[parts[0].strip] = parts[1].strip
 end
 config


 On Mon, Dec 24, 2012 at 9:42 PM, Francois fha...@gmail.com 
 javascript:wrote:

 hi,
  i wrote a gem a year or so ago that adds some rake tasks to a 
 RefineryCMS rails project (
 https://github.com/rounders/refinerycms-s3assets) . The rake tasks are 
 meant to be run in development and they are for copying production s3 
 assets to development.

 Using the heroku gem, my gem reads the s3-related heroku config vars in 
 order to determine which s3 bucket to fetch the assets from and which s3 
 credentials to use. Specifically the config vars are obtained as follows:

  base = Heroku::Command::BaseWithApp.new
  config_vars = base.heroku.config_vars(base.app)

 It is my understanding that the heroku gem should no longer be used and 
 that we should instead use the heroku-api gem. But as far as I can tell the 
 heroku-api gem does not automatically handle figuring out the current 
 heroku app as the heroku gem does. And there is also the issue of 
 authentication, though that one isn't as much of an issue since I can ask 
 users to set their HEROKU_API_KEY environment variable. 

 Is there a recommended way to obtain the config vars of an app via a rake 
 task without asking the user to hard code or specify the name of their 
 heroku app without using the heroku gem? 

 - Thanks,
 Francois









  -- 
 You received this message because you are subscribed to the Google
 Groups Heroku group.
  
 To unsubscribe from this group, send email to
 heroku+un...@googlegroups.com javascript:
 For more options, visit this group at
 http://groups.google.com/group/heroku?hl=en_US?hl=en




 -- 

 dB. | Moscow - Geneva - Seattle - New York
 dblock.org http://www.dblock.org - 
 @dblockdotorghttp://twitter.com/#!/dblockdotorg
  

-- 
You received this message because you are subscribed to the Google
Groups Heroku group.

To unsubscribe from this group, send email to
heroku+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/heroku?hl=en_US?hl=en


Re: heroku-api

2012-12-27 Thread Daniel Doubrovkine
Indeed, maybe this does belong in a gem. Either way one wants to be able to
do programmatically everything that the `heroku` command does without
having to call it.

On Thu, Dec 27, 2012 at 1:53 PM, geemus wes...@heroku.com wrote:

 I think Daniels approach is the easiest currently (thanks dB!). Perhaps we
 should create a gem for doing looking up the implied app as I'm reticent to
 say it belong in heroku-api.

 As for config you should be able to use the netrc gem and read the
 credentials for 'api.heroku.com' in order to get them.

 Hope that helps.


 On Tuesday, December 25, 2012 8:12:01 AM UTC-6, dB. wrote:

 We've asked a similar question a while ago, and the best we could come up
 with is a hack to run `heroku config -s`.

 config = {}
 config_output = `heroku config -s#{app_param}`.chomp
 if ($?.to_i != 0)
   raise error running heroku config: #{$?}
   $stderr.puts config_output
 end
 config_output.each_line do |line|
   parts = line.split(=, 2)
   raise invalid line #{line} if (parts.size != 2)
   config[parts[0].strip] = parts[1].strip
 end
 config


 On Mon, Dec 24, 2012 at 9:42 PM, Francois fha...@gmail.com wrote:

 hi,
  i wrote a gem a year or so ago that adds some rake tasks to a
 RefineryCMS rails project (https://github.com/rounders/**
 refinerycms-s3assets https://github.com/rounders/refinerycms-s3assets)
 . The rake tasks are meant to be run in development and they are for
 copying production s3 assets to development.

 Using the heroku gem, my gem reads the s3-related heroku config vars in
 order to determine which s3 bucket to fetch the assets from and which s3
 credentials to use. Specifically the config vars are obtained as follows:

  base = Heroku::Command::BaseWithApp.**new
  config_vars = base.heroku.config_vars(base.**app)

 It is my understanding that the heroku gem should no longer be used and
 that we should instead use the heroku-api gem. But as far as I can tell the
 heroku-api gem does not automatically handle figuring out the current
 heroku app as the heroku gem does. And there is also the issue of
 authentication, though that one isn't as much of an issue since I can ask
 users to set their HEROKU_API_KEY environment variable.

 Is there a recommended way to obtain the config vars of an app via a
 rake task without asking the user to hard code or specify the name of their
 heroku app without using the heroku gem?

 - Thanks,
 Francois









  --
 You received this message because you are subscribed to the Google
 Groups Heroku group.

 To unsubscribe from this group, send email to
 heroku+un...@**googlegroups.com

 For more options, visit this group at
 http://groups.google.com/**group/heroku?hl=en_US?hl=enhttp://groups.google.com/group/heroku?hl=en_US?hl=en




 --

 dB. | Moscow - Geneva - Seattle - New York
 dblock.org http://www.dblock.org - 
 @dblockdotorghttp://twitter.com/#!/dblockdotorg

  --
 You received this message because you are subscribed to the Google
 Groups Heroku group.

 To unsubscribe from this group, send email to
 heroku+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/heroku?hl=en_US?hl=en




-- 

dB. | Moscow - Geneva - Seattle - New York
dblock.org http://www.dblock.org -
@dblockdotorghttp://twitter.com/#!/dblockdotorg

-- 
You received this message because you are subscribed to the Google
Groups Heroku group.

To unsubscribe from this group, send email to
heroku+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/heroku?hl=en_US?hl=en


Re: heroku-api

2012-12-25 Thread Daniel Doubrovkine
We've asked a similar question a while ago, and the best we could come up
with is a hack to run `heroku config -s`.

config = {}
config_output = `heroku config -s#{app_param}`.chomp
if ($?.to_i != 0)
  raise error running heroku config: #{$?}
  $stderr.puts config_output
end
config_output.each_line do |line|
  parts = line.split(=, 2)
  raise invalid line #{line} if (parts.size != 2)
  config[parts[0].strip] = parts[1].strip
end
config


On Mon, Dec 24, 2012 at 9:42 PM, Francois fhar...@gmail.com wrote:

 hi,
  i wrote a gem a year or so ago that adds some rake tasks to a RefineryCMS
 rails project (https://github.com/rounders/refinerycms-s3assets) . The
 rake tasks are meant to be run in development and they are for copying
 production s3 assets to development.

 Using the heroku gem, my gem reads the s3-related heroku config vars in
 order to determine which s3 bucket to fetch the assets from and which s3
 credentials to use. Specifically the config vars are obtained as follows:

  base = Heroku::Command::BaseWithApp.new
  config_vars = base.heroku.config_vars(base.app)

 It is my understanding that the heroku gem should no longer be used and
 that we should instead use the heroku-api gem. But as far as I can tell the
 heroku-api gem does not automatically handle figuring out the current
 heroku app as the heroku gem does. And there is also the issue of
 authentication, though that one isn't as much of an issue since I can ask
 users to set their HEROKU_API_KEY environment variable.

 Is there a recommended way to obtain the config vars of an app via a rake
 task without asking the user to hard code or specify the name of their
 heroku app without using the heroku gem?

 - Thanks,
 Francois









  --
 You received this message because you are subscribed to the Google
 Groups Heroku group.

 To unsubscribe from this group, send email to
 heroku+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/heroku?hl=en_US?hl=en




-- 

dB. | Moscow - Geneva - Seattle - New York
dblock.org http://www.dblock.org -
@dblockdotorghttp://twitter.com/#!/dblockdotorg

-- 
You received this message because you are subscribed to the Google
Groups Heroku group.

To unsubscribe from this group, send email to
heroku+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/heroku?hl=en_US?hl=en


heroku-api

2012-12-24 Thread Francois
hi,
 i wrote a gem a year or so ago that adds some rake tasks to a RefineryCMS 
rails project (https://github.com/rounders/refinerycms-s3assets) . The rake 
tasks are meant to be run in development and they are for copying 
production s3 assets to development.

Using the heroku gem, my gem reads the s3-related heroku config vars in 
order to determine which s3 bucket to fetch the assets from and which s3 
credentials to use. Specifically the config vars are obtained as follows:

 base = Heroku::Command::BaseWithApp.new
 config_vars = base.heroku.config_vars(base.app)

It is my understanding that the heroku gem should no longer be used and 
that we should instead use the heroku-api gem. But as far as I can tell the 
heroku-api gem does not automatically handle figuring out the current 
heroku app as the heroku gem does. And there is also the issue of 
authentication, though that one isn't as much of an issue since I can ask 
users to set their HEROKU_API_KEY environment variable. 

Is there a recommended way to obtain the config vars of an app via a rake 
task without asking the user to hard code or specify the name of their 
heroku app without using the heroku gem? 

- Thanks,
Francois









-- 
You received this message because you are subscribed to the Google
Groups Heroku group.

To unsubscribe from this group, send email to
heroku+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/heroku?hl=en_US?hl=en


Heroku API authentication using email and password

2012-04-16 Thread Arvindh Sukumar
According to the Heroku API docs https://api-docs.heroku.com/, 
authentication is done using the User's API Key as password, and a blank 
username, through HTTP Basic authentication. However, i found that 
authentication works even if I use the account email and password.

I just wanted to check whether this is 'allowed'. The command-line tool 
useshttps://devcenter.heroku.com/articles/authenticationthis method, but I 
want to use it in an iOS app i'm developing. 

Using the email and password for login would be preferred, as it is much 
easier to input than the API key.

Thanks,
Arvindh

-- 
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/-/r7q3XH-5gOwJ.
To post to this group, send email to heroku@googlegroups.com.
To unsubscribe from this group, send email to 
heroku+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/heroku?hl=en.



Re: Heroku API authentication using email and password

2012-04-16 Thread Pedro Belo
Hi Arvindh,

Currently we take both the user API key and password for any API
calls, but that might change in the future.

The best approach for now is to use the Auth API with the username and
password, store the API key from the response and use it for
subsequent API calls. The API looks like this:

POST https://api.heroku.com/login
Params: username, password
Response: JSON
{
  api_key: abc123
}

Thanks,
Pedro

On Sun, Apr 15, 2012 at 11:39 PM, Arvindh Sukumar arvsuku...@gmail.com wrote:
 According to the Heroku API docs, authentication is done using the User's
 API Key as password, and a blank username, through HTTP Basic
 authentication. However, i found that authentication works even if I use the
 account email and password.

 I just wanted to check whether this is 'allowed'. The command-line tool uses
 this method, but I want to use it in an iOS app i'm developing.

 Using the email and password for login would be preferred, as it is much
 easier to input than the API key.

 Thanks,
 Arvindh

 --
 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/-/r7q3XH-5gOwJ.
 To post to this group, send email to heroku@googlegroups.com.
 To unsubscribe from this group, send email to
 heroku+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/heroku?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
Heroku group.
To post to this group, send email to heroku@googlegroups.com.
To unsubscribe from this group, send email to 
heroku+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/heroku?hl=en.



Re: My (flawed?) attempt to add or subtract workers via Heroku API.

2011-02-04 Thread rubynoob
Well, lo and behold, its working -- on the Aspen stack, no less!  The
trick was to keep the code block in the controller or model the action
was being called from.

The only thing not working at this point is adding a worker when one
is already running.

heroku.set_workers(ENV['HEROKU_APP'], +1) sets workers to 1, rather
than adding 1 to the total.

heroku.set_workers(ENV['HEROKU_APP'], -1) definitely subtracts a
worker, though.

So I guess I'll try assigning the current number of workers to a
variable, add one to that variable, and place it where the quantity
goes in the set_workers command.

Problem solved!

Thanks again for the help, folks.


On Jan 25, 8:09 am, rubynoob mysmilecent...@gmail.com wrote:
 Dammit!  I pressed the space bar and inadvertently posted before I was
 done typing the message!  :/

 That code block obviously should have and 'end,' so here it is:

 end

 There, I feel better now.

 On Jan 25, 8:06 am, rubynoob mysmilecent...@gmail.com wrote:

  I've been told by Heroku Support that we need to migrate to the Bamboo
  stack, upgrade our heroku and rest-client gems to the latest, and this
  should work.  Thanks to this community's help, I should be able to add
  or subtract workers with just a few lines of code!

  add_heroku_worker
  heroku = Heroku::Client.new(ENV['HEROKU_USERNAME'],
  ENV['HEROKU_PASSWORD'])
  heroku.set_workers(ENV['HEROKU_APP'], +1)

  Thanks, everyone!
  Jim

  On Jan 21, 10:07 am, rubynoob mysmilecent...@gmail.com wrote:

   @Pedro:

   Here's a link to the stack 
   trace:https://docs.google.com/document/d/1ntWg7PKgyOnSmAVkURW00O5i_LEDFdRsc...

   We're using RestClient gem version 1.4.2 with the Heroku gem version
   1.17.8, FWIW.

   @Chris:  That is good to know.  So it sounds like I don't need to
   introduce a lag as Keenan suggests.

   Thanks,
   Jim

   On Jan 21, 9:01 am, Chris Hanks christopher.m.ha...@gmail.com wrote:

You can start up as many workers (or dynos, for that matter) as you
want through the command line. 24 is just how high the slider goes on
the pricing page.

On Jan 21, 7:52 am, rubynoob mysmilecent...@gmail.com wrote:

 I may misunderstand how workers get charged on heroku, but from what
 I've seen 
 athttp://docs.heroku.com/background-jobsandhttp://docs.heroku.com/delay...,
  workers get charged $0.05/hr each
 no matter how many are running, pro-rated to the second.  The maximum
 workers per account seems to be 24 (that's where the slider stops on
 their Resources page).

 The jobs being delayed won't be created faster than one every 30
 seconds, so I assumed the first worker would spin up and grab the
 first job, then when the second job gets queued, a second worker would
 start, grabbing the second job, and so on.  Each job would process in
 it's own worker, which would then get shut down when the job
 completes.  One worker running three jobs that take a total of fifteen
 minutes to process should get charged the same as three workers
 running one job each for five minutes.  If I'm mistaken, let me know.

 Thanks,
 Jim

 On Jan 20, 4:57 pm, Keenan Brock kee...@thebrocks.net wrote:

  Also a thought.

  You will need to introduce a lag when you are determining if you 
  need more or less delayed job workers.

  Otherwise you will spin up too many DJs too quickly. And add/remove 
  them very often. Incurring extra charges.

  Smugmug spoke about this when they were talking about their on 
  demand photo processors a few years back.

  --Keenan

  On Jan 20, 2011, at 6:06 PM, Pedro Belo pe...@heroku.com wrote: 
  That was a good call, you definitely don't want to store variables 
  in
   config vars. Save if for constants (passwords, urls, etc).

   It seems like you might be getting an error due to different 
   versions
   of RestClient, not sure though. What version are you using? 
   What's the
   stack trace for the exception?

   On a side note, if it helps you can call heroku workers passing
   relative values, like +3, -1, etc.

   On Thu, Jan 20, 2011 at 12:00 PM, rubynoob 
   mysmilecent...@gmail.com wrote:
   Instead of storing the count of active workers as a heroku config
   variable, I decided to create a table in our database to store 
   the
   value in.
   So now I've got the problem narrowed down to the last line in the
   method.  Here's the block of code I've now got:

   add_heroku_worker
                  heroku = 
   Heroku::Client.new(ENV['HEROKU_USERNAME'],
   ENV['HEROKU_PASSWORD'])
                  myapp = 
   heroku.config_vars(ENV['HEROKU_APP'])[HEROKU_APP]
                  worker_count = WorkerCount.find(1)  # now I'm 
   storing the current
   number of active workers in a table that will always only have 
   one
   record.
                  workers = 

Re: My (flawed?) attempt to add or subtract workers via Heroku API.

2011-01-25 Thread rubynoob
I've been told by Heroku Support that we need to migrate to the Bamboo
stack, upgrade our heroku and rest-client gems to the latest, and this
should work.  Thanks to this community's help, I should be able to add
or subtract workers with just a few lines of code!

add_heroku_worker
heroku = Heroku::Client.new(ENV['HEROKU_USERNAME'],
ENV['HEROKU_PASSWORD'])
heroku.set_workers(ENV['HEROKU_APP'], +1)


Thanks, everyone!
Jim


On Jan 21, 10:07 am, rubynoob mysmilecent...@gmail.com wrote:
 @Pedro:

 Here's a link to the stack 
 trace:https://docs.google.com/document/d/1ntWg7PKgyOnSmAVkURW00O5i_LEDFdRsc...

 We're using RestClient gem version 1.4.2 with the Heroku gem version
 1.17.8, FWIW.

 @Chris:  That is good to know.  So it sounds like I don't need to
 introduce a lag as Keenan suggests.

 Thanks,
 Jim

 On Jan 21, 9:01 am, Chris Hanks christopher.m.ha...@gmail.com wrote:

  You can start up as many workers (or dynos, for that matter) as you
  want through the command line. 24 is just how high the slider goes on
  the pricing page.

  On Jan 21, 7:52 am, rubynoob mysmilecent...@gmail.com wrote:

   I may misunderstand how workers get charged on heroku, but from what
   I've seen 
   athttp://docs.heroku.com/background-jobsandhttp://docs.heroku.com/delay...,
workers get charged $0.05/hr each
   no matter how many are running, pro-rated to the second.  The maximum
   workers per account seems to be 24 (that's where the slider stops on
   their Resources page).

   The jobs being delayed won't be created faster than one every 30
   seconds, so I assumed the first worker would spin up and grab the
   first job, then when the second job gets queued, a second worker would
   start, grabbing the second job, and so on.  Each job would process in
   it's own worker, which would then get shut down when the job
   completes.  One worker running three jobs that take a total of fifteen
   minutes to process should get charged the same as three workers
   running one job each for five minutes.  If I'm mistaken, let me know.

   Thanks,
   Jim

   On Jan 20, 4:57 pm, Keenan Brock kee...@thebrocks.net wrote:

Also a thought.

You will need to introduce a lag when you are determining if you need 
more or less delayed job workers.

Otherwise you will spin up too many DJs too quickly. And add/remove 
them very often. Incurring extra charges.

Smugmug spoke about this when they were talking about their on demand 
photo processors a few years back.

--Keenan

On Jan 20, 2011, at 6:06 PM, Pedro Belo pe...@heroku.com wrote: That 
was a good call, you definitely don't want to store variables in
 config vars. Save if for constants (passwords, urls, etc).

 It seems like you might be getting an error due to different versions
 of RestClient, not sure though. What version are you using? What's the
 stack trace for the exception?

 On a side note, if it helps you can call heroku workers passing
 relative values, like +3, -1, etc.

 On Thu, Jan 20, 2011 at 12:00 PM, rubynoob mysmilecent...@gmail.com 
 wrote:
 Instead of storing the count of active workers as a heroku config
 variable, I decided to create a table in our database to store the
 value in.
 So now I've got the problem narrowed down to the last line in the
 method.  Here's the block of code I've now got:

 add_heroku_worker
                heroku = Heroku::Client.new(ENV['HEROKU_USERNAME'],
 ENV['HEROKU_PASSWORD'])
                myapp = 
 heroku.config_vars(ENV['HEROKU_APP'])[HEROKU_APP]
                worker_count = WorkerCount.find(1)  # now I'm storing 
 the current
 number of active workers in a table that will always only have one
 record.
                workers = worker_count.workers
                qty = workers + 1
                worker_count.workers = qty
                worker_count.save
                heroku.set_workers(myapp, qty)
 end

 In the heroku console, this runs smoothly until I try the last line,
 to which I get this error:  TypeError: can't convert
 RestClient::Payload::UrlEncoded into String

 This line is formatted the same as LostBoy's workless gem, the
 autoscaling tree of delayed_job, and Heroku-Delayed-Job-Autoscale.  I
 must be missing something obvious (typical newbie, huh?)   ;)

 Thanks again for any help,
 Jim

 On Jan 20, 9:16 am, Peter Haza peter.h...@gmail.com wrote:
 I've done autoscaling of workers
 here:https://github.com/phaza/Heroku-Delayed-Job-Autoscale
 It's actually more like auto-shutdown of a single workers, but it 
 works well
 in our environment.

 --
 You received this message because you are subscribed to the Google 
 Groups Heroku group.
 To post to this group, send email to heroku@googlegroups.com.
 To unsubscribe from this group, send email to 
 heroku+unsubscr...@googlegroups.com.
  

Re: My (flawed?) attempt to add or subtract workers via Heroku API.

2011-01-25 Thread rubynoob
Dammit!  I pressed the space bar and inadvertently posted before I was
done typing the message!  :/

That code block obviously should have and 'end,' so here it is:

end

There, I feel better now.

On Jan 25, 8:06 am, rubynoob mysmilecent...@gmail.com wrote:
 I've been told by Heroku Support that we need to migrate to the Bamboo
 stack, upgrade our heroku and rest-client gems to the latest, and this
 should work.  Thanks to this community's help, I should be able to add
 or subtract workers with just a few lines of code!

 add_heroku_worker
 heroku = Heroku::Client.new(ENV['HEROKU_USERNAME'],
 ENV['HEROKU_PASSWORD'])
 heroku.set_workers(ENV['HEROKU_APP'], +1)

 Thanks, everyone!
 Jim

 On Jan 21, 10:07 am, rubynoob mysmilecent...@gmail.com wrote:

  @Pedro:

  Here's a link to the stack 
  trace:https://docs.google.com/document/d/1ntWg7PKgyOnSmAVkURW00O5i_LEDFdRsc...

  We're using RestClient gem version 1.4.2 with the Heroku gem version
  1.17.8, FWIW.

  @Chris:  That is good to know.  So it sounds like I don't need to
  introduce a lag as Keenan suggests.

  Thanks,
  Jim

  On Jan 21, 9:01 am, Chris Hanks christopher.m.ha...@gmail.com wrote:

   You can start up as many workers (or dynos, for that matter) as you
   want through the command line. 24 is just how high the slider goes on
   the pricing page.

   On Jan 21, 7:52 am, rubynoob mysmilecent...@gmail.com wrote:

I may misunderstand how workers get charged on heroku, but from what
I've seen 
athttp://docs.heroku.com/background-jobsandhttp://docs.heroku.com/delay...,
 workers get charged $0.05/hr each
no matter how many are running, pro-rated to the second.  The maximum
workers per account seems to be 24 (that's where the slider stops on
their Resources page).

The jobs being delayed won't be created faster than one every 30
seconds, so I assumed the first worker would spin up and grab the
first job, then when the second job gets queued, a second worker would
start, grabbing the second job, and so on.  Each job would process in
it's own worker, which would then get shut down when the job
completes.  One worker running three jobs that take a total of fifteen
minutes to process should get charged the same as three workers
running one job each for five minutes.  If I'm mistaken, let me know.

Thanks,
Jim

On Jan 20, 4:57 pm, Keenan Brock kee...@thebrocks.net wrote:

 Also a thought.

 You will need to introduce a lag when you are determining if you need 
 more or less delayed job workers.

 Otherwise you will spin up too many DJs too quickly. And add/remove 
 them very often. Incurring extra charges.

 Smugmug spoke about this when they were talking about their on demand 
 photo processors a few years back.

 --Keenan

 On Jan 20, 2011, at 6:06 PM, Pedro Belo pe...@heroku.com wrote: 
 That was a good call, you definitely don't want to store variables in
  config vars. Save if for constants (passwords, urls, etc).

  It seems like you might be getting an error due to different 
  versions
  of RestClient, not sure though. What version are you using? What's 
  the
  stack trace for the exception?

  On a side note, if it helps you can call heroku workers passing
  relative values, like +3, -1, etc.

  On Thu, Jan 20, 2011 at 12:00 PM, rubynoob 
  mysmilecent...@gmail.com wrote:
  Instead of storing the count of active workers as a heroku config
  variable, I decided to create a table in our database to store the
  value in.
  So now I've got the problem narrowed down to the last line in the
  method.  Here's the block of code I've now got:

  add_heroku_worker
                 heroku = Heroku::Client.new(ENV['HEROKU_USERNAME'],
  ENV['HEROKU_PASSWORD'])
                 myapp = 
  heroku.config_vars(ENV['HEROKU_APP'])[HEROKU_APP]
                 worker_count = WorkerCount.find(1)  # now I'm 
  storing the current
  number of active workers in a table that will always only have one
  record.
                 workers = worker_count.workers
                 qty = workers + 1
                 worker_count.workers = qty
                 worker_count.save
                 heroku.set_workers(myapp, qty)
  end

  In the heroku console, this runs smoothly until I try the last 
  line,
  to which I get this error:  TypeError: can't convert
  RestClient::Payload::UrlEncoded into String

  This line is formatted the same as LostBoy's workless gem, the
  autoscaling tree of delayed_job, and Heroku-Delayed-Job-Autoscale. 
   I
  must be missing something obvious (typical newbie, huh?)   ;)

  Thanks again for any help,
  Jim

  On Jan 20, 9:16 am, Peter Haza peter.h...@gmail.com wrote:
  I've done autoscaling of workers
  here:https://github.com/phaza/Heroku-Delayed-Job-Autoscale
  

Re: My (flawed?) attempt to add or subtract workers via Heroku API.

2011-01-21 Thread rubynoob
I may misunderstand how workers get charged on heroku, but from what
I've seen at http://docs.heroku.com/background-jobs and
http://docs.heroku.com/delayed-job, workers get charged $0.05/hr each
no matter how many are running, pro-rated to the second.  The maximum
workers per account seems to be 24 (that's where the slider stops on
their Resources page).

The jobs being delayed won't be created faster than one every 30
seconds, so I assumed the first worker would spin up and grab the
first job, then when the second job gets queued, a second worker would
start, grabbing the second job, and so on.  Each job would process in
it's own worker, which would then get shut down when the job
completes.  One worker running three jobs that take a total of fifteen
minutes to process should get charged the same as three workers
running one job each for five minutes.  If I'm mistaken, let me know.

Thanks,
Jim

On Jan 20, 4:57 pm, Keenan Brock kee...@thebrocks.net wrote:
 Also a thought.

 You will need to introduce a lag when you are determining if you need more or 
 less delayed job workers.

 Otherwise you will spin up too many DJs too quickly. And add/remove them very 
 often. Incurring extra charges.

 Smugmug spoke about this when they were talking about their on demand photo 
 processors a few years back.

 --Keenan

 On Jan 20, 2011, at 6:06 PM, Pedro Belo pe...@heroku.com wrote: That was a 
 good call, you definitely don't want to store variables in
  config vars. Save if for constants (passwords, urls, etc).

  It seems like you might be getting an error due to different versions
  of RestClient, not sure though. What version are you using? What's the
  stack trace for the exception?

  On a side note, if it helps you can call heroku workers passing
  relative values, like +3, -1, etc.

  On Thu, Jan 20, 2011 at 12:00 PM, rubynoob mysmilecent...@gmail.com wrote:
  Instead of storing the count of active workers as a heroku config
  variable, I decided to create a table in our database to store the
  value in.
  So now I've got the problem narrowed down to the last line in the
  method.  Here's the block of code I've now got:

  add_heroku_worker
                 heroku = Heroku::Client.new(ENV['HEROKU_USERNAME'],
  ENV['HEROKU_PASSWORD'])
                 myapp = heroku.config_vars(ENV['HEROKU_APP'])[HEROKU_APP]
                 worker_count = WorkerCount.find(1)  # now I'm storing the 
  current
  number of active workers in a table that will always only have one
  record.
                 workers = worker_count.workers
                 qty = workers + 1
                 worker_count.workers = qty
                 worker_count.save
                 heroku.set_workers(myapp, qty)
  end

  In the heroku console, this runs smoothly until I try the last line,
  to which I get this error:  TypeError: can't convert
  RestClient::Payload::UrlEncoded into String

  This line is formatted the same as LostBoy's workless gem, the
  autoscaling tree of delayed_job, and Heroku-Delayed-Job-Autoscale.  I
  must be missing something obvious (typical newbie, huh?)   ;)

  Thanks again for any help,
  Jim

  On Jan 20, 9:16 am, Peter Haza peter.h...@gmail.com wrote:
  I've done autoscaling of workers
  here:https://github.com/phaza/Heroku-Delayed-Job-Autoscale
  It's actually more like auto-shutdown of a single workers, but it works 
  well
  in our environment.

  --
  You received this message because you are subscribed to the Google Groups 
  Heroku group.
  To post to this group, send email to heroku@googlegroups.com.
  To unsubscribe from this group, send email to 
  heroku+unsubscr...@googlegroups.com.
  For more options, visit this group 
  athttp://groups.google.com/group/heroku?hl=en.

  --
  You received this message because you are subscribed to the Google Groups 
  Heroku group.
  To post to this group, send email to heroku@googlegroups.com.
  To unsubscribe from this group, send email to 
  heroku+unsubscr...@googlegroups.com.
  For more options, visit this group 
  athttp://groups.google.com/group/heroku?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
Heroku group.
To post to this group, send email to heroku@googlegroups.com.
To unsubscribe from this group, send email to 
heroku+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/heroku?hl=en.



Re: My (flawed?) attempt to add or subtract workers via Heroku API.

2011-01-21 Thread Chris Hanks
You can start up as many workers (or dynos, for that matter) as you
want through the command line. 24 is just how high the slider goes on
the pricing page.



On Jan 21, 7:52 am, rubynoob mysmilecent...@gmail.com wrote:
 I may misunderstand how workers get charged on heroku, but from what
 I've seen 
 athttp://docs.heroku.com/background-jobsandhttp://docs.heroku.com/delayed-job,
  workers get charged $0.05/hr each
 no matter how many are running, pro-rated to the second.  The maximum
 workers per account seems to be 24 (that's where the slider stops on
 their Resources page).

 The jobs being delayed won't be created faster than one every 30
 seconds, so I assumed the first worker would spin up and grab the
 first job, then when the second job gets queued, a second worker would
 start, grabbing the second job, and so on.  Each job would process in
 it's own worker, which would then get shut down when the job
 completes.  One worker running three jobs that take a total of fifteen
 minutes to process should get charged the same as three workers
 running one job each for five minutes.  If I'm mistaken, let me know.

 Thanks,
 Jim

 On Jan 20, 4:57 pm, Keenan Brock kee...@thebrocks.net wrote:







  Also a thought.

  You will need to introduce a lag when you are determining if you need more 
  or less delayed job workers.

  Otherwise you will spin up too many DJs too quickly. And add/remove them 
  very often. Incurring extra charges.

  Smugmug spoke about this when they were talking about their on demand photo 
  processors a few years back.

  --Keenan

  On Jan 20, 2011, at 6:06 PM, Pedro Belo pe...@heroku.com wrote: That was 
  a good call, you definitely don't want to store variables in
   config vars. Save if for constants (passwords, urls, etc).

   It seems like you might be getting an error due to different versions
   of RestClient, not sure though. What version are you using? What's the
   stack trace for the exception?

   On a side note, if it helps you can call heroku workers passing
   relative values, like +3, -1, etc.

   On Thu, Jan 20, 2011 at 12:00 PM, rubynoob mysmilecent...@gmail.com 
   wrote:
   Instead of storing the count of active workers as a heroku config
   variable, I decided to create a table in our database to store the
   value in.
   So now I've got the problem narrowed down to the last line in the
   method.  Here's the block of code I've now got:

   add_heroku_worker
                  heroku = Heroku::Client.new(ENV['HEROKU_USERNAME'],
   ENV['HEROKU_PASSWORD'])
                  myapp = 
   heroku.config_vars(ENV['HEROKU_APP'])[HEROKU_APP]
                  worker_count = WorkerCount.find(1)  # now I'm storing the 
   current
   number of active workers in a table that will always only have one
   record.
                  workers = worker_count.workers
                  qty = workers + 1
                  worker_count.workers = qty
                  worker_count.save
                  heroku.set_workers(myapp, qty)
   end

   In the heroku console, this runs smoothly until I try the last line,
   to which I get this error:  TypeError: can't convert
   RestClient::Payload::UrlEncoded into String

   This line is formatted the same as LostBoy's workless gem, the
   autoscaling tree of delayed_job, and Heroku-Delayed-Job-Autoscale.  I
   must be missing something obvious (typical newbie, huh?)   ;)

   Thanks again for any help,
   Jim

   On Jan 20, 9:16 am, Peter Haza peter.h...@gmail.com wrote:
   I've done autoscaling of workers
   here:https://github.com/phaza/Heroku-Delayed-Job-Autoscale
   It's actually more like auto-shutdown of a single workers, but it works 
   well
   in our environment.

   --
   You received this message because you are subscribed to the Google 
   Groups Heroku group.
   To post to this group, send email to heroku@googlegroups.com.
   To unsubscribe from this group, send email to 
   heroku+unsubscr...@googlegroups.com.
   For more options, visit this group 
   athttp://groups.google.com/group/heroku?hl=en.

   --
   You received this message because you are subscribed to the Google Groups 
   Heroku group.
   To post to this group, send email to heroku@googlegroups.com.
   To unsubscribe from this group, send email to 
   heroku+unsubscr...@googlegroups.com.
   For more options, visit this group 
   athttp://groups.google.com/group/heroku?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
Heroku group.
To post to this group, send email to heroku@googlegroups.com.
To unsubscribe from this group, send email to 
heroku+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/heroku?hl=en.



Re: My (flawed?) attempt to add or subtract workers via Heroku API.

2011-01-21 Thread rubynoob
@Pedro:

Here's a link to the stack trace:
https://docs.google.com/document/d/1ntWg7PKgyOnSmAVkURW00O5i_LEDFdRscE78NR-cSfg/edit?hl=enauthkey=CMnLv7UB

We're using RestClient gem version 1.4.2 with the Heroku gem version
1.17.8, FWIW.

@Chris:  That is good to know.  So it sounds like I don't need to
introduce a lag as Keenan suggests.

Thanks,
Jim

On Jan 21, 9:01 am, Chris Hanks christopher.m.ha...@gmail.com wrote:
 You can start up as many workers (or dynos, for that matter) as you
 want through the command line. 24 is just how high the slider goes on
 the pricing page.

 On Jan 21, 7:52 am, rubynoob mysmilecent...@gmail.com wrote:

  I may misunderstand how workers get charged on heroku, but from what
  I've seen 
  athttp://docs.heroku.com/background-jobsandhttp://docs.heroku.com/delay..., 
  workers get charged $0.05/hr each
  no matter how many are running, pro-rated to the second.  The maximum
  workers per account seems to be 24 (that's where the slider stops on
  their Resources page).

  The jobs being delayed won't be created faster than one every 30
  seconds, so I assumed the first worker would spin up and grab the
  first job, then when the second job gets queued, a second worker would
  start, grabbing the second job, and so on.  Each job would process in
  it's own worker, which would then get shut down when the job
  completes.  One worker running three jobs that take a total of fifteen
  minutes to process should get charged the same as three workers
  running one job each for five minutes.  If I'm mistaken, let me know.

  Thanks,
  Jim

  On Jan 20, 4:57 pm, Keenan Brock kee...@thebrocks.net wrote:

   Also a thought.

   You will need to introduce a lag when you are determining if you need 
   more or less delayed job workers.

   Otherwise you will spin up too many DJs too quickly. And add/remove them 
   very often. Incurring extra charges.

   Smugmug spoke about this when they were talking about their on demand 
   photo processors a few years back.

   --Keenan

   On Jan 20, 2011, at 6:06 PM, Pedro Belo pe...@heroku.com wrote: That 
   was a good call, you definitely don't want to store variables in
config vars. Save if for constants (passwords, urls, etc).

It seems like you might be getting an error due to different versions
of RestClient, not sure though. What version are you using? What's the
stack trace for the exception?

On a side note, if it helps you can call heroku workers passing
relative values, like +3, -1, etc.

On Thu, Jan 20, 2011 at 12:00 PM, rubynoob mysmilecent...@gmail.com 
wrote:
Instead of storing the count of active workers as a heroku config
variable, I decided to create a table in our database to store the
value in.
So now I've got the problem narrowed down to the last line in the
method.  Here's the block of code I've now got:

add_heroku_worker
               heroku = Heroku::Client.new(ENV['HEROKU_USERNAME'],
ENV['HEROKU_PASSWORD'])
               myapp = 
heroku.config_vars(ENV['HEROKU_APP'])[HEROKU_APP]
               worker_count = WorkerCount.find(1)  # now I'm storing 
the current
number of active workers in a table that will always only have one
record.
               workers = worker_count.workers
               qty = workers + 1
               worker_count.workers = qty
               worker_count.save
               heroku.set_workers(myapp, qty)
end

In the heroku console, this runs smoothly until I try the last line,
to which I get this error:  TypeError: can't convert
RestClient::Payload::UrlEncoded into String

This line is formatted the same as LostBoy's workless gem, the
autoscaling tree of delayed_job, and Heroku-Delayed-Job-Autoscale.  I
must be missing something obvious (typical newbie, huh?)   ;)

Thanks again for any help,
Jim

On Jan 20, 9:16 am, Peter Haza peter.h...@gmail.com wrote:
I've done autoscaling of workers
here:https://github.com/phaza/Heroku-Delayed-Job-Autoscale
It's actually more like auto-shutdown of a single workers, but it 
works well
in our environment.

--
You received this message because you are subscribed to the Google 
Groups Heroku group.
To post to this group, send email to heroku@googlegroups.com.
To unsubscribe from this group, send email to 
heroku+unsubscr...@googlegroups.com.
For more options, visit this group 
athttp://groups.google.com/group/heroku?hl=en.

--
You received this message because you are subscribed to the Google 
Groups Heroku group.
To post to this group, send email to heroku@googlegroups.com.
To unsubscribe from this group, send email to 
heroku+unsubscr...@googlegroups.com.
For more options, visit this group 
athttp://groups.google.com/group/heroku?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
Heroku group.
To post 

Re: My (flawed?) attempt to add or subtract workers via Heroku API.

2011-01-20 Thread rubynoob
Instead of storing the count of active workers as a heroku config
variable, I decided to create a table in our database to store the
value in.
So now I've got the problem narrowed down to the last line in the
method.  Here's the block of code I've now got:

add_heroku_worker
heroku = Heroku::Client.new(ENV['HEROKU_USERNAME'],
ENV['HEROKU_PASSWORD'])
myapp = heroku.config_vars(ENV['HEROKU_APP'])[HEROKU_APP]
worker_count = WorkerCount.find(1)  # now I'm storing the 
current
number of active workers in a table that will always only have one
record.
workers = worker_count.workers
qty = workers + 1
worker_count.workers = qty
worker_count.save
heroku.set_workers(myapp, qty)
end

In the heroku console, this runs smoothly until I try the last line,
to which I get this error:  TypeError: can't convert
RestClient::Payload::UrlEncoded into String

This line is formatted the same as LostBoy's workless gem, the
autoscaling tree of delayed_job, and Heroku-Delayed-Job-Autoscale.  I
must be missing something obvious (typical newbie, huh?)   ;)

Thanks again for any help,
Jim

On Jan 20, 9:16 am, Peter Haza peter.h...@gmail.com wrote:
 I've done autoscaling of workers
 here:https://github.com/phaza/Heroku-Delayed-Job-Autoscale
 It's actually more like auto-shutdown of a single workers, but it works well
 in our environment.

-- 
You received this message because you are subscribed to the Google Groups 
Heroku group.
To post to this group, send email to heroku@googlegroups.com.
To unsubscribe from this group, send email to 
heroku+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/heroku?hl=en.



Re: My (flawed?) attempt to add or subtract workers via Heroku API.

2011-01-20 Thread Peter Haza
I've done autoscaling of workers 
here: https://github.com/phaza/Heroku-Delayed-Job-Autoscale
It's actually more like auto-shutdown of a single workers, but it works well 
in our environment.

-- 
You received this message because you are subscribed to the Google Groups 
Heroku group.
To post to this group, send email to heroku@googlegroups.com.
To unsubscribe from this group, send email to 
heroku+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/heroku?hl=en.



Re: My (flawed?) attempt to add or subtract workers via Heroku API.

2011-01-20 Thread Pedro Belo
That was a good call, you definitely don't want to store variables in
config vars. Save if for constants (passwords, urls, etc).

It seems like you might be getting an error due to different versions
of RestClient, not sure though. What version are you using? What's the
stack trace for the exception?

On a side note, if it helps you can call heroku workers passing
relative values, like +3, -1, etc.

On Thu, Jan 20, 2011 at 12:00 PM, rubynoob mysmilecent...@gmail.com wrote:
 Instead of storing the count of active workers as a heroku config
 variable, I decided to create a table in our database to store the
 value in.
 So now I've got the problem narrowed down to the last line in the
 method.  Here's the block of code I've now got:

 add_heroku_worker
                heroku = Heroku::Client.new(ENV['HEROKU_USERNAME'],
 ENV['HEROKU_PASSWORD'])
                myapp = heroku.config_vars(ENV['HEROKU_APP'])[HEROKU_APP]
                worker_count = WorkerCount.find(1)  # now I'm storing the 
 current
 number of active workers in a table that will always only have one
 record.
                workers = worker_count.workers
                qty = workers + 1
                worker_count.workers = qty
                worker_count.save
                heroku.set_workers(myapp, qty)
 end

 In the heroku console, this runs smoothly until I try the last line,
 to which I get this error:  TypeError: can't convert
 RestClient::Payload::UrlEncoded into String

 This line is formatted the same as LostBoy's workless gem, the
 autoscaling tree of delayed_job, and Heroku-Delayed-Job-Autoscale.  I
 must be missing something obvious (typical newbie, huh?)   ;)

 Thanks again for any help,
 Jim

 On Jan 20, 9:16 am, Peter Haza peter.h...@gmail.com wrote:
 I've done autoscaling of workers
 here:https://github.com/phaza/Heroku-Delayed-Job-Autoscale
 It's actually more like auto-shutdown of a single workers, but it works well
 in our environment.

 --
 You received this message because you are subscribed to the Google Groups 
 Heroku group.
 To post to this group, send email to heroku@googlegroups.com.
 To unsubscribe from this group, send email to 
 heroku+unsubscr...@googlegroups.com.
 For more options, visit this group at 
 http://groups.google.com/group/heroku?hl=en.



-- 
You received this message because you are subscribed to the Google Groups 
Heroku group.
To post to this group, send email to heroku@googlegroups.com.
To unsubscribe from this group, send email to 
heroku+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/heroku?hl=en.



Re: My (flawed?) attempt to add or subtract workers via Heroku API.

2011-01-19 Thread rubynoob
Sorry, I forgot to provide some important details.  Someday I won't be
so noobish about all this stuff.  :)

I'm using Ruby 1.8.6 on Windows XP, Rails 2.3.2, heroku gem 1.15.1,
and delayed_job gem 2.0.5.

I would have tried ddollar's heroku-autoscale, but it's not ready for
production apps, and from what I've read, doesn't scale workers, only
dynos.  I tried lostboy's workless gem, but couldn't get it working
(sorry, it's been several days, and I can't remember why it didn't
work--I may try again).

Thanks.

Jim Costello

On Jan 18, 12:36 pm, rubynoob mysmilecent...@gmail.com wrote:
 I'm trying a different approach to autoscaling workers in my heroku
 app.

 I'm using a custom config variable in my heroku config I've labeled
 'WORKER_COUNT', which represents how many workers are running
 currently.  I've also added HEROKU_USERNAME, HEROKU_PASSWORD, and
 HEROKU_APP to my heroku config.

 I added require 'heroku' at the beginning of my application
 controller, and a method to add a worker and increment 'WORKER_COUNT'
 by one...:

         def add_heroku_worker
                 heroku = Heroku::Client.new(ENV['HEROKU_USERNAME'],
 ENV['HEROKU_PASSWORD'])
                 myapp = heroku(ENV['HEROKU_APP'])
                 worker_count = heroku(ENV['WORKER_COUNT'])
                 qty = worker_count + 1
                 heroku.add_config_vars(myapp, {WORKER_COUNT = qty})
                 heroku.set_workers(ENV['HEROKU_APP'], qty)
         end

 ...and another method (called 'subtract_heroku_worker') to subtract a
 worker and deprecate 'WORKER_COUNT' by one.

 I call add_heroku_worker right after delaying a job...:

         @job.delay.import(path)
         add_heroku_worker

 ...and subtract_heroku_worker right after the job sucessfully
 completes.

 Problem is, nothing seems to be happening.  I get no errors, but no
 workers, either.  I suspect either my syntax is wrong, or I'm just
 going about this the wrong way.

 Can anybody help shed some light on this?

-- 
You received this message because you are subscribed to the Google Groups 
Heroku group.
To post to this group, send email to heroku@googlegroups.com.
To unsubscribe from this group, send email to 
heroku+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/heroku?hl=en.



Re: My (flawed?) attempt to add or subtract workers via Heroku API.

2011-01-19 Thread Abel Tamayo
Kudos to you if you were really able to do what you were trying to do. It
looks like something really useful and complicated and I didn't think it
would be possible at all in production since there's only so much you can
fine tune about workers in Heroku.
Congrats!

On Wed, Jan 19, 2011 at 10:37 PM, rubynoob mysmilecent...@gmail.com wrote:

 Solving my own problem...will soon report my solution for all to see,
 FWIW.

 On Jan 19, 7:32 am, rubynoob mysmilecent...@gmail.com wrote:
  Sorry, I forgot to provide some important details.  Someday I won't be
  so noobish about all this stuff.  :)
 
  I'm using Ruby 1.8.6 on Windows XP, Rails 2.3.2, heroku gem 1.15.1,
  and delayed_job gem 2.0.5.
 
  I would have tried ddollar's heroku-autoscale, but it's not ready for
  production apps, and from what I've read, doesn't scale workers, only
  dynos.  I tried lostboy's workless gem, but couldn't get it working
  (sorry, it's been several days, and I can't remember why it didn't
  work--I may try again).
 
  Thanks.
 
  Jim Costello
 
  On Jan 18, 12:36 pm, rubynoob mysmilecent...@gmail.com wrote:
 
   I'm trying a different approach to autoscaling workers in my heroku
   app.
 
   I'm using a custom config variable in my heroku config I've labeled
   'WORKER_COUNT', which represents how many workers are running
   currently.  I've also added HEROKU_USERNAME, HEROKU_PASSWORD, and
   HEROKU_APP to my heroku config.
 
   I added require 'heroku' at the beginning of my application
   controller, and a method to add a worker and increment 'WORKER_COUNT'
   by one...:
 
   def add_heroku_worker
   heroku = Heroku::Client.new(ENV['HEROKU_USERNAME'],
   ENV['HEROKU_PASSWORD'])
   myapp = heroku(ENV['HEROKU_APP'])
   worker_count = heroku(ENV['WORKER_COUNT'])
   qty = worker_count + 1
   heroku.add_config_vars(myapp, {WORKER_COUNT = qty})
   heroku.set_workers(ENV['HEROKU_APP'], qty)
   end
 
   ...and another method (called 'subtract_heroku_worker') to subtract a
   worker and deprecate 'WORKER_COUNT' by one.
 
   I call add_heroku_worker right after delaying a job...:
 
   @job.delay.import(path)
   add_heroku_worker
 
   ...and subtract_heroku_worker right after the job sucessfully
   completes.
 
   Problem is, nothing seems to be happening.  I get no errors, but no
   workers, either.  I suspect either my syntax is wrong, or I'm just
   going about this the wrong way.
 
   Can anybody help shed some light on this?

 --
 You received this message because you are subscribed to the Google Groups
 Heroku group.
 To post to this group, send email to heroku@googlegroups.com.
 To unsubscribe from this group, send email to
 heroku+unsubscr...@googlegroups.comheroku%2bunsubscr...@googlegroups.com
 .
 For more options, visit this group at
 http://groups.google.com/group/heroku?hl=en.



-- 
You received this message because you are subscribed to the Google Groups 
Heroku group.
To post to this group, send email to heroku@googlegroups.com.
To unsubscribe from this group, send email to 
heroku+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/heroku?hl=en.



My (flawed?) attempt to add or subtract workers via Heroku API.

2011-01-18 Thread rubynoob
I'm trying a different approach to autoscaling workers in my heroku
app.

I'm using a custom config variable in my heroku config I've labeled
'WORKER_COUNT', which represents how many workers are running
currently.  I've also added HEROKU_USERNAME, HEROKU_PASSWORD, and
HEROKU_APP to my heroku config.

I added require 'heroku' at the beginning of my application
controller, and a method to add a worker and increment 'WORKER_COUNT'
by one...:

def add_heroku_worker
heroku = Heroku::Client.new(ENV['HEROKU_USERNAME'],
ENV['HEROKU_PASSWORD'])
myapp = heroku(ENV['HEROKU_APP'])
worker_count = heroku(ENV['WORKER_COUNT'])
qty = worker_count + 1
heroku.add_config_vars(myapp, {WORKER_COUNT = qty})
heroku.set_workers(ENV['HEROKU_APP'], qty)
end

...and another method (called 'subtract_heroku_worker') to subtract a
worker and deprecate 'WORKER_COUNT' by one.

I call add_heroku_worker right after delaying a job...:

@job.delay.import(path)
add_heroku_worker

...and subtract_heroku_worker right after the job sucessfully
completes.

Problem is, nothing seems to be happening.  I get no errors, but no
workers, either.  I suspect either my syntax is wrong, or I'm just
going about this the wrong way.

Can anybody help shed some light on this?

-- 
You received this message because you are subscribed to the Google Groups 
Heroku group.
To post to this group, send email to heroku@googlegroups.com.
To unsubscribe from this group, send email to 
heroku+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/heroku?hl=en.



Heroku API Hang/Authentication Problems

2008-05-30 Thread Julien Langlois

Hi,

This is in response to the API problems people have been having and
particularly in response to Adam's post at
http://blog.heroku.com/archives/2008/3/3/api_and_external_git_access/.
I hope this is not a redundant post, but it seems people are still
having problems in my brief search of the mailing list.

Anyway, onto the fix that has worked for me. My experience with this
problem is that it has something to do with being logged in via the
web browser. Every time I've had the problem with the heroku gem, I've
found that logging off in the browser will make the gem/API work
again. I couldn't say where this problem would manifest itself in the
Heroku source, but I thought everyone should know.

Again, I hope this hasn't been posted before.


Julien Langlois
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Heroku group.
To post to this group, send email to heroku@googlegroups.com
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
-~--~~~~--~~--~--~---



Re: Heroku API

2008-04-14 Thread Adam Wiggins

On Sun, Mar 30, 2008 at 12:58 PM, Mark S. [EMAIL PROTECTED] wrote:
  mbp-mark:~ mark$ heroku clone myapp
  Initialized empty Git repository in /Users/mark/myapp/.git/
  fatal: '/userapps/11544': unable to chdir or not a git archive

I think I may have fixed this.  At the very least, I figured out a way
to log when it happens, so I'll be in a better position to diagnose
next time it occurs.  Email me or post here if you bump into this (or
similar problems on clone) again.

Adam

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Heroku group.
To post to this group, send email to heroku@googlegroups.com
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
-~--~~~~--~~--~--~---



Re: Heroku API Problem

2008-03-26 Thread Kelsin

On Mar 17, 12:33 pm, shammond42 [EMAIL PROTECTED] wrote:
 fatal: '/userapps/4867':unabletochdiror not a git archive
 fatal: The remote end hung up unexpectedly
 fetch-pack from '[EMAIL PROTECTED]:cavcomcon.git' failed

I'm getting the same problem. List works fine, key is setup (had an
error with permission denied before and solved it [was just an issue
with my default key not being id_rsa]), only when I try to clone I get
that message. I have removed the .heroku folder just in case and
generated a new key as well.

Thanks,
Chris
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Heroku group.
To post to this group, send email to heroku@googlegroups.com
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
-~--~~~~--~~--~--~---