Chef Soloの実例〜CloudFoundryインストーラ [1]
この記事は1年以上前に投稿されました。情報が古い可能性がありますので、ご注意ください。
Chef Soloを用いたCloud Foundryのインストール
2012/4現在、Cloud FoundryのインストールはChef Soloを用いるようになっています。Chef Soloが使われていることを意識する場面はありませんが、このような使い方も可能という一例と言えるでしょう。
インストール対象にはUbuntu Server 10.04.3 (64bit)を用います。なお、より新しいUbuntu Server 11.10では、ruby1.8用のrakeパッケージが自動的にインストールされず、libreadline5-devパッケージが存在していないためインストールに失敗します。また、インストール全体で1時間程度の時間がかかります。
まず、手順に従いcurlパッケージをインストールし、インストールスクリプトを起動します。
cf@ubuntu:~$ sudo aptitude install curl : cf@ubuntu:~$ bash < <(curl -s -k -B https://raw.github.com/cloudfoundry/vcap/master/dev_setup/bin/vcap_dev_setup) :
まず、Opscode社のaptレポジトリからchefパッケージがインストールされます。
: deb http://apt.opscode.com/ lucid-0.10 main : 以下のパッケージが新たにインストールされます: chef irb1.8 libabstract-ruby1.8 libbunny-ruby libbunny-ruby1.8 liberubis-ruby :
次にgitパッケージがインストールされ、Cloud Foundryがgithubから取得されます。
: 以下のパッケージが新たにインストールされます: git-core libdigest-sha1-perl liberror-perl : Initialized empty Git repository in /home/cf/cloudfoundry/vcap/.git/ :
ここからがChef Soloの出番となります。chefsolo_launch.rbスクリプトによって、各種設定が行われた後にローカルに取得したCookbooksを用いてCloud Foundryのインストールが行われます。この際、必要なソフトウェアも同時にインストールが行われます。
: Installing deployment devbox, cloudfoundry home dir is /home/cf/cloudfoundry [Fri, 20 Apr 2012 11:51:06 +0900] INFO: *** Chef 0.10.8 *** [Fri, 20 Apr 2012 11:51:07 +0900] INFO: Setting the run_list to ["role[nats_server]", "role[cloudfoundry]", "role[router]", "role[ccdb]", "role[cloud_controller]", "role[health_manager]", "role[dea]", "role[uaa]", "role[uaadb]", "role[redis_node]", "role[mysql_node]", "role[mongodb_node]", "role[neo4j_node]", "role[rabbitmq_node]", "role[redis_gateway]", "role[mysql_gateway]", "role[mongodb_gateway]", "role[neo4j_gateway]", "role[rabbitmq_gateway]"] from JSON [Fri, 20 Apr 2012 11:51:07 +0900] INFO: Run List is [role[nats_server], role[cloudfoundry], role[router], role[ccdb], role[cloud_controller], role[health_manager], role[dea], role[uaa], role[uaadb], role[redis_node], role[mysql_node], role[mongodb_node], role[neo4j_node], role[rabbitmq_node], role[redis_gateway], role[mysql_gateway], role[mongodb_gateway], role[neo4j_gateway], role[rabbitmq_gateway]] [Fri, 20 Apr 2012 11:51:07 +0900] INFO: Run List expands to [deployment, essentials, ruby, nats_server, cloudfoundry, nginx, router, postgresql, ccdb, ruby::ruby18, cloud_controller, health_manager, dea, java, maven, uaa, uaadb, redis, redis::node, mysql, mysql::node, mongodb, mongodb::node, neo4j, neo4j::node, rabbitmq, rabbitmq::node, redis::gateway, mysql::gateway, mongodb::gateway, neo4j::gateway, rabbitmq::gateway] [Fri, 20 Apr 2012 11:51:07 +0900] INFO: Starting Chef Run for ubuntu [Fri, 20 Apr 2012 11:51:07 +0900] INFO: Running start handlers [Fri, 20 Apr 2012 11:51:07 +0900] INFO: Start handlers complete. : : : [Fri, 20 Apr 2012 12:35:57 +0900] INFO: Chef Run complete in 2690.027714 seconds [Fri, 20 Apr 2012 12:35:57 +0900] INFO: Running report handlers [Fri, 20 Apr 2012 12:35:57 +0900] INFO: Report handlers complete Deployment Info *************** * Status: Success * Config files: /home/cf/cloudfoundry/.deployments/devbox/config * Deployment name: devbox * Note: * If you want to run ruby/vmc please source the profile /home/cf/.cloudfoundry_deployment_profile * If you want to run cloudfoundry components by hand please source the profile /home/cf/.cloudfoundry_deployment_local * Command to run cloudfoundry: /home/cf/cloudfoundry/vcap/dev_setup/bin/vcap_dev start cf@ubuntu:~$
インストールが成功したら、指示通りにCloud Foundryを起動してみます。起動には少し時間がかかります。
cf@ubuntu:~$ source /home/cf/.cloudfoundry_deployment_profile cf@ubuntu:~$ cf@ubuntu:~$ /home/cf/cloudfoundry/vcap/dev_setup/bin/vcap_dev start Targeting deployment "devbox" with cloudfoundry home "/home/cf/cloudfoundry" Setting up cloud controller environment Using cloudfoundry config from /home/cf/cloudfoundry/.deployments/devbox/config Executing /home/cf/cloudfoundry/.deployments/devbox/deploy/rubies/ruby-1.9.2-p180/bin/ruby /home/cf/cloudfoundry/vcap/dev_setup/bin/vcap start cloud_controller uaa mysql_gateway rabbitmq_node mysql_node dea redis_gateway rabbitmq_gateway neo4j_gateway mongodb_gateway mongodb_node neo4j_node redis_node health_manager router -c /home/cf/cloudfoundry/.deployments/devbox/config -v /home/cf/cloudfoundry/vcap/bin -l /home/cf/cloudfoundry/.deployments/devbox/log cloud_controller : RUNNING uaa : RUNNING mysql_gateway : RUNNING rabbitmq_node : RUNNING mysql_node : RUNNING dea : RUNNING redis_gateway : RUNNING rabbitmq_gateway : RUNNING neo4j_gateway : RUNNING mongodb_gateway : RUNNING mongodb_node : RUNNING neo4j_node : RUNNING redis_node : RUNNING health_manager : RUNNING router : RUNNING cf@ubuntu:~$
無事に起動しました。
root 25191 0.0 0.0 27996 900 ? Ss 11:58 0:00 nginx: master process /usr/sbin/nginx www-data 25193 0.0 0.1 28792 2196 ? S 11:58 0:00 \_ nginx: worker process postgres 12274 0.0 0.3 101596 6996 ? S 12:30 0:00 /usr/lib/postgresql/8.4/bin/postgres -D /var/lib/postgresql/8.4/main -c config_file=/etc/postgresql/8.4/main/postgresql.conf postgres 12277 0.0 0.1 101720 2132 ? Ss 12:31 0:00 \_ postgres: writer process postgres 12278 0.0 0.0 101596 1732 ? Ss 12:31 0:00 \_ postgres: wal writer process postgres 12279 0.0 0.0 101868 2056 ? Ss 12:31 0:00 \_ postgres: autovacuum launcher process postgres 12280 0.0 0.0 73136 1660 ? Ss 12:31 0:00 \_ postgres: stats collector process postgres 8897 0.0 0.3 105240 7888 ? Ss 13:08 0:00 \_ postgres: root cloud_controller 192.168.122.9(33725) idle postgres 9296 0.0 0.3 105080 7756 ? Ss 13:08 0:00 \_ postgres: root cloud_controller 192.168.122.9(33851) idle root 8360 0.1 0.9 65956 19704 ? Sl 12:35 0:02 nats-server mysql 8412 0.0 1.2 189708 24716 ? Ssl 12:35 0:00 /usr/sbin/mysqld cf 8799 5.7 3.5 248680 73736 pts/0 Sl 13:08 0:04 ruby /home/cf/cloudfoundry/vcap/bin/cloud_controller -c /home/cf/cloudfoundry/.deployments/devbox/config/cloud_controller.yml cf 8816 0.8 1.1 92984 24264 pts/0 Sl 13:08 0:00 ruby /home/cf/cloudfoundry/vcap/uaa/bin/uaa -c /home/cf/cloudfoundry/.deployments/devbox/config/uaa.yml cf 8822 7.2 4.4 934308 92120 pts/0 Sl 13:08 0:04 \_ /usr/lib/jvm/java-6-openjdk/bin/java -DPID=8822 -Xmx512m -Dspring.profiles.active=postgresql -Dvarz.username=edc214724e1bacf5ac0b7d552a72e2ca -Dvarz.password=c284eb2c858a094f493c26ed8916b77e -classpath /home/cf/cloudfoundry/.deployments/devbox/deploy/maven/apache-maven-3.0.4/boot/plexus-classworlds-2.4.jar -Dclassworlds.conf=/home/cf/cloudfoundry/.deployments/devbox/deploy/maven/apache-maven-3.0.4/bin/m2.conf -Dmaven.home=/home/cf/cloudfoundry/.deployments/devbox/deploy/maven/apache-maven-3.0.4 org.codehaus.plexus.classworlds.launcher.Launcher tomcat:run -P vcap cf 8851 2.4 2.2 183772 46308 pts/0 Sl 13:08 0:01 ruby /home/cf/cloudfoundry/vcap/services/mysql/bin/mysql_gateway -c /home/cf/cloudfoundry/.deployments/devbox/config/mysql_gateway.yml cf 8871 2.8 2.3 222728 49008 pts/0 Sl 13:08 0:01 ruby /home/cf/cloudfoundry/vcap/services/rabbit/bin/rabbit_node -c /home/cf/cloudfoundry/.deployments/devbox/config/rabbitmq_node.yml cf 8917 2.8 2.3 228776 47468 pts/0 Sl 13:08 0:01 ruby /home/cf/cloudfoundry/vcap/services/mysql/bin/mysql_node -c /home/cf/cloudfoundry/.deployments/devbox/config/mysql_node.yml cf 8986 2.8 2.2 175364 45960 pts/0 Sl 13:08 0:01 ruby /home/cf/cloudfoundry/vcap/services/redis/bin/redis_gateway -c /home/cf/cloudfoundry/.deployments/devbox/config/redis_gateway.yml cf 9070 2.9 2.2 175396 45840 pts/0 Sl 13:08 0:01 ruby /home/cf/cloudfoundry/vcap/services/rabbit/bin/rabbit_gateway -c /home/cf/cloudfoundry/.deployments/devbox/config/rabbitmq_gateway.yml cf 9120 3.0 2.2 175308 45872 pts/0 Sl 13:08 0:01 ruby /home/cf/cloudfoundry/vcap/services/neo4j/bin/neo4j_gateway -c /home/cf/cloudfoundry/.deployments/devbox/config/neo4j_gateway.yml cf 9145 3.4 2.2 178720 47052 pts/0 Sl 13:08 0:01 ruby /home/cf/cloudfoundry/vcap/services/mongodb/bin/mongodb_gateway -c /home/cf/cloudfoundry/.deployments/devbox/config/mongodb_gateway.yml cf 9168 3.7 2.3 225208 49356 pts/0 Sl 13:08 0:01 ruby /home/cf/cloudfoundry/vcap/services/mongodb/bin/mongodb_node -c /home/cf/cloudfoundry/.deployments/devbox/config/mongodb_node.yml cf 9190 3.9 2.3 221548 47752 pts/0 Sl 13:08 0:01 ruby /home/cf/cloudfoundry/vcap/services/neo4j/bin/neo4j_node -c /home/cf/cloudfoundry/.deployments/devbox/config/neo4j_node.yml cf 9213 3.9 2.2 221080 47292 pts/0 Sl 13:08 0:01 ruby /home/cf/cloudfoundry/vcap/services/redis/bin/redis_node -c /home/cf/cloudfoundry/.deployments/devbox/config/redis_node.yml cf 9247 5.0 2.4 193984 51432 pts/0 Sl 13:08 0:01 ruby /home/cf/cloudfoundry/vcap/health_manager/bin/health_manager -c /home/cf/cloudfoundry/.deployments/devbox/config/health_manager.yml cf 9292 1.7 1.2 94128 24992 pts/0 Sl 13:08 0:00 ruby /home/cf/cloudfoundry/vcap/router/bin/router -c /home/cf/cloudfoundry/.deployments/devbox/config/router.yml cf@ubuntu:~$
cf@ubuntu:~$ vmc target [http://api.vcap.me] cf@ubuntu:~$ vmc info VMware's Cloud Application Platform For support visit http://support.cloudfoundry.com Target: http://api.vcap.me (v0.999) Client: v0.3.15 cf@ubuntu:~$