LoginSignup
2
2

More than 5 years have passed since last update.

Herokuでよく使うかもしれないコマンド

Last updated at Posted at 2015-04-03

自分の為だけのHerokuのコマンドたち。
ログインIDとパスワードを聞かれるので教えてあげる。

cd {app_directory}
heroku login

Procfileを作る。

echo 'web: node app.js' > Procfile

Express4使っている場合は、下記のようにした。

echo 'web: npm start' > Procfile

node_modulesはデプロイしない。

echo 'node_modules' > .gitignore

gitのローカルリポジトリにコミットしておく。

git init
git add .
git commit -m "Ready to deploy."

Herokuにデプロイする。
アプリケーション名を省略すると勝手に名前つけられる。

heroku create {app_name} --stack cedar
git push heroku master
heroku ps

Herokuのログを確認できるよ。

heroku logs

動作見る。

heroku open

Herokuを再起動する。

heroku restart -app {app_name}

Dyno別に再起動。

heroku restart web.1 -app {app_name}

ベーシック認証かけたいね。

heroku config:set BASIC_AUTH_USERNAME="{user}"
heroku config:set BASIC_AUTH_PASSWORD="{password}"
2
2
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
2
2