プログラミング学習日記

プログラミング学習時のメモ帳。

herokuチュートリアル7

間違っている場所あったら優しく教えてね

herokuチュートリアル7

herokuチュートリアル

$ heroku ps
Free dyno hours quota remaining this month: 550h 0m (100%)
Free dyno usage for this app: 0h 0m (0%)
For more information on dyno sleeping and how to upgrade, see:
https://devcenter.heroku.com/articles/dyno-sleeping

=== web (Free): gunicorn gettingstarted.wsgi --log-file - (1)
web.1: idle 2019/03/25 11:36:03 +0900 (~ 12m ago)

これはheroku上のdynosがいくつ動いているかを調べるコマンド.
デフォルト(初期状態)ではfree dynosとなる.

free dynosの特徴
  1. 30分間動かないとスリープ状態になる
  2. スリープ状態から復帰後は数秒間の遅れが出る(その後の実行には支障なし)
  3. dynoがwebから要求を受けたら再びactiveになる.ここ

free dyno pool

  1. 1カ月に550時間までactiveモードにできる.
  2. クレジットカード認証すると追加で450時間の計1000時間の使用が可能になる
  3. free状態の80%を使ってしまうとメールが届くよ(次にお知らせが来るのは100%)
  4. Scaleを下げるなどの対策をして解決しよう

ここを見ると今月何時間分使ったかを見ることができる.

  • sleeping状態にしないためには
    Dyno Typeを変更することでできる. が, 普通に何も考えズニfree Typeを使うのが無難そう

チュートリアルに戻る

$ heroku ps:scale web=0
Scaling dynos... done, now running web at 0:Free
$ heroku ps
Free dyno hours quota remaining this month: 550h 0m (100%)
Free dyno usage for this app: 0h 0m (0%)
For more information on dyno sleeping and how to upgrade, see:
https://devcenter.heroku.com/articles/dyno-sleeping

No dynos on ⬢ intense-falls-78460

scaleを0にするとsleep状態に陥ります

$ heroku ps:scale web=1
Scaling dynos... done, now running web at 1:Free
$ heroku ps
Free dyno hours quota remaining this month: 550h 0m (100%)
Free dyno usage for this app: 0h 0m (0%)
For more information on dyno sleeping and how to upgrade, see:
https://devcenter.heroku.com/articles/dyno-sleeping

=== web (Free): gunicorn gettingstarted.wsgi --log-file - (1)
web.1: up 2019/03/25 12:38:41 +0900 (~ 3s ago)

もう一度Scaleを1にすると ==web~~の部分nで動いていることがわかります.

sleepにするやり方はわかりました

ブログを見ていただきありがとうございました