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. |
-
Review the Apps Manager Documentation. Knowing where to go for help is essential.
-
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). -
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.If you do not see this dialog, the same information can be found under
Tools
(Left side). -
Download and install the
cf
CLI for your platform. -
Open a terminal window. Explore the
cf
CLI. In the terminal window typecf
.cf
-
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
-
Continue to follow directions for logging in with the
cf
CLI. You can copy and paste thecf 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. -
Review your current API endpoint, user, org, and space
cf target
2.3. Pushing apps
Next we will push (deploy) several applications.
-
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. -
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.
-
Open a terminal window. First
cd
into thenode
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
-
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 usecurl
:Example:curl {{application_url}}
The output should be a simple
Hello node
message. -
Repeat steps 3 - 4 for the
php
,python
, andruby
applications.Make sure you cd
into each directory before pushing.
2.3.1. Questions
-
What are some common items in the output that occurred when pushing each application?
2.4. Explore Apps Manager
-
Review the following views:
-
Org
-
Space
-
App
-
2.5. Clean up
-
Delete the applications you just pushed.
This is very important for resource constrained environments.
cf delete node
Repeat for
php
,python
, andruby
applications.
3. Beyond the class
Check out the Cloud Foundry sample applications.
Spring Music is a favorite.