Skip to main content

Pushing an App to Cloud Foundry

Hands-On Lab

 

Photo of Travis Thomsen

Travis Thomsen

Course Development Director in Content

Length

01:00:00

Difficulty

Beginner

In this Live Environment, you will learn the basic commands to push your applications to Pivotal Cloud Foundry. You will be taking on the role of a developer who is pushing their first app to Cloud Foundry. Once the application is deployed and verified to be working, you will go through the deprovisioning process and delete the app.

What are Hands-On Labs?

Hands-On Labs are scenario-based learning environments where learners can practice without consequences. Don't compromise a system or waste money on expensive downloads. Practice real-world skills without the real-world risk, no assembly required.

Pushing an App to Cloud Foundry

Introduction

In this Live Environment, you will learn the basic commands to push your applications to Pivotal Cloud Foundry. You will be taking on the role of a developer who is pushing their first app to Cloud Foundry. Once the application is deployed and verified to be working, you will go through the deprovisioning process and delete the app.

Solution

A Pivotal Cloud Foundry account is necessary to proceed with this activity. Go to http://run.pivotal.io/ to sign up for an account.

Log Into Pivotal Cloud Foundry

  1. Begin by logging in to the lab server using the credentials provided on the hands-on lab page:

    ssh cloud_user@PUBLIC_IP_ADDRESS
  2. Log in as root.

    sudo su -
  3. Connect to Cloud Foundry.

    cf login -a api.run.pivotal.io
  4. Enter your credentials for your Cloud Foundry account.

  5. Verify there are no current resources.

    cf apps

Deploy an Application to Cloud Foundry

  1. Clone the sample application from Git.

    git clone https://github.com/linuxacademy/content-hello-ruby.git
  2. Navigate to the application directory.

    cd content-hello-ruby/
  3. Push the application to Cloud Foundry.

    cf push hello-ruby -m 256m -k 256m --random-route
  4. Verify the appication has deployed.

    1. Highlight the address indicated by the routes: field.

    2. Copy the address.

    3. Open a browser and paste the address to verify the application.

Delete an Application From Cloud Foundry

  1. Retreive a list of the applications.

    cf apps
  2. Delete the application.

    cf delete hello-ruby
  3. Confirm the application has been deleted.

    cf apps

Conclusion

Congratulations — you've completed this hands-on lab!