2016年2月2日火曜日

遅まきのHerokuデビューを無料枠でしたよ。準備編〜その2

このエントリーをはてなブックマークに追加
さて昨日の遅まきのHerokuデビューを無料枠でしたよ。準備編〜その1からの続き。

さてHeroku上にアプリケーションを作成する。

Deploy the app

In this step you will deploy the app to Heroku.
Create an app on Heroku, which prepares Heroku to receive your source code:
$ heroku create
Creating sharp-rain-871... done, stack is cedar-14
http://sharp-rain-871.herokuapp.com/ | https://git.heroku.com/sharp-rain-871.git
Git remote heroku added
When you create an app, a git remote (called heroku) is also created and associated with your local git repository.
Heroku generates a random name (in this case sharp-rain-871) for your app, or you can pass a parameter to specify your own app name.

この後、GitHubから取ってきたソースをHerokuにデプロイしていくようだ。ローカルのgitリポジトリからHerokuのリモートリポジトリへアップする。なんかいっぱい入った。

$ git push heroku master
Counting objects: 140, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (75/75), done.
Writing objects: 100% (140/140), 28.30 KiB | 0 bytes/s, done.
Total 140 (delta 51), reused 140 (delta 51)
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> PHP app detected
remote: -----> Bootstrapping...
remote: -----> Installing system packages...
remote:        NOTICE: No runtime required in composer.json; requirements
remote:        from dependencies in composer.lock will be used for selection
remote:        - php (7.0.2)
remote:        - Apache (2.4.16)
remote:        - Nginx (1.8.0)
remote: -----> Enabling PHP extensions...
remote:        - ext-zend-opcache (automatic)
remote: -----> Installing dependencies...
remote:        Composer version 1.0.0-alpha11 2015-11-14 16:21:07
remote:        Loading composer repositories with package information
remote:        Installing dependencies from lock file
remote:          - Installing psr/log (1.0.0)
remote:            Downloading: 100%
remote:
remote:          - Installing monolog/monolog (1.16.0)
remote:            Downloading: 100%
remote:
remote:          - Installing symfony/routing (v2.7.3)
remote:            Downloading: 100%
remote:
remote:          - Installing symfony/http-foundation (v2.7.3)
remote:            Downloading: 100%
remote:
remote:          - Installing symfony/event-dispatcher (v2.7.3)
remote:            Downloading: 100%
remote:
remote:          - Installing symfony/debug (v2.7.3)
remote:            Downloading: 100%
remote:
remote:          - Installing symfony/http-kernel (v2.7.3)
remote:            Downloading: 100%
remote:
remote:          - Installing pimple/pimple (v1.1.1)
remote:            Downloading: 100%
remote:
remote:          - Installing silex/silex (v1.3.1)
remote:            Downloading: 100%
remote:
remote:          - Installing twig/twig (v1.19.0)
remote:            Downloading: 100%
remote:
remote:          - Installing symfony/twig-bridge (v2.7.3)
remote:            Downloading: 100%
remote:
remote:        Generating optimized autoload files
remote: -----> Preparing runtime environment...
remote: -----> Checking for additional extensions to install...
remote: -----> Discovering process types
remote:        Procfile declares types -> web
remote:
remote: -----> Compressing...
remote:        Done: 83.6M
remote: -----> Launching...
remote:        Released v3
remote:        https://dry-springs-12517.herokuapp.com/ deployed to Heroku
remote:
remote: Verifying deploy.... done.
To https://git.heroku.com/dry-springs-12517.git
 * [new branch]      master -> master

ここでwebインスタンスを1つ動かす。

The application is now deployed. Ensure that at least one instance of the app is running:
$ heroku ps:scale web=1

これでサイトの準備ができたので、下記のコマンドでデプロイされたアプリがブラウザで確認できる。
Now visit the app at the URL generated by its app name. As a handy shortcut, you can open the website as follows:
$ heroku open

できた!


起動させた時のログはheroku logsを使う。
$ heroku logs
2016-02-01T15:47:23.734744+00:00 heroku[api]: Enable Logplex by xxx@example.com
2016-02-01T15:47:23.734926+00:00 heroku[api]: Release v2 created by xxx@example.com
2016-02-01T15:58:25.346315+00:00 heroku[api]: Scale to web=1 by xxx@example.com
2016-02-01T15:58:25.441370+00:00 heroku[api]: Deploy b6e3898 by xxx@example.com
2016-02-01T15:58:25.441432+00:00 heroku[api]: Release v3 created by xxx@example.com
2016-02-01T15:58:25.818992+00:00 heroku[slug-compiler]: Slug compilation started
2016-02-01T15:58:25.818998+00:00 heroku[slug-compiler]: Slug compilation finished
2016-02-01T15:58:30.607022+00:00 heroku[web.1]: Starting process with command `vendor/bin/heroku-php-apache2 web/`
2016-02-01T15:58:33.451421+00:00 app[web.1]: 4 processes at 128MB memory limit.
2016-02-01T15:58:33.246369+00:00 app[web.1]: DOCUMENT_ROOT changed to 'web/'
2016-02-01T15:58:33.457058+00:00 app[web.1]: Starting php-fpm...
2016-02-01T15:58:33.289875+00:00 app[web.1]: Optimizing defaults for 1X dyno...
2016-02-01T15:58:35.463051+00:00 app[web.1]: Starting httpd...
2016-02-01T15:58:36.118632+00:00 heroku[web.1]: State changed from starting to up
2016-02-01T16:31:55.317376+00:00 heroku[web.1]: Idling
2016-02-01T16:31:55.318091+00:00 heroku[web.1]: State changed from up to down
2016-02-01T16:31:57.921272+00:00 heroku[web.1]: Stopping all processes with SIGTERM
2016-02-01T16:31:58.417151+00:00 app[web.1]: Going down, terminating child processes...
2016-02-01T16:31:59.165323+00:00 heroku[web.1]: Process exited with status 143
2016-02-01T16:56:47.735067+00:00 heroku[web.1]: Unidling
2016-02-01T16:56:47.735426+00:00 heroku[web.1]: State changed from down to starting
2016-02-01T16:56:53.261661+00:00 heroku[web.1]: Starting process with command `vendor/bin/heroku-php-apache2 web/`
2016-02-01T16:56:55.081581+00:00 app[web.1]: 4 processes at 128MB memory limit.
2016-02-01T16:56:54.967333+00:00 app[web.1]: DOCUMENT_ROOT changed to 'web/'
2016-02-01T16:56:54.980799+00:00 app[web.1]: Optimizing defaults for 1X dyno...
2016-02-01T16:56:55.085368+00:00 app[web.1]: Starting php-fpm...
2016-02-01T16:56:57.086777+00:00 app[web.1]: Starting httpd...
2016-02-01T16:56:57.159387+00:00 heroku[web.1]: State changed from starting to up

WEBワーカを止めるにはheroku ps:scale web=0で行う。

$ heroku ps:scale web=0
2016-02-01T18:14:22.506008+00:00 heroku[run.2596]: State changed from up to complete
2016-02-01T18:14:22.519362+00:00 heroku[run.2596]: Process exited with status 0
2016-02-01T18:21:32.196197+00:00 heroku[api]: Scale to web=0

0 件のコメント:

コメントを投稿