通过Heroku API更改Dyno类型 [英] Change Dyno types through the Heroku API

查看:361
本文介绍了通过Heroku API更改Dyno类型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个在Heroku中运行的应用程序;我正在使用 Heroku调度程序运行一个python脚本,该脚本可以调整特定的dynos数量使用 python API (以下

  import heroku 
云= heroku.from_key(os.environ.get('HEROKU_API_KEY'))
app = cloud.apps ['myapp']
webproc = app.processes ['web']
webproc。 (1)

我的问题是:是否有API调用来改变Dyno / em>的?例如将其从标准1X改为标准2X或爱好。

谢谢

解决方案

与Heroku支持的聊天已经证实python API没有执行此操作的命令;因此,我采取了将以下脚本添加到应用程序(遵循本答案):

 #!/ bin / bash 

curl -s https://s3.amazonaws.com/assets.heroku.com/heroku -client / heroku-client.tgz | tar xz
mv heroku-client / *。
rmdir heroku-client
PATH =bin:$ PATH

heroku dyno:type hobby --app MYAPP

hobby 改为 standard-1x standard-2x 根据需要。


I have an app running in Heroku; I'm using the Heroku scheduler to run a python script that scales the number of dynos at particular times of the day, using the python API (following this answer):

import heroku
cloud = heroku.from_key(os.environ.get('HEROKU_API_KEY'))
app = cloud.apps['myapp']
webproc = app.processes['web']
webproc.scale(1)

My question is: is there an API call to change Dyno types? For instance to change it from "standard 1X" to "standard 2X" or to "hobby".

Thanks

解决方案

A chat with the Heroku support has confirmed that the python API has no command to perform this operation; I have therefore resorted to add the following script to the app (following this answer):

#!/bin/bash

curl -s https://s3.amazonaws.com/assets.heroku.com/heroku-client/heroku-client.tgz | tar xz
mv heroku-client/* .
rmdir heroku-client
PATH="bin:$PATH"

heroku dyno:type hobby --app MYAPP

Changing hobby with standard-1x or standard-2x as needed.

这篇关于通过Heroku API更改Dyno类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