Note: If you cannot find a topic, go to docs.rightscale.com where all RightScale documentation will soon be located. Also, feel free to Chat with us!
Home > Partners > VMware > VMware Documentation > VMware Cloud Application Platform ServerTemplate and Runbook

VMware Cloud Application Platform ServerTemplate and Runbook

Prerequisites

  • 'library' user role privilege to import a ServerTemplate from the MultiCloud Marketplace
  • 'security_manager' user role privilege to create a Security Group (if required)
  • 'actor' user role privilege to launch/terminate/manage cloud resources
  • github account with a registered public ssh key.  Required to init and update the submodules.
  • Access to create a new A Record with your DNS Provider (e.g. DNSMadeEasy)

Steps

Setup DNS Records

You will need to create an A Record for the all-in-one Server.  Select one of the supported DNS Providers (e.g. DNSMadeEasy, DynDNS, Route 53) and create the following A Record.

Example: DNSMadeEasy

screen-PreviewSampleApp-v4.png

  • Name - Include a (*) wildcard at the beginning of the subdomain you're going to create.  (e.g. *.cf)
  • IP - Create a placeholder IP address.  It must conform to standards for IP protocol.  (e.g. 1.2.3.4)  A script in the ServerTemplate will later update the A record the correct public IP address that's assigned to the instance at launch time.
  • TTL - Use a lower TTL of 300.
  • Dynamic DNS - This option must be checked otherwise the script will not be able to update the A record.


After you create the A Record, you will need to write down the Dynamic DNS identifier that was assigned to your A Record. Click the DDNS ID link and write down the Record ID Number.  (e.g. 1234123)  You will need to provide this value later on in the tutorial where you provide values for missing inputs.

Set up GitHub Account (not required anymore as per [rev 6] of the template)

If you do not have a GitHub account, you will need to create one so that you can download the Cloud Foundry public repository and submodules.

  1. Register a public ssh key with the GitHub account. 
  2. Create a Dashboard Credential with the private ssh key that's associated with the public key registered with your github account.  Go to Design -> Credentials.  Click New and create a new credential called GITHUB_PRIVATE_SSH_KEY and enter your private ssh key.  Later, you will use this credential when you define values for missing inputs.

Required Cloud Resources

In order to launch an EC2 Server, you will the following cloud resources.  If these resources are not available, you will need to create them. 

For AWS, you will need an EC2 SSH Key and EC2 Security Group with the following port permissions.  Note: You will only be able to launch a Server in the AWS region (e.g. AWS US-East) in which these resources exist.

  • TCP port 80 IP / IP Range
  • TCP port 22 IP / IP Range  (for registering users and troubleshooting purposes)

Create a Deployment

Create a new Deployment.  Later, you will add the all-in-one Server into this Deployment.  See Create a New Deployment.

Import the ServerTemplate

Go to Design -> MultiCloud Marketplace -> ServerTemplates.  Use the search tool to find and import the most recent revision of the "Cloud Foundry All-In-One (Alpha)" ServerTemplate.  A copy of the ServerTemplate will be saved in your RightScale account's local collection. (Design -> ServerTemplates)

Add a Server to the Deployment

When viewing the imported ServerTemplate, click the Add to Deployment button. 

Select the AWS region (e.g. AWS US-East) into which you will launch the Server.  Note: You must select the same region as the required cloud resources.  Fortunately, you can use the default values for most of the fields.  However, you will need to make appropriate selections for the following fields:

Note: AWS 't1.micro' EC2 instance types are not supported due to the memory requirements of the stack.

  • Deployment - Select the Deployment that you just created.
  • Nickname - Enter a nickname for the Server you're going to create.  (e.g. MyCF Stack)
  • SSH Key - Select the SSH Key that you just created.
  • Security Group  - Select the Security Group that you want to use for this Server.


For more information, see Add a Server to a Deployment.

Define Inputs

As a best practice you should define inputs that you want to be inherited by all Servers in the Deployment at the Deployment level.  There's only a couple of inputs that you'll want to purposely leave blank because you're going to define at the Server level since they are Server-specific. 

Click on the Deployment's Inputs tab.  Click Edit and provide values for the following missing Inputs.

Input Name
Input Type
Description
 CC_ADMIN_EMAIL  Text Provide the name of the admin or other users that will be set up in the cloud controller.  (e.g. user@example.com user2@example.com)
 DNS_PASSWORD  Text/Cred Provide the login password to access your DNS Records with your DNS Provider.  (e.g. mypassword)
 DNS_PROVIDER  Text Select the DNS Provider that you used to create your A Record. 
(e.g. DNSMadeEasy)
 DNS_USER  Text/Cred Provide the login username to access your DNS Records with your DNS Provider. (e.g. username)
 LOCAL_REGISTER_ONLY  Text Would you like only users connected to the Cloud Controller to be allowed to register? (e.g. true)
 MYSQL_ROOT_PASSWORD  Text Sets to root password for MySQL.  (e.g. root)
 PRIVATE_SSH_KEY  Cred Select the Credential that you created earlier for your GitHub account's private SSH Key.  (e.g. GITHUB_PRIVATE_SSH_KEY)

 

Note: Leave the CC_SUBDOMAIN and EXTERNAL_DNS_ID inputs undefined.

Click Save.

Launch the Server

You are now ready to launch the Server.  Go to the Deployment's Servers tab and click the Launch action icon next to the all-in-one Server.

An input confirmation screen will appear and show you all of the inputs that will be used to launch the Server.  There should be only two missing inputs since you defined most of them at the Deployment level.  Define values for the following missing inputs. 

Since you want to save these settings at the Server level so that future launches of the Server will also use these values, click the Save and Launch.  If you just clicked the Launch button, the values that you provided will not be saved for future launches of this Server.  If you clicked the Save and Launch button, you should see these inputs defined under the "Next" Server's Inputs tab.

Input Name
Input Type
Description
 CC_SUBDOMAIN  Text Enter the name of the url of the subdomain that you created with your DNS Provider.  (e.g. cf.example.com)  Note:  Do not include the asterisk (*).
 EXTERNAL_DNS_ID  Text Enter the DDNS ID that was assigned to the DNS A Record. (e.g. 1234123)

 

In a few minutes the Server will become operational.

Register a new user

Registration is only limited to users connected to the server when LOCAL_REGISTER_ONLY input is true

SSH into the server and run these commands to install the vmc gem, target localhost and register a user

gem install vmc --source http://gemcutter.org
vmc target localhost:9022
vmc register --email user@example.com --passwd changeme

If 'user@example.com' is defined in the CC_ADMIN_EMAIL input, it will have admin privileges. Admin users can add/delete users using the vmc command from remote systems also.

Set up the VMC Client

Install VMC Client Software

Launch a server/desktop and install the vmc gem client software. Login into the machine and run the following command:

gem install vmc --source http://gemcutter.org
Set a target for the VMC Server

Login into the instance and run the following commands:

vmc target api.cf.example.com
Log into the VMC Server as the new user
vmc login --email user@example.com --passwd changeme
List applications

View the currently installed applications

vmc apps
Get and unzip the application
wget https://rs-supportal.s3.amazonaws.com/unified_app_sinatra.zip
unzip unified_app_sinatra.zip
cd unified_app_sinatra
Push the application to the Server

In this example, we're allocating 256MB of memory to the application.  In this example, the name of the application is rs.

vmc push myapp --mem 256M --path .
   Application Deployed URL: 'myapp.cf.example.com'? 
   Detected a Sinatra Application, is this correct? [Yn]: y
   Creating Application: OK
   Would you like to bind any services to 'rs'? [yN]: y
   The following system services are available::
   1. mongodb
   2. mysql
   3. redis
   Please select one you wish to provision: 2
   Specify the name of the service [mysql-f99f]: mysql-myapp
   ...
   Starting Application: OK
List applications and stats

Check to see if the application was loaded onto the Server.  List all current applications.

vmc apps

+-------------+----+---------+----------------------------+-------------+
| Application | #  | Health  | URLS                       | Services    |
+-------------+----+---------+----------------------------+-------------+
| myapp       | 1  | RUNNING | myapp.cf.example.com       | mysql-myapp |
+-------------+----+---------+----------------------------+-------------+


vmc stats myapp

+----------+-------------+----------------+--------------+--------------+
| Instance | CPU (Cores) | Memory (limit) | Disk (limit) | Uptime       |
+----------+-------------+----------------+--------------+--------------+
| 0        | 0.4% (2)    | 19.8M (256M)   | 9.4M (2G)    | 0d:0h:1m:41s |
+----------+-------------+----------------+--------------+--------------+
Upload an updated application
sed -i -e 's/succeeded/SUCCEEDED/' public/index.html

vmc update myapp
  Uploading Application:
  Checking for available resources: OK
  Processing resources: OK
  Packing application: OK
  Uploading (4K): OK
  Push Status: OK
  Stopping Application: OK
  Staging Application: OK
  Starting Application: OK
Add and delete users

Requires admin privileges

vmc add-user --email user2@example.com --passwd example
  Creating New User: OK

vmc delete-user user2@example.com
  Deleting User: OK
Delete an application and logout
vmc delete myapp
  Provisioned service [mysql-myapp] detected, would you like to delete it? [yN]: y
  Deleting application [myapp]: OK
  Deleting service [mysql-myapp]: OK

vmc logout
  Successfully logged out of [http://api.cf.example.com]
Vmc command help
vmc help

vmc help crashlogs
  Usage: vmc crashlogs <appname>
Preview your application

If you're using the provided test application, you can test the following similarly constructed URIs.

  • http://myapp.cf.example.com
  • http://myapp.cf.example.com/appserver
  • http://myapp.cf.example.com/serverid
  • http://myapp.cf.example.com/init
  • http://myapp.cf.example.com/dbread


screen-PreviewSampleApp-v3.png

You must to post a comment.
Last modified
23:44, 16 May 2013

Tags

This page has no custom tags.

Classifications

This page has no classifications.

Announcements

None


© 2006-2014 RightScale, Inc. All rights reserved.
RightScale is a registered trademark of RightScale, Inc. All other products and services may be trademarks or servicemarks of their respective owners.