Reader small image

You're reading from  Cloud Foundry for Developers

Product typeBook
Published inNov 2017
Reading LevelIntermediate
PublisherPackt
ISBN-139781788391443
Edition1st Edition
Languages
Right arrow
Authors (3):
Rahul Kumar Jain
Rahul Kumar Jain
author image
Rahul Kumar Jain

Rahul Kumar has got more than 10 years of experience in the space of Data Science and Artificial Intelligence. His expertise lies in the machine learning and deep learning arena. He is known to be a seasoned professional in the area of Business Consulting and Business Problem Solving, fuelled by his proficiency in machine learning and deep learning. He has been associated with organizations such as Mercedes-Benz Research and Development (India), Fidelity Investments, Royal Bank of Scotland among others. He has accumulated a diverse exposure through industries like BFSI, telecom and automobile. Rahul has also got papers published in IIM and IISc Journals.
Read more about Rahul Kumar Jain

Rick Farmer
Rick Farmer
author image
Rick Farmer

Rick Farmer is one of the founders and a leader of the Pivotal Cloud Foundry Solutions enterprise consulting and delivery team at Pivotal. Over the last two decades, he established a track record of navigating complex organizational technology and services to deliver breathtaking results for mission-critical initiatives at over 70 of the world's most recognizable companies and government entities. Many of the engagements he has anchored have won various personal and project awards. Rick unlocks innovation and business value using Cloud Foundry to inject enterprise agility into even the most challenging environments by aligning digital transformation, technical and business opportunities. He enjoys speaking at conferences on subjects ranging from Cloud Foundry to Data Science to Digital Transformation to Agility in the Enterprise. Since 1997, Rick has surfed tropical events hitting the Texas Gulf Coast. He has a data science visualization project inducted into the Visualization Hall of Fame at the Harvard School of Engineering and Applied Sciences.
Read more about Rick Farmer

David Wu
David Wu
author image
David Wu

David Wu has been developing software for over 17 years and has in-depth software and embedded device engineering experience in financial, photographic, medical, science and technology, and cinematic/broadcast industries, from the perspective of both enterprise and product development and for various operating systems such as Windows, MacOS, and Linux. A number of these applications and products have been highly praised, internationally recognized and have won prestigious awards. Wu holds a first class honors in the bachelors of computer science at Monash University and a Ph.D. in computer engineering at RMIT, Australia. In addition to software development, he is also an expert in image processing, compression, video analytics, and forensic imaging. He currently serves as an Advisory Solutions Architect at Pivotal, an agent of change helping transform organizations with Cloud Foundry and build better software. He can be followed on Twitter @_Doc_Dave_.
Read more about David Wu

View More author details
Right arrow

Chapter 6. Deploying Apps to Cloud Foundry

In the last chapter, we had visited the concepts of architecting and building apps for Cloud. This chapter explores the deployment of apps onto Cloud Foundry. It will enable you to understand how to deploy applications and have them running on Cloud Foundry.

By the end of this chapter, you will know the following:

  • What you will need before you push an application to Cloud Foundry
  • What are buildpacks and how they are used during deployment
  • What are services and how to create them
  • How to deploy apps onto Cloud Foundry
  • How to update a deployed application
  • What happens when an app is deployed on Cloud Foundry
  • How to scale applications
  • How to access application logs
  • Using Apps Manager

Pushing your first application to Cloud Foundry


In order to have applications running on Cloud Foundry, we must first be able to deploy them on Cloud Foundry. Colloquially, push it to the cloud is what you will hear and read to denote deploying the application to the cloud. The magic command to do this is:

 cf push 

That's it! There are of course a number of parameters that you will need, such as specifying the application name and perhaps other settings that may be needed for the application to run. However, before proceeding to push an application to Cloud Foundry, there are a number of prerequisites that must be fulfilled beforehand.

What you need before you push

The important minimum prerequisites before you push an application to Cloud Foundry are:

  1. Ensure your application is supported by Cloud Foundry and/or has the necessary buildpack.
  2. Ensure your application is Cloud Ready. While this is not strictly necessary, it will make starting development on the cloud easier by preventing occurrences...

Services


In Chapter 5, Architecting and Building Applications for the Cloud, one of the necessary requirements for achieving Cloud Ready applications were backing services. A backing service, or service for short, is quite simply any networked service that an application will consume. For example, MySQLSQL Server, and S3 Blob stores for DataStoresRabbitMQ for messaging and emailing services. Note that when we say service, it corresponds to a blueprint of that service. In order for applications to use the service, we must create an instance of the service, or what we call a service instance. Once these service instances are created, an application instance can use these once they are bounded.

That is, these services are actually accessed by application code through some URL or some other form of a locator that potentially require credentials, that is, this could be some form of connection string. When this happens, we say that an application is now bounded to a service instance. For the...

Buildpacks


In order to deploy and successfully run an application on Cloud Foundry, a buildpack is required to ensure that the necessary runtime support for your application is set up, along with your application during the push. Essentially, a buildpack consists of a set of tools, potential runtime components, and scripts that are programmed to retrieve dependencies required by the application for a given language; move the compiled output to some run location, compile the code, and/or configure the application for running in the container. 

