Change Dyno types through the Heroku API

对着背影说爱祢 提交于 2020-01-15 10:04:50

问题


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


回答1:


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.



来源:https://stackoverflow.com/questions/39122456/change-dyno-types-through-the-heroku-api

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!