Estimated Time: 25 minutes

1. Preface

This lab incorporates many preliminary steps. You’ll be learning about and accessing the "Apps Manager" for the first time. You’ll download and install the cf command line tool (the CLI), and use it to login to a Pivotal Cloud Foundry instance. You’ll also learn about the concept of the cf target.

You’ll deploy your first set of simple applications to cloudfoundry with the cf push command.

Although this lab is an introduction to Pivotal Cloud Foundry, you’ll learn a great deal in a fairly short span of time. Enjoy.

2. Exercises

2.1. Download the cf CLI

Endpoint and credential information for accessing Apps Manager will be provided by your instructor. Apps Manager is a web application that helps you manage your applications, but it is also the place to download the cf CLI. The next set of steps walk you through just that.

If you are consuming these materials via e-learning and using Pivotal Web Services you can login to Apps Manager here. If you are using a Pivotal Cloud Foundry instance please see your system administrators for access to Apps Manager.
  1. Review the Apps Manager Documentation. Knowing where to go for help is essential.

  2. Login into Pivotal Cloud Foundry with the Apps Manager. If using Pivotal Web Services (PWS), the url is: https://console.run.pivotal.io/

    It is common to use self signed certs in educational environments, but doing so will result in warnings from your browser. These warnings can safely be ignored (proceed through them).
  3. Upon logging into Apps Manager for the first time you will be greeted with a welcome message that will walk you through the installation of the cf CLI.

    Get Started

    If you do not see this dialog, the same information can be found under Tools (Left side).

  4. Download and install the cf CLI for your platform.

  5. Open a terminal window. Explore the cf CLI. In the terminal window type cf.

    cf
  6. Review the commands available with the cf CLI. Help on a specific command can be found using the --help option (e.g. cf login --help).

    cf login --help

2.2. Login to Pivotal Cloud Foundry with the cf CLI

  1. Continue to follow directions for logging in with the cf CLI. You can copy and paste the cf login command directly from Apps Manager.

    cf login -a {{api_endpoint}}
    Are SSL errors preventing you from logging in? Try adding the --skip-ssl-validation option.
  2. Review your current API endpoint, user, org, and space

    cf target
What Just Happened?

You have logged into Pivotal Cloud Foundry from two different clients (Apps Manager and the cf CLI). You have installed the cf CLI and targeted a Pivotal Cloud Foundry instance. You are ready to push apps.

2.3. Pushing apps

Next we will push (deploy) several applications.

  1. Download the demo applications. Copy the file to folder: ~/pivotal-cloud-foundry-developer-workshop (~ is shorthand for the home directory in Linux, Mac and Unix based operating systems). You will need to create this directory in your home directory.

  2. Extract the zip file to ~/pivotal-cloud-foundry-developer-workshop/demo-apps.

    The zip file contains four directories; each directory contains an application developed in a different language.

  3. Open a terminal window. First cd into the node directory:

    cd ~/pivotal-cloud-foundry-developer-workshop/demo-apps/node

    The CloudFoundry push command assumes that the artifacts for your application are located in the current working directory.

    Now push the node application:

    cf push node --random-route -m 128M
  4. First, let’s find out what our application url is, with the cf apps command:

    cf apps

    Now, visit the node application in your browser, or use curl:

    Example:
    curl {{application_url}}

    The output should be a simple Hello node message.

  5. Repeat steps 3 - 4 for the php, python, and ruby applications.

    Make sure you cd into each directory before pushing.
What Just Happened?

You just deployed four applications each based on a different language and runtime. Pivotal Cloud Foundry is a polyglot platform, meaning it supports multiple languages and does so in a pluggable way (via buildpacks)!

2.3.1. Questions

  • What are some common items in the output that occurred when pushing each application?

2.4. Explore Apps Manager

  1. Review the following views:

    • Org

    • Space

    • App

What Just Happened?

You have interfaced with Pivotal Cloud Foudry from two separate clients (cf and Apps Manager). Many of the operations that are available in cf CLI are also available in Apps Manager.

2.5. Clean up

  1. Delete the applications you just pushed.

    This is very important for resource constrained environments.

    cf delete node

    Repeat for php, python, and ruby applications.

3. Beyond the class

Check out the Cloud Foundry sample applications.

Spring Music is a favorite.