From a developer's perspective, a buildpack brings out the polyglot benefits of Cloud Foundry. It enables the development of applications using different supporting types of languages with consistent versioned dependencies. From a platform team's perspective, all dependencies are consistent throughout all environments, such as development and production. There is no need to snowflake dependency and framework setup for different development teams. 

To...

Deploying your first app onto cf using the cf CLI


We discussed buildpacks and services. We instantiated a service to use, but we need to bind it to an application that is deployed on Cloud Foundry first in order to use it. This section will now show you how to deploy the application. For demonstration purposes, this section will use the Hello Spring Cloud sample application. The Hello Spring Cloud is a simple Java web API application that uses the Spring Cloud Connectors library in order to inspect the bounded services and display their connection status. 

To deploy our first sample application, do the following steps:

  1. This project requires Maven, a tool for building and managing Java projects. If not done so already, download Maven from: https://maven.apache.org and follow the installation instructions on the site.
  2. Download or git clone the Hello Spring Cloud repository at https://github.com/Cloud-Foundry-For-Developers/hello-spring-cloud.git.
  3. If the sample application was downloaded, extract...

Monitoring and managing the applications


So far, we deployed our application onto Cloud Foundry. However, the next steps will involve steps on how we can manage and monitor our applications. This can be done in two ways, either through Apps Manager or through the cf CLI. You've already learned how to log on to Apps Manager to create Orgs, Spaces, and add users. With Apps Manager, you are also able to monitor and manage applications as well. We'll explore how to do that in this section. For possible scripting purposes, you may also take the cf CLI route to create, manage, and monitor your application. 

Monitoring and managing the application using cf CLI

Using the cf CLI is just as easy as using Apps Manager. This section will show you how key cf CLI commands are used to manage and monitor your application on Cloud Foundry. We'll split this section into two parts. The first is the monitoring of applications and the second is the management of applications.

Monitoring your application

In monitoring...

Summary


In this chapter, we deployed the first application onto Cloud Foundry. Thereafter, we visited the concepts of managing and monitoring your applications through the cf CLI and through Apps Manager. In particular, to manage our applications, we can scale it, manage routes, perform administrative tasks using cf tasks, and delete our applications. To monitor our applications, we can view the application logs by either tailing it to view the output of your applications in real-time or just view the last snapshot of what had recently occurred. In the next chapter, we'll look into building microservices.

 

 

 

lock icon
The rest of the chapter is locked
You have been reading a chapter from
Cloud Foundry for Developers
Published in: Nov 2017Publisher: PacktISBN-13: 9781788391443
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
undefined
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime

Authors (3)

author image
Rahul Kumar Jain

Rahul Kumar has got more than 10 years of experience in the space of Data Science and Artificial Intelligence. His expertise lies in the machine learning and deep learning arena. He is known to be a seasoned professional in the area of Business Consulting and Business Problem Solving, fuelled by his proficiency in machine learning and deep learning. He has been associated with organizations such as Mercedes-Benz Research and Development (India), Fidelity Investments, Royal Bank of Scotland among others. He has accumulated a diverse exposure through industries like BFSI, telecom and automobile. Rahul has also got papers published in IIM and IISc Journals.
Read more about Rahul Kumar Jain

author image
Rick Farmer

Rick Farmer is one of the founders and a leader of the Pivotal Cloud Foundry Solutions enterprise consulting and delivery team at Pivotal. Over the last two decades, he established a track record of navigating complex organizational technology and services to deliver breathtaking results for mission-critical initiatives at over 70 of the world's most recognizable companies and government entities. Many of the engagements he has anchored have won various personal and project awards. Rick unlocks innovation and business value using Cloud Foundry to inject enterprise agility into even the most challenging environments by aligning digital transformation, technical and business opportunities. He enjoys speaking at conferences on subjects ranging from Cloud Foundry to Data Science to Digital Transformation to Agility in the Enterprise. Since 1997, Rick has surfed tropical events hitting the Texas Gulf Coast. He has a data science visualization project inducted into the Visualization Hall of Fame at the Harvard School of Engineering and Applied Sciences.
Read more about Rick Farmer

author image
David Wu

David Wu has been developing software for over 17 years and has in-depth software and embedded device engineering experience in financial, photographic, medical, science and technology, and cinematic/broadcast industries, from the perspective of both enterprise and product development and for various operating systems such as Windows, MacOS, and Linux. A number of these applications and products have been highly praised, internationally recognized and have won prestigious awards. Wu holds a first class honors in the bachelors of computer science at Monash University and a Ph.D. in computer engineering at RMIT, Australia. In addition to software development, he is also an expert in image processing, compression, video analytics, and forensic imaging. He currently serves as an Advisory Solutions Architect at Pivotal, an agent of change helping transform organizations with Cloud Foundry and build better software. He can be followed on Twitter @_Doc_Dave_.
Read more about David Wu