Application Manifest usage in Cloud Foundry

In previous post we have seen how to create a sample application and push it into Cloud Foundry and access the application by using Cloud Foundry Route. The current post we will learn about the Manifest.yml usage in cloud foundry applications.
Manifests are ways to describe and deploy application seamlessly to cloud foundry environment. Basically, using Manifest.yml file we can describe how to push our application. In this process, we need to define application name, how much memory that our application required and services that we need to bind and environment variables..etc in manifest file. There is a huge list of alternatives and benefits for any cloud application that uses manifest.

When we try to push our application by using CF PUSH command, it will try to identify manifest.yml file in same directory, that we are trying to push the application. Once it identifies, that process the properties defined and uses to start the application.  If CF PUSH doesn’t find the manifest file, CF push tries to identify what application it’s trying to push. In this process, since it doesn’t find any yml manifest properties,  Cloud Foundry applies default values for all required fields like name, memory & services etc.

We can even provide external Manifest.yml file to CF PUSH by using -F argument. This argument simply tell to Cloud Foundry, go and find wherever it is exists manifest.yml. Once it is located, then it follows the processing as mentioned previously.

If we are going in the way of manifest, there are few mandatory fields which we need to provide,

  • application name
  • application memory
  • buildpack
Buildpack simply indicate cloud foundry about the environment that application should run on. So if we have a java application, then we should provide a java buildpack.

Manifest.yml files are really helpful for CI/CD. Using a standard way with Manifest.yml, we can make our application run anywhere. Even if we changes or migrate the Cloud environment, we have already have configuration in the Manifest.yml that we need to run our application. So, no need to worry about changes after the environment migration.

Manifest.yml files are designed in a way that we can define more than one application inside it. So, assume that we have group of applications in a space. Then defining these applications configuration and pushing into Cloud Foundry is very simple. We can add all manifest properties inside a file and we can push into Cloud Foundry and it is only one time creation and we can use wherever we need. If we need to new service, just we can configure the service in Manifest.yml and redeploy.

Summary:

  • Describe Application Deployment
  • CF tried to find Manifest.yml in same directory
  • External manifest can be provided
  • There are required and optional fileds
  • Very useful for CI/CD process
  • Define more than one application in single Manigest.yml
  • Simplest way to deal with CF Application
We can see default properties of application considered by Cloud foundry while starting the app.
name:              cfgreet
requested state:   started
routes:            cfgreet.cfapps.io
last uploaded:     Wed 03 Oct 18:17:54 IST 2018
stack:             cflinuxfs2
buildpacks:        client-certificate-mapper=1.8.0_RELEASE container-security-provider=1.16.0_RELEASE
                   java-buildpack=v4.16-offline-https://github.com/cloudfoundry/java-buildpack.git#41b8ff8
                   java-main java-opts java-security jvmkill-agent=1.16.0_RELEASE open-jdk-…
type:            web
instances:       1/1
memory usage:    1024M
start command:   JAVA_OPTS=”-agentpath:”

How to create manifest.yml?

Cloud Foundry provides the command called create-app-manifest to create manifest.yml file for your application. It will contains all the application information including services which are bind to application. Command syntax look like,

cf create-app-manifest  -p

Below is the sample manifest file look like,

manifest.yml:

applications:
- name: cfcloudgreet
path: target/CFGreet-0.0.1-SNAPSHOT.jar
buildpack: https://github.com/cloudfoundry/java-buildpack.git
memory: 1G

While pushing the application into cloud foundry we need to provide the path of the manifest file. So, we no need to pass all the properties in command line.

Previous: Create Service Instance in PCF

Next: Internal Process of Application Deployment in Cloud Foundry

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s