Pivotal Cloud Foundry
What is Cloud Foundry?
Cloud foundry is an open source platform as service offering provided by pivotal
Let’s discuss what is platform as service offering?
We have several cloud platform like Google cloud, Amazon Cloud and Spring Cloud and pivotal Cloud where we can deploy our micro services Or any application but each cloud factory have their own patterns to configure, deploy, managing etc.
So each of them offering service us to deploy application.
So let’s see what are the service they providing and how they categorized, normally it divided in 3 types
1. Infrastructure
2. Platform
3. Software
So discuss one by one. As per architecture normally we required few support to deploy our application in any environment
1. Application 2. Data 3. Runtime 4. Middleware 5. Operating system 6. Virtualization 7. Servers 8. Storage 9. Networking
Now let’s see what each service offering
Infrastructure Service Offering
1. Application 2. Data 3. Runtime 4. Middleware 5. Operating system 6. Virtualization 7. Servers 8. Storage 9. Networking
Infrastructure provides only green mark fields Rest all we need to manually configure in that cloud environment
Like: workspace, runtime environment and API related configure that we need to do manually
The Best Example is AWS (Amazon Web service) if any one worked on AWS they marked everything we need to set there like Virtual box
Platform Service Offering
1. Application 2. Data 3. Runtime 4. Middleware 5. Operating system 6. Virtualization 7. Servers 8. Storage 9. Networking
Platform provides only green mark fields Rest all we need to manually configure in that cloud environment
So here you need to bother about only your application set up and data set rest all inbuilt by platform service provider like you can choose your own platform like java, python or any tech they have multi environment supports
The best Example is GCP and Pivotal Cloud Foundry and Cloud Foundry have to great support to Our Spring Cloud
Software Service Offering
1. Application 2. Data 3. Runtime 4. Middleware 5. Operating system 6. Virtualization 7. Servers 8. Storage 9. Networking
Software service provides all the required environment Best Example is Google docs
So now in this article am going to explain Platform Offering Service that with Pivotal Cloud Foundry So what we need to manage for this only our application and data. Rest all will provide by Cloud Foundry
Before Start with application let’s Set up the environment to work on Cloud Foundry
Steps:
1. Install CF-CLI (Cloud Foundry Command Line Interface from below link https://docs.cloudfoundry.org/cf-cli/install-go-cli.html
2. Create one Account in Pivotal Cloud Foundry it is free for trial up to 2 GB from below link
https://account.run.pivotal.io/z/uaa/sign-up
Remember your email id and password for further used
3. Now Sign in using email and password which you entered while create account
click on Pivotal Web Service 4. Then It will ask you to Add Development Environment name , so mention I mentioned BasantJava like below
As I already deployed one small application for testing purpose it showing APPS as 1, but when you initially open it should be 0 with full 2GB space like above image
5. Now Environment is Ready let’s start to develop one small hello-world application
Application Development Steps:
1. Open Eclipse Work space then click on file >New > Spring starter project like below
2. Then mention artifactid, group id ,choose application type like war/jar and mention the package like below
3. Click next then choose dependency to add , as am doing one small hello world project so I added only Web dependency like below
4. Click on finish your project will be imported to your eclipse , just open main class who contains main method and write one method which you want to expose on server u can create one more package and you can write separate controller class am just writing it in same class as am not going to perform any business in this app
5. Writing one method who will return String message as below
6. Then run your application in locally and test whether your API is working or not
its working am getting String message with stats code 200. 7. Now Pivotal don’t know which war or jar we are going to deploy and its path and what you want the application name on server and what memory you want to occupy to deploy your application on Cloud Foundry so for that we need to inform all in Cloud foundry using yml file name should be manifest.yml like below
8.Let’s Deploy our application in Pivotal cloud foundry , so for that we need to login in Pivotal using CF-CLI Cloud Foundry Command line interface so go to the folder where you install your CLI then type command on that browser path like below
9. Then once you open command prompt type command cf login -a api.run.pivotal.io, then it will ask to enter email id and password which u used on sign up then follow that command like below
See Authentication success and login to portal it display my organization name as BasantJava
10. Then now move to your project directory and open command prompt by pointing path to your project like below
11. Then type command cf push ,it internally load your manifest.yml , from this file he will get the jar/war path then based on memory which u specified memory in yml file , same memory allocation happen on pivotal cloud foundry to deploy your application let’s run the command
see the command it build pack successfully now let’s see the metrics health of our Application in CLI
See the metrics now our application is start and deploy. 12. Now go to pivotal console and sign in again you will find your application is up and running there like below with occupy some space
see it occupy 670MB space from 2 GB , as I mention memory size in manifest.yml is 670MB 13. Now find the Application URL from development section
see the right column Route copy that URL then append your endpoint URL and hit he URL to check whether our application deploy and working successfully
14. Response:
Great we are good it’s working , This is the way we can deploy our service in Pivotal Cloud foundry , but I think you guys notice some difference between browser response and post man response , actually in post man it’s running in my local so what I did change it will reflect immediately , but I added Basant word in response latter and didn’t run maven install no new update jar available in target folder so it’s taking my old jar and same deployed .
15. Download => Source Code