0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Heroku 使い方

Posted at

基本的なデプロイまでの流れ

node.jsのアプリ作成
git hubでリポジトリを作成→作ったアプリをpushする
push方法は別途こちらに記載あり
https://kirikko-scondcube.hatenablog.com/entry/2020/06/29/134515

heroku login

をターミナルで入力→herokuにログイン(対象のアプリのディレクトリに入っておく。もしかしたらここはディレクトリグローバルでもいいかも)

ログイン後

heroku create

でアプリ作成

git remote -v

herokuのcreateが実行されるとこのコマンドで

heroku  https://git.heroku.com/protected-garden-62703.git (fetch)
heroku  https://git.heroku.com/protected-garden-62703.git (push)
origin  https://github.com/Toshihisa-Handa/herokuTest1.git (fetch)
origin  https://github.com/Toshihisa-Handa/herokuTest1.git (push)

このように4行の記載が表示される。
heroku createをする前はoriginの二行のみが表示されるだけだが、実施後herokuの行が2つ追加される。

これを確認できたら

git push heroku master

でpushをし、

heroku open

で表示が可能

注意点

上記の方法での実施は以下サイトの流れで確認をした。
https://developer.salesforce.com/events/webinars/nodejs_heroku_0525/

この参考サイトのファイルではheroku openに成功したが、自身で作成したnodeアプリでは同様の方法でgit push heroku masterするところまでは成功したものの
heroku open をするとエラーになり以下の画面が表示された。
スクリーンショット 2020-08-09 12.37.32.png

複数ファイルを取り扱ったアプリではローカルで動いていても、上記以外の方法をさらにする or コードの記述を修正するといったことが必要かもしれない
(つづく)

アプリの作成(補足)

参考:https://qiita.com/shti_f/items/b4b5d830672d908eff4e

アプリの作成コマンド

heroku create

ちなみにcreateの後に任意でアプリ名を当てることも可能(名前を入れないとランダムでアプリ名が作成される)
任意で当てる場合は既存のアプリと名前がかぶらないようにする必要がある。

作成が終わるとヘロクのマイページに以下の画像のようにプロジェクトが作成される。

スクリーンショット 2020-08-09 10.41.23.png

作成したアプリの削除

heroku apps:destroy --app アプリ名

入力すると

  WARNING: This will delete ⬢ アプリ名 including all add-ons.
 ▸    To proceed, type アプリ名 or re-run this command with --confirm
 ▸    アプリ名

と聞かれるので、削除して問題なければアプリ名を入力してエンター
これでヘロクのマイページからもアプリが削除される。

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?