如何通过平台API添加和删除Heroku Dynos [英] How to add and remove Heroku Dynos through platform API
问题描述
我想通过平台API添加和删除Heroku Dynos就像我们一样
I want to add and remove Heroku Dynos through platform API Just like we do
ps:scale web=0
在Heroku工具带CLI中.
in Heroku toolbelt CLI.
我已经尝试过
POST /apps/{app_id_or_name}/dynos/{dyno_id_or_name}/actions/stop
但是它什么也没做,但是响应的状态码为200.
but it doesn't do anything however the response has a status code of 200.
推荐答案
按照此问题中概述的dyno stop ps:stop
行为:
As per the dyno stop ps:stop
behavior outlined in this question:
ps:stop 将自动重新启动.在Private Spaces中, ps:stop
将终止并替换运行dyno的专用实例.要永久停止测功,请按比例缩小该过程."
Running ps:stop
on dynos that are part of a scaled process will automatically be restarted. In Private Spaces, ps:stop
will terminate and replace the dedicated instance running the dyno(s). To permanently stop dynos, scale down the process."
To scale down the dynos to 0 through the Platform API, you'll need to use formation API.
形成列表:
GET /apps/{app_id_or_name}/formation
$ curl -n https://api.heroku.com/apps/$APP_ID_OR_NAME/formation \
-H "Accept: application/vnd.heroku+json; version=3"
表格更新:
PATCH /apps/{app_id_or_name}/formation/{formation_id_or_type}
$ curl -n -X PATCH https://api.heroku.com/apps/$APP_ID_OR_NAME/formation/$FORMATION_ID_OR_TYPE \
-d '{
"quantity": 1,
"size": "standard-1X"
}' \
-H "Content-Type: application/json" \
-H "Accept: application/vnd.heroku+json; version=3"
发送 quantity = 0 作为参数会将dyno进程缩放为零.
Sending quantity = 0 as a parameter will scale the dyno process to zero.
这篇关于如何通过平台API添加和删除Heroku Dynos的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!