7. cf devプラグインの用意
1. network.pivotal.ioから上記バージョンの実行ファイルをダウンロード
PCF Dev -> Releases -> 最新版を選択(下記では、v0.23.0*のOS Xを想定)
2. ダウンロードされたファイルを解凍して実行
a. unzip pcfdev-v0.23.0+PCF1.9.0-osx.zip
b. ./pcfdev-v0.23.0+PCF1.9.0-osx
以下の出力が出たら完了
Plugin successfully installed. Current version: 0.23.0. For more info run: cf dev help
3. インストールの実施
a. 次のスライド
※ 2017/1/27にv0.24.0が出ました!
8. cf dev startコマンドからのインストール
cf dev startコマンドの実行のみ
a. cf dev start
i. 通常構成
ii. トータルメモリの半分のアサイン、物理コア数、redisとrabbitmq
# 約10分ほど我慢...
a. cf dev start -m 3072 -s none
i. 最小構成(最低の3GBのアサイン)
ii. サービスはMySQLのみ
b. cf dev start -s all
i. ゴージャス構成
ii. Spring Cloud Service含めサービスは全て立ち上がる
9. しばらくお待ちください...
$ cf dev start -m 3072 -s none
Downloading VM...
Progress: |====================>| 100%
VM downloaded.
Allocating 3072 MB out of 16384 MB total system memory (6414 MB free).
Importing VM…
Starting VM...
Provisioning VM...
Waiting for services to start…
8 out of 49 running
8 out of 49 running
8 out of 49 running
34 out of 49 running
49 out of 49 running
_______ _______ _______ ______ _______ __ __
| || || | | | | || | | |
| _ || || ___| | _ || ___|| |_| |
| |_| || || |___ | | | || |___ | |
| ___|| _|| ___| | |_| || ___|| |
| | | |_ | | | || |___ | |
|___| |_______||___| |______| |_______| |___|
is now running.
To begin using PCF Dev, please run:
cf login -a https://api.local.pcfdev.io --skip-ssl-validation
Apps Manager URL: https://local.pcfdev.io
Admin user => Email: admin / Password: admin
Regular user => Email: user / Password: pass
<- 5分経過
<- 7分経過
<- 8分経過
<- 11分経過
<- 12分経過
<- 13分経過
<- 14分30秒経過
<- 15分経過
環境に依存だが、15分くらい我慢が必要
10. (Option) ovaファイルからのインストール
1. バージョンの確認
$ cf dev version
PCF Dev version 0.23.0 (CLI: 474b3ba, OVA: 0.436.0)
2. network.pivotal.ioから上記バージョンのovaファイルをダウンロード
PCF Dev -> Releases -> internal -> pcfdev-v0.436.0.ova
3. インポート
$ cf dev import ~/Downloads/pcfdev-v0.436.0.ova
OVA version 0.436.0 imported successfully.
# $PCFDEV_HOME(通常は~/.pcfdev/ova/)に格納
# cf devのバージョンと一致しない場合はエラー
FAILED
Error: specified OVA version does not match the expected OVA version (0.436.0) for this version of the cf CLI plugin.
11. PCFDevの構成変更
cf dev startコマンドにて構成変更flag description
-c number-of-cores Specify the number of processor cores used by VM. Default: Number of physical cores.
-d domain Specify the domain that the PCF Dev VM will occupy.
-i ip-address Specify the IP address that the PCF Dev VM will occupy.
-k Import VM certificates into host’s trusted certificate store.
-m memory-in-mb Specify memory to allocate for VM. Default: Half of total memory, with a maximum of 4 GB, or 8 GB with SCS.
-r registry1,registry2,... Specify Docker registries that PCF Dev will use without SSL validation. Use host:port format.
-s service1,service2 Specify the services started with PCF Dev.
Options: redis, rabbitmq, spring-cloud-services (scs), default, all, none
Default: redis, rabbitmq
(MySQL is always available and cannot be disabled.)
-t Specify to perform cf login to PCF Dev after starting, as the ‘user’ user.
cf dev startコマンドのオプション
12. CPU/Memoryの指定
• CPUの変更
$ cf dev start -c “コア数の指定”
# デフォルトでは物理コア数を指定
• メモリの変更
$ cf dev start -m “メモリサイズ(MB)の指定”
# デフォルトでは3GBから4GBを指定
$ cf dev start -m 6144
Less than 6144 MB of free memory detected, continue (y/N): >
15. PCF Devへのアクセス
• 以下のいずれでもログインが可能
– cf dev start -t
– cf dev target
– cf login -a https://api.local.pcfdev.io --skip-ssl-validation -u user
• あとは、cfコマンドを利用して操作
– cf push
自分で作る場合
- mkdir phpdemo; cd phpdemo
- echo “<?php phpinfo() ?>” > index.php
- cf push phpdemo
サンプルを利用する場合
- git clone https://github.com/cloudfoundry-community/simple-go-web-app
- cd simple-go-web-app
- cf push simple-go
https://github.com/cloudfoundry-samples
https://github.com/cloudfoundry-community
16. PCF Devで利用可能なサービス
• 利用可能なサービスとそのサービスプランの表示
– MySQLとLocal Volume(beta)のサービスは固定
– Redis, RabbitMQは、Spring Cloud Serviceは任意で設定
$ cf m
Getting services from marketplace in org pcfdev-org / space pcfdev-space as user...
OK
service plans description
local-volume free-local-disk Local service docs: https://github.com/cloudfoundry-incubator/local-volume-release/
p-mysql 512mb, 1gb MySQL databases on demand
TIP: Use 'cf marketplace -s SERVICE' to view descriptions of individual plans of a given service.
$ cf m -s p-mysql
Getting service plan information for service p-mysql as user...
OK
service plan description free or paid
512mb PCF Dev MySQL Server free
1gb PCF Dev MySQL Server free
cf marketplace
17. サービスの切り出し(インスタンス化)
• アプリケーションに割り当てる、サービスのインスタンスを
作成
– cf marketplaceより確認出来るプラン(Plan)を指定、アプリに提供するサ
ービス内容を決める
– プランによって、データベースのサイズや、サポートするコネクショ
ン数などが決まる
$ cf create-service p-mysql 512mb mydb
Creating service instance mydb in org pcfdev-org / space pcfdev-space as user...
OK
$ cf services
Getting services in org pcfdev-org / space pcfdev-space as user...
OK
name service plan bound apps last operation
mydb p-mysql 512mb create succeeded
cf create-service
18. サービス(インスタンス)の割り当て
• アプリケーションにサービスインスタンスを割り当てる
– アプリケーションは割り当てられたサービスを利用可能
– 実際にはアクセス情報を提供(VCAP_SERVICES)
– cf restageコマンドにより環境変数への反映を有効化
$ cf bind-service spring-music mydb
Binding service mydb to app spring-music in org pcfdev-org / space pcfdev-space as user...
OK
TIP: Use 'cf restage spring-music' to ensure your env variable changes take effect
$ cf services
Getting services in org pcfdev-org / space pcfdev-space as user...
OK
name service plan bound apps last operation
mydb p-mysql 512mb spring-music create succeeded
cf bind-service
19. カスタムサービスのインスタンス作成
• マーケットプレイスに存在しないサービスのインスタン
ス作成が可能
– cf create-serviceはマーケットプレイスにあるサービスを対象
– アプリケーションへの割り当ては、cf bind-serviceで同様に可能
– Laptopで動くデータベースなどの活用が可能(後述)
$ cf create-user-provided-service mydb-cusp -p '{"username":"user","password":"pass"}'
Creating user provided service mydb-cusp in org pcfdev-org / space pcfdev-space as user...
OK
$ cf services
Getting services in org pcfdev-org / space pcfdev-space as user...
OK
name service plan bound apps last operation
mydb p-mysql 512mb spring-music create succeeded
mydb-cusp user-provided
cf create-user-provided-services
27. 起動しているCFのプロセス(monit summary)
Process 'gorouter' running
Process 'garden' running
Process 'file_server' running
Process 'etcd' running
Process 'etcd_consistency_checker' running
Process 'doppler' running
Process 'consul_agent' running
Process 'cloud_controller_worker_1' running
Process 'cloud_controller_ng' running
Process 'cloud_controller_worker_local_1' running
Process 'cloud_controller_worker_local_2' running
Process 'nginx_cc' running
Process 'cloud_controller_clock' running
Process 'cf-mysql-broker' running
Process 'cf-mysql-route-registrar' running
Process 'quota-enforcer' running
Process 'cc_uploader' running
Process 'blobstore_nginx' running
Process 'blobstore_url_signer' running
Process 'bbs' running
Process 'auctioneer' running
System 'system_localhost' running
# monit summary
The Monit daemon 5.2.5 uptime:
Process 'pcfdev-api' running
Process 'pcfdev-nginx' running
Process 'uaa' running
Process 'tps_listener' running
Process 'tps_watcher' running
Process 'tcp_emitter' running
Process 'syslog_drain_binder' running
Process 'syslog-configurator' running
Process 'stager' running
Process 'ssh_proxy' running
Process 'routing-api' running
Process 'route_registrar' running
Process 'router_configurer' running
Process 'route_emitter' running
Process 'rep' running
Process 'nsync_listener' running
Process 'nsync_bulker' running
Process 'nats' running
Process 'mariadb_ctrl' running
Process 'galera-healthcheck' running
Process 'gra-log-purger-executable' running
Process 'cluster_health_logger' running
Process 'metron_agent' running
Process 'loggregator_trafficcontroller' running
Process 'localdriver' running
Process 'localbroker' running
Process 'haproxy' running