Gangmax Blog

A Bite of Cloud Foundry

Refer here.

  1. Sign up at “www.cloudfoundry.com“;

  2. Install “vmc” gem in your local environment;

  3. Use the follow commands to test if your account can log in properly:

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    $ vmc target api.cloudfoundry.com
    Successfully targeted to [http://api.cloudfoundry.com]

    $ vmc login
    Attempting login to [http://api.cloudfoundry.com]
    Email: xxxxxxx@abc.com
    Password: **********
    Successfully logged into [http://api.cloudfoundry.com]

    $ vmc info
    VMware's Cloud Application Platform
    For support visit http://support.cloudfoundry.com

    Target: http://api.cloudfoundry.com (v0.999)
    Client: v0.3.17

    User: acnova@163.com
    Usage: Memory (64.0M of 2.0G total)
    Services (1 of 16 total)
    Apps (1 of 20 total)

    $ vmc apps

    +-------------+----+---------+-----------------------------+------------+
    | Application | # | Health | URLS | Services |
    +-------------+----+---------+-----------------------------+------------+
    | cf_hello_w | 1 | RUNNING | cf_hello_w.cloudfoundry.com | mysql-ec02 |
    +-------------+----+---------+-----------------------------+------------+

    More command can be found by running “vmc help”.

  4. Create an empty directory and a “hello.rb” file in it with the following content(you may want to install sinatra locally but it’s optional):

    1
    2
    3
    4
    require 'sinatra'
    get '/' do
    'Hello from Cloud Foundry by Max!'
    end
  5. In this directory, run “vmc push”:

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    $ vmc push
    Would you like to deploy from the current directory? [Yn]: y
    Application Name: cf_hello_w
    Application Deployed URL [cf_hello_w.cloudfoundry.com]:
    Detected a Sinatra Application, is this correct? [Yn]: y
    Memory Reservation (64M, 128M, 256M, 512M, 1G, 2G) [128M]: 64M
    Creating Application: OK
    Would you like to bind any services to 'cf_hello_w'? [yN]: y
    The following system services are available
    1: mongodb
    2: mysql
    3: postgresql
    4: rabbitmq
    5: redis
    Please select one you wish to provision: 2
    Specify the name of the service [mysql-ec02]:
    Creating Service: OK
    Binding Service [mysql-ec02]: OK
    Uploading Application:
    Checking for available resources: OK
    Packing application: OK
    Uploading (0K): OK
    Push Status: OK
    Staging Application: OK
    Starting Application: OK

Comments