Deploy » 履歴 » バージョン 2
Yuumi Yoshida, 2015-05-25 23:16
| 1 | 1 | Yuumi Yoshida | h1. Deploy |
|---|---|---|---|
| 2 | |||
| 3 | |||
| 4 | 2 | Yuumi Yoshida | このページのURL *http://goo.gl/S0mYkB* |
| 5 | |||
| 6 | 1 | Yuumi Yoshida | h2. 手順 |
| 7 | |||
| 8 | 多少手順がかわる事があります、当日一緒に操作して行きましょう。 |
||
| 9 | |||
| 10 | h4. 0. SSHキーの作成 |
||
| 11 | |||
| 12 | 既にあれば1. へ |
||
| 13 | |||
| 14 | <pre> |
||
| 15 | $ ls -al ~/.ssh # SSHキーの確認 |
||
| 16 | $ ssh-keygen |
||
| 17 | # キー入力がありますが全てENTER |
||
| 18 | </pre> |
||
| 19 | |||
| 20 | |||
| 21 | h4. 1. Herokuにアカウントを作成 |
||
| 22 | |||
| 23 | # https://www.heroku.com のSign Upで登録 |
||
| 24 | # Heroku Toolbelt をダウンロードしインストール |
||
| 25 | |||
| 26 | h4. 2. Heroku にログイン |
||
| 27 | |||
| 28 | <pre> |
||
| 29 | $ heroku login |
||
| 30 | Enter your Heroku credentials. |
||
| 31 | Email: 登録したメールアドレス |
||
| 32 | Password (typing will be hidden): 登録したパスワード |
||
| 33 | Authentication successful. |
||
| 34 | </pre> |
||
| 35 | |||
| 36 | |||
| 37 | h4. 3. Procfileを作成 |
||
| 38 | |||
| 39 | Herokuサーバー上で実行するコマンドを書きます |
||
| 40 | |||
| 41 | <pre> |
||
| 42 | web: bundle exec ruby jyanken.rb -p $PORT |
||
| 43 | </pre> |
||
| 44 | |||
| 45 | 実行するプログラムの名前が *jyanken.rb* でない場合は自分のプログラム名に変更 |
||
| 46 | |||
| 47 | h4. 4. Git にコードを格納 |
||
| 48 | |||
| 49 | <pre> |
||
| 50 | $ git init |
||
| 51 | $ git add アプリのファイル Gemfile Gemfile.lock Procfile |
||
| 52 | $ git commit -m 'for deploy' |
||
| 53 | </pre> |
||
| 54 | |||
| 55 | h4. 5. アプリ用サーバーを作成 |
||
| 56 | |||
| 57 | <pre> |
||
| 58 | $ heroku create |
||
| 59 | </pre> |
||
| 60 | |||
| 61 | h4. 6. Herokuにデプロイ |
||
| 62 | |||
| 63 | <pre> |
||
| 64 | $ git push heroku master |
||
| 65 | </pre> |
||
| 66 | |||
| 67 | h4. 7. 成功したら、ブラウザーからアプリにアクセス |
||
| 68 | |||
| 69 | <pre> |
||
| 70 | $ heroku open |
||
| 71 | </pre> |