19. デプロイ
↓
$ cd YOUR_APPS_DIR
$ mvn package
$ cd target # Java Webの場合,*.warのあるディレクトリ
$ vmc push
Would you like to deploy from the current directory? [Yn]:
Application Name: javawebmeetscf
Detected a Java Web Application, is this correct? [Yn]:
Application Deployed URL [javawebmeetscf.cloudfoundry.com]:
Memory reservation (128M, 256M, 512M, 1G, 2G) [512M]:
How many instances? [1]:
Bind existing services to 'javawebmeetscf'? [yN]:
Create services to bind to 'javawebmeetscf'? [yN]:
Would you like to save this configuration? [yN]:
↓
19
20. 起動完了
↓
Creating Application: OK
Uploading Application:
Checking for available resources: OK
Packing application: OK
Uploading (5K): OK
Push Status: OK
Staging Application 'javawebmeetscf': OK
Starting Application 'javawebmeetscf': OK
$ vmc apps
+----------------+----+---------+---------------------------------+----------+
| Application | # | Health | URLS | Services |
+----------------+----+---------+---------------------------------+----------+
| javawebmeetscf | 1 | RUNNING | javawebmeetscf.cloudfoundry.com | |
+----------------+----+---------+---------------------------------+----------+
20
41. サービス一覧を表示
$ vmc services
============== System Services ==============
+------------+---------+---------------------------------------+
| Service | Version | Description |
+------------+---------+---------------------------------------+
| mongodb | 1.8 | MongoDB NoSQL store |
| mysql | 5.1 | MySQL database service |
| postgresql | 9.0 | PostgreSQL database service (vFabric) |
| rabbitmq | 2.4 | RabbitMQ message queue |
| redis | 2.2 | Redis key-value store service |
+------------+---------+---------------------------------------+
=========== Provisioned Services ============
+----------------+---------+
| Name | Service |
+----------------+---------+
| mysql-e8ccf | mysql |
| tekito-service | mongodb |
+----------------+---------+
41
42. サービスとの接続
$ gem install caldecott # ない場合
$ vmc tunnel
1: mongodb-794fd
2: postgresql-454d
3: postgresql-611ee
4: redis-47609
Which service to tunnel to?: 1
Deploying tunnel application 'caldecott'. # 初回だけ
(snip.)
Getting tunnel connection info: OK
Service connection info:
username : 3be0e520-11ed-4af1-b005-c078bcec2da2
password : 4de480b9-75e9-4105-9784-6fb50391cd5b
name : db
↓
42
43. mongodump
↓
Starting tunnel to tekito-service on port 10001.
1: none
2: mongodump
3: mongo
4: mongorestore
Which client would you like to start?: 2
Launching 'mongodump --host localhost --port 10001 -u 20f75687-7917-4c3b-b2a7-
54d3443342f4 -p 96bdd18e-e125-4f9c-b74a-64130ab65d24 --db db'
connected to: localhost:10001
DATABASE: db to dump/db
db.system.users to dump/db/system.users.bson
3 objects
db.system.indexes to dump/db/system.indexes.bson
1 objects
krmtn@kcf-workspace:~$ ls
system.indexes.bson system.users.bson 43
44. mongorestore
Starting tunnel to tekito-service on port 10001.
1: none
2: mongorestore
3: mongodump
4: mongo
Which client would you like to start?: 2
Directory or filename to restore from: dump/db
Launching 'mongorestore --host localhost --port 10001 -u 20f75687-7917-4c3b-
b2a7-54d3443342f4 -p 96bdd18e-e125-4f9c-b74a-64130ab65d24 --db db dump/db'
connected to: localhost:10001
Thu May 24 21:11:14 dump/db/system.users.bson
Thu May 24 21:11:14 going into namespace [db.system.users]
3 objects found
Thu May 24 21:11:14 dump/db/system.indexes.bson
Thu May 24 21:11:14 going into namespace [db.system.indexes]
Thu May 24 21:11:14 { name: "_id_", ns: "db.system.users", key: { _id: 1 } }
1 objects found
44
45. mongo
Starting tunnel to tekito-service on port 10001.
1: none
2: mongorestore
3: mongo
4: mongodump
Which client would you like to start?: 3
Launching 'mongo --host localhost --port 10001 -u 20f75687-
7917-4c3b-b2a7-54d3443342f4 -p 96bdd18e-e125-4f9c-b74a-
64130ab65d24 db'
MongoDB shell version: 2.0.4
connecting to: localhost:10001/db
>
45
46. None (SSH接続)
Starting tunnel to tekito-service on port 10001.
1: none
2: mongorestore
3: mongodump
4: mongo
Which client would you like to start?: 1
Open another shell to run command-line clients or
use a UI tool to connect using the displayed
information.
Press Ctrl-C to exit...
46