20. hiroaki@HMP:~/demo$ cd hello/
hiroaki@HMP:~/demo/hello$ ls
Staticfile index.html manifest.yml
hiroaki@HMP:~/demo/hello$ cf push
Using manifest file /Users/hiroaki/demo/hello/manifest.yml
Creating app staticapp in org ukaji_org / space ukaji_space as ukaji...
OK
:
:
:
:
:
App started
OK
App staticapp was started using this command `sh boot.sh`
Showing health and status for app staticapp in org ukaji_org / space ukaji_space as ukaji...
OK
requested state: started
instances: 1/1
usage: 256M x 1 instances
urls: staticapp.mcf.nttlabs.info
last uploaded: Mon Aug 8 02:36:03 UTC 2016
stack: unknown
buildpack: staticfile 1.3.9
state since cpu memory disk details
#0 running 2016-08-08 11:36:17 AM 0.0% 0 of 256M 0 of 1G
hiroaki@HMP:~/demo/hello$ curl staticapp.mcf.nttlabs.info
(´・_・`)
Client
Load
Balancer
CF
Router
App
CF
まずは Backend のアプリをデプロイ
21. hiroaki@HMP:~/demo/hello$ cd ../s-rs/
hiroaki@HMP:~/demo/s-rs$ ls
Godeps Procfile README.md main.go manifest.yml
hiroaki@HMP:~/demo/s-rs$ cf push
:
:
:
:
:
requested state: started
instances: 1/1
usage: 256M x 1 instances
urls: simple-rs.mcf.nttlabs.info
last uploaded: Mon Aug 8 04:19:13 UTC 2016
stack: unknown
buildpack: go_buildpack
state since cpu memory disk details
#0 running 2016-08-08 01:19:32 PM 0.0% 0 of 256M 0 of 1G
hiroaki@HMP:~/demo/s-rs$ cf create-user-provided-service simplerouteservice
-r https://simple-rs.mcf.nttlabs.info
Creating user provided service simplerouteservice in org ukaji_org / space ukaji_space as ukaji...
OK
hiroaki@HMP:~/demo/s-rs$ cf services
Getting services in org ukaji_org / space ukaji_space as ukaji...
OK
name service plan bound apps last operation
simplerouteservice user-provided
Route Service として使う HTTP サーバをデプロイ。(※)
その後 HTTP サーバを Service として認識させる。
※ HTTPS で到達できる場所ならばどこでも構いませんが、
今回はたまたま Cloud Foundry 上に同居させています。
Client
Load
Balancer
CF
Router
App
CF
Route
Service
22. hiroaki@HMP:~/demo/s-rs$ cf bind-route-service mcf.nttlabs.info simplerouteservice -n staticapp
Binding route staticapp.mcf.nttlabs.info to service instance simplerouteservice in org ukaji_org / space
ukaji_space as ukaji...
OK
hiroaki@HMP:~/demo/s-rs$ curl staticapp.mcf.nttlabs.info
(´・_・`) Route Service としてバインドすれば完成。
Client
Load
Balancer
CF
Router
App
CF
Route
Service
hiroaki@HMP:~$ cf logs simple-rs
Connected, tailing logs for app simple-rs in org ukaji_org / space ukaji_space as ukaji...
2016-08-08T13:36:58.24+0900 [RTR/0] OUT simple-rs.mcf.nttlabs.info - [08/08/2016:04:36:58.238 +0000]
"GET / HTTP/1.0" 200 0 13 "-" "curl/7.43.0" 192.168.12.34:35667 x_forwarded_for:"192.168.10.40,
192.168.12.34, 192.168.13.51" x_forwarded_proto:"https"
vcap_request_id:ab5cfd36-1548-4f95-7fb2-8c9fc7dc3262 response_time:0.008521804 app_id:2b11f3ec-d733-48e2-
b141-5ac98020eee3
何も処理をしていないので振る舞いは変わりませんが、
Route Service のアプリのログを見てみると何らかの HTTP
アクセスが飛んでいることが分かるはず。