-
If you haven’t already, download the latest release of the Cloud Foundry CLI from https://github.com/cloudfoundry/cli/releases for your operating system and install it.
-
Set the API target for the CLI: (set appropriate end point for your environment)
$ cf api https://api.pcf.centurylinkcloud.com --skip-ssl-validation
-
Login to Pivotal Cloudfoundry:
$ cf login
Follow the prompts
-
Change to the nodejs-cf-sample-ap sample application directory:
$ cd $BOOTCAMP_HOME/nodejs-cf-sample-app
-
Push the application!
$ cf push
You should see output similar to the following listing. Take a look at the listing callouts for a play-by-play of what’s happening:
Using manifest file /Users/phopper/workspace/NBCU-PCF-Workshop-101/nodejs-cf-sample-app/manifest.yml (1) Creating app nodejs in org TELCO / space hopper as [email protected]... OK (2) Creating route nodejs-portless-lummox.vert.fe.gopivotal.com... OK (3) Binding nodejs-portless-lummox.vert.fe.gopivotal.com to nodejs... OK (4) Uploading nodejs... (5) Uploading app files from: /Users/phopper/workspace/NBCU-PCF-Workshop-101/nodejs-cf-sample-app Uploading 259K, 39 files Done uploading OK Starting app nodejs in org TELCO / space hopper as [email protected]... (6) -----> Downloaded app package (296K) -------> Buildpack version 1.2.1 -----> Resetting git environment -----> Requested node range: 0.10.x -----> Resolved node version: 0.10.38 -----> Downloading and installing node -----> Installing dependencies (7) npm WARN engine [email protected]: wanted: {"node":">=0.10.40"} (current: {"node":"0.10.38","npm":"1.4.28"}) npm WARN engine [email protected]: wanted: {"node":">=0.10.40"} (current: {"node":"0.10.38","npm":"1.4.28"}) npm WARN engine [email protected]: wanted: {"node":">=0.10.40"} (current: {"node":"0.10.38","npm":"1.4.28"}) npm WARN engine [email protected]: wanted: {"node":">=0.10.40"} (current: {"node":"0.10.38","npm":"1.4.28"}) npm WARN engine [email protected]: wanted: {"node":">=0.10.40"} (current: {"node":"0.10.38","npm":"1.4.28"}) npm WARN engine [email protected]: wanted: {"node":">=0.10.40"} (current: {"node":"0.10.38","npm":"1.4.28"}) > [email protected] prepublish /tmp/staged/app > bower install bower open-sans-fontface#~1.0.4 not-cached git://github.com/FontFaceKit/open-sans.git#~1.0.4 bower open-sans-fontface#~1.0.4 resolve git://github.com/FontFaceKit/open-sans.git#~1.0.4 bower open-sans-fontface#~1.0.4 download https://github.com/FontFaceKit/open-sans/archive/1.0.4.tar.gz bower open-sans-fontface#~1.0.4 extract archive.tar.gz bower open-sans-fontface#~1.0.4 resolved git://github.com/FontFaceKit/open-sans.git#1.0.4 bower open-sans-fontface#~1.0.4 install open-sans-fontface#1.0.4 open-sans-fontface#1.0.4 bower_components/open-sans-fontface [email protected] node_modules/express (8) ├── [email protected] ├── [email protected] ├── [email protected] ├── [email protected] ├── [email protected] ├── [email protected] ├── [email protected] ├── [email protected] ├── [email protected] ├── [email protected] ├── [email protected] ├── [email protected] ├── [email protected] ├── [email protected] ├── [email protected] ├── [email protected] ├── [email protected] ├── [email protected] ([email protected]) ├── [email protected] ([email protected]) ├── [email protected] ([email protected], [email protected], [email protected]) ├── [email protected] ([email protected]) ├── [email protected] ([email protected], [email protected]) ├── [email protected] ([email protected], [email protected]) └── [email protected] ([email protected], [email protected]) [email protected] node_modules/jade (9) ├── [email protected] ├── [email protected] ├── [email protected] ├── [email protected] ([email protected]) ├── [email protected] ([email protected], [email protected]) ├── [email protected] ([email protected]) ├── [email protected] ([email protected], [email protected]) ├── [email protected] ([email protected], [email protected], [email protected]) ├── [email protected] ([email protected], [email protected], [email protected], [email protected]) └── [email protected] ([email protected], [email protected]) [email protected] node_modules/bower (10) ├── [email protected] ├── [email protected] ├── [email protected] ├── [email protected] ├── [email protected] ├── [email protected] ├── [email protected] ├── [email protected] ├── [email protected] ├── [email protected] ├── [email protected] ├── [email protected] ├── [email protected] ├── [email protected] ├── [email protected] ├── [email protected] ├── [email protected] ([email protected]) ├── [email protected] ├── [email protected] ([email protected]) ├── [email protected] ([email protected], [email protected], [email protected], [email protected]) ├── [email protected] ├── [email protected] ([email protected]) ├── [email protected] ([email protected], [email protected], [email protected], [email protected], [email protected]) ├── [email protected] ([email protected]) ├── [email protected] ([email protected]) ├── [email protected] ([email protected]) ├── [email protected] ([email protected], [email protected], [email protected]) ├── [email protected] ([email protected], [email protected]) ├── [email protected] ([email protected], [email protected], [email protected], [email protected]) ├── [email protected] ([email protected], [email protected]) ├── [email protected] ([email protected], [email protected]) ├── [email protected] ([email protected]) ├── [email protected] ([email protected], [email protected], [email protected], [email protected]) ├── [email protected] ([email protected], [email protected], [email protected], [email protected]) ├── [email protected] ([email protected]) ├── [email protected] ([email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected]) ├── [email protected] ([email protected], [email protected]) ├── [email protected] ([email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected]) ├── [email protected] ├── [email protected] ([email protected], [email protected], [email protected], [email protected]) ├── [email protected] ([email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected]) ├── [email protected] ([email protected], [email protected]) ├── [email protected] ([email protected], [email protected], [email protected], [email protected], [email protected]) └── [email protected] ([email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected]) [email protected] node_modules/less-middleware ├── [email protected] ([email protected]) ├── [email protected] ([email protected]) └── [email protected] ([email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected]) -----> Caching node_modules directory for future builds -----> Cleaning up node-gyp and npm artifacts -----> No Procfile found; Adding npm start to new Procfile -----> Building runtime environment -----> Uploading droplet (17M) (11) 1 of 1 instances running App started OK App nodejs was started using this command `npm start` (12) Showing health and status for app nodejs in org TELCO / space hopper as [email protected]... (13) OK requested state: started instances: 1/1 usage: 128M x 1 instances urls: nodejs-portless-lummox.vert.fe.gopivotal.com last uploaded: Thu Sep 24 18:59:26 UTC 2015 stack: cflinuxfs2 buildpack: Node.js state since cpu memory disk details #0 running 2015-09-24 01:00:18 PM 0.0% 73.9M of 128M 91.2M of 1G
-
The CLI is using a manifest to provide necessary configuration details such as application name, memory to be allocated, and path to the application artifact. Take a look at
manifest.yml
to see how. -
In most cases, the CLI indicates each Cloud Foundry API call as it happens. In this case, the CLI has created an application record for Workshop in your assigned space.
-
All HTTP/HTTPS requests to applications will flow through Cloud Foundry’s front-end router called (Go)Router. Here the CLI is creating a route with random word tokens inserted (again, see
manifest.yml
for a hint!) to prevent route collisions across the defaultdevcloudwest.inbcu.com
domain. -
Now the CLI is binding the created route to the application. Routes can actually be bound to multiple applications to support techniques such as blue-green deployments.
-
The CLI finally uploads the application bits to Pivotal Cloud Foundry. Notice that it’s uploading 39 files! This is because Cloud Foundry actually explodes a ZIP artifact before uploading it for caching purposes.
-
Now we begin the staging process.
-
Node and NPM dependenices are pulled from git hub, normally they would be pulled from Cloud Foundry, this is specific to Node.
-
Here we see the version of the '[email protected] node_modules/express' that has been chosen and installed.
-
Here we see the version of the '[email protected] node_modules/jade' that has been chosen and installed.
-
Here we see the version of the '[email protected] node_modules/bower' that has been chosen and installed.
-
The complete package of your application and all of its necessary runtime components is called a droplet. Here the droplet is being uploaded to Pivotal Cloudfoundry’s internal blobstore so that it can be easily copied to one or more Droplet Execution Agents (DEA’s) for execution.
-
The CLI tells you exactly what command and argument set was used to start your application.
-
Finally the CLI reports the current status of your application’s health.
-
-
Visit the application in your browser by hitting the route that was generated by the CLI:
-
Get information about the currently deployed application using CLI apps command:
$ cf apps
Note the application name for next steps
-
Get information about running instances, memory, CPU, and other statistics using CLI instances command
$ cf app <<app_name>>
-
Stop the deployed application using the CLI
$ cf stop <<app_name>>
-
Delete the deployed application using the CLI
$ cf delete <<app_name>>