【发布时间】:2012-08-23 15:07:16
【问题描述】:
是否有 Heroku API 允许我以编程方式放大和缩小我的测功机等?
我找到了 API 文档的链接,但它似乎不再存在。
谢谢
【问题讨论】:
标签: ruby-on-rails-3 node.js heroku
是否有 Heroku API 允许我以编程方式放大和缩小我的测功机等?
我找到了 API 文档的链接,但它似乎不再存在。
谢谢
【问题讨论】:
标签: ruby-on-rails-3 node.js heroku
This link 此时适用于 API。对于自动缩放,我们使用hirefire。这是一项托管服务,比同名的open source gem 功能稍强。
【讨论】:
Heroku gem 允许您轻松添加和删除进程。
宝石“heroku”
您可以在 ruby 中创建一个客户端,可以设置工人或测功机的数量等
client = Heroku::Client.new(username, password)
client.list # provides a list of heroku apps
client.info(app) # provides info on the particular app, including dynos and workers
client.workers(app) # returns the number of workers currently running for the app
client.set_workers(app, qty) # sets the number of workers for the app
client.dynos(app) # returns the number of dynos currently running for the app
client.set_dynos(app, qty) # sets the number of dynos
基本上,您可以从命令行执行的任何操作,都可以使用 gem 执行。
结帐https://github.com/heroku/heroku/blob/master/lib/heroku/client.rb了解详情。
【讨论】:
现在看来 Heroku::Client 已被弃用。 heroku-api gem 有你需要的能力。 https://github.com/heroku/heroku.rb
【讨论】:
我不确定是否有任何记录,但 heroku gem 本身通过 REST 与他们的 API 对话,因此您可以在其中达到顶峰。
有一些适用于 Heroku 的自动缩放 gem,我还看到了其他示例,其中您将 Heroku gem 包含到自己的应用程序中,以便能够与其 API 交互,而无需过多参与其中。
【讨论】: