Wednesday, 4 May 2016

IBM Bluemix : Planning Cloud Applications - Part 6

f. Use the Cloud Foundry CLI (cf) tool to manage applications in IBM Bluemix PaaS

1. Specify the region through api endpoint

The region may be set using either the cf api <API_URL> or by using the –a <API_URL> option to the login command where <API_URL> is the API endpoint of the desired region.

2. Log in to an organization and space using cf

Command syntax for cf login:

cf login [-a API_URL] [-u USERNAME] [-p PASSWORD] [-o ORG] [-s SPACE]

Where API_URL is the API endpoint of the desired region, USERNAME is the user, PASSWORD is the specified user’s password, ORG is the organization name and SPACE is the space. Any needed argument not provided on the command line will be prompted. For example you may provide the password interactively at the terminal by omitting the –p option on the command line.

3. Push an application using cf and understand applicable options

Command and syntax to push an application:

cf push APP [-b URL] [-c COMMAND] [-d DOMAIN] [-i NUM_INSTANCES] [-m MEMORY] [-n
HOST] [-p PATH] [-s STACK] [--no-hostname] [--no-route] [--no-start]

Where APP is the application name. This command should be run in the top level directory containing the application and a copy of the manifest.yml file. Some common options in a push are the -c to specify a startup command, -i to specify number of instances at startup, -m to specify memory used by the application instance at startup, and --no-route to prevent connecting a route to the application.

4. View logging information using cf
To view logs from an application use:

cf logs APP [--recent]

Where APP is the application name. When the --recent option is specified, the most recent log history is sent to the terminal and the command ends. If specified without this option, the command streams log output to the terminal.

5. Perform scaling (instance, memory, disk) of an application using cf

The cf scale command may be used to perform horizontal or vertical scaling. For horizontal scaling by increasing the number of instances, use:

cf scale APP -i INSTANCES

Where APP is the application name and INSTANCES is the desired number of running instances.
For vertical scaling by increasing memory capacity, use:

cf scale APP -m MEMORY

Where APP is the application name and MEMORY is an integer followed either an M, for megabytes, or G, for gigabytes.
For vertical scaling by increasing disk space for instances of the application, use:

cf scale APP -k DISK

Where APP is the application name and DISK is an integer followed by either an M, for megabytes, or G, for gigabytes.

6. cf commands for managing domains, routes, organization and spaces

Reference: http://docs.cloudfoundry.org/devguide/installcf/whats-new-v6.html#domains-etc

0 comments:

Post a Comment

Popular Posts

Powered by Blogger.

Recent Comments

Contact Form

Name

Email *

Message *

Followers