PCF Crash Course for Java, Spring and Spring Boot Developers

Image

Deploy Spring Boot REST API, Full Stack Applications and Microservices to Pivotal Cloud Foundry (PCF)

Learn PCF Fundamentals? Yes. Deploy REST API to PCF? Yes. Deploy Full Stack to PCF? Yes. Of Course. Hands-on? Of course.

Do you have ZERO experience with Pivotal Cloud Foundry (PCF)? No Problem.

Do you want to learn to Deploy Java Spring Boot Applications and Microservices to Pivotal Cloud Foundry (PCF) with an easy to learn, step by step approach?

Are you ready to learn about the cloud with Pivotal Cloud Foundry (PCF) and take the next step in your programming career?

Do you want to join 250,000+ learners having Amazing Learning Experiences with in28Minutes?

Look No Further!

Getting Started

Required Tools

Installing Guides

Troubleshooting Installations

Course Overview

Course Overview

How about learning PCF (Pivotal Cloud Foundry) deploying Spring Applications to Cloud using Pivotal Cloud Foundry?

Pivotal Cloud Foundry (PCF) provides a great cloud native platform to deploy Spring Boot Applications.

Spring Boot is the No 1 Java Framework to develop REST API and Microservices.

In this course, we deploy a variety of Spring Boot Applications to the Cloud:

This course would be a perfect first step as an introduction to PCF and the Cloud.

You will be using deploying a variety of projects to Pivotal Cloud Foundry (PCF) . These projects are created with React (Frontend Framework), Spring Boot (REST API Framework), Spring (Dependency Management), Spring Security (Authentication and Authorization - Basic and JWT), BootStrap (Styling Pages), Maven (dependencies management), Node (npm), Visual Studio Code (TypeScript IDE), Eclipse (Java IDE) and Tomcat Embedded Web Server. We will help you set up each one of these.

What you'll learn

Requirements

Who is this course for

Step By Step Details

Introduction to the Course

Getting Started with PCF - Pivotal Cloud Foundry

Deploy Java Spring Boot Hello World Rest API to PCF

Deploy Java Spring Boot Todo Web Application WAR to Pivotal Cloud Foundry

Deploy Java Spring Boot Todo Web Application with MySQL to Pivotal Cloud Foundry

Deploy Java Spring Boot React Full Stack Application to Pivotal Cloud Foundry

Getting started with CCS and CES Microservices on PCF

Using Service Registry for Spring Boot Microservices on Pivotal Cloud Foundry

Exploring Auto Scaling on Pivotal Cloud Foundry

Using Route Services with PCF and Spring Boot

Setting up Centralized Configuration

Setting up Circuit Breaker with Hystrix

Exploring More Features on PCF

Some of the commmands Executed during the course

cf --version
cf login
cf help -a
cf help login
cf login -a https://api.run.pivotal.io
cf target
cf help target
cf push hello-world-rest-api
cf push hello-world-rest-api -r hello-world-rest-api-001.cfapps.io
cf push hello-world-rest-api --random-route
cf logout
cf login -a https://api.run.pivotal.io
cf push hello-world-rest-api -p target/hello-world-rest-api.jar
cf apps
cf routes
cf map-route hello-world-rest-api-ranga-101 cfapps.io --hostname hello-world-rest-api
cf map-route hello-world-rest-api cfapps.io --hostname hello-world-rest-api-ranga-101
cf spaces
cf orgs
cf stop hello-world-rest-api
cf start hello-world-rest-api
cf restart hello-world-rest-api

cf create-app-manifest hello-world-rest-api

cf v3-droplets hello-world-rest-api
ls target/hello-world-rest-api.jar

docker run --detach --env MYSQL_ROOT_PASSWORD=dummypassword --env MYSQL_USER=todos-user --env MYSQL_PASSWORD=dummytodos --env MYSQL_DATABASE=todos --name mysql --publish 3306:3306 mysql:5.7

docker container list
docker stop 9a8dfcfa01d4
docker rm 9a8dfcfa01d4

cf services
cf help create-service 
cf v3-delete todo-web-application-mysql

cf scale currency-exchange-service -i 2

cf install-plugin ~/Downloads/autoscaler-for-pcf-cliplugin-macosx64-binary-2.0.199

cf autoscaling-apps
cf autoscaling-events currency-exchange-service
cf routes
cf events currency-conversion-service
cf events currency-exchange-service
cf disable-autoscaling currency-exchange-service
cf set-env currency-conversion-service CURRENCY_EXCHANGE_URI http://currency-exchange-service-ranga-101.cfapps.io
cf env currency-conversion-service
cf help -a
cf unset-env currency-conversion-service CURRENCY_EXCHANGE_URI

cf create-user-provided-service spring-boot-route-service -r https://spring-boot-route-service-ranga-101.cfapps.io
cf routes
cf bind-route-service cfapps.io --hostname currency-exchange-service-ranga-101 spring-boot-route-service
cf bind-route-service cfapps.io --hostname currency-conversion-service-ranga-101 spring-boot-route-service
cf unbind-route-service cfapps.io --hostname currency-exchange-service-ranga-101 spring-boot-route-service
cf unbind-route-service cfapps.io --hostname currency-conversion-service-ranga-101 spring-boot-route-service
cf stop spring-boot-route-service

cd /in28Minutes/git/config-server 
git init
git add *
git status
git commit -m "first commit"
git remote add origin https://github.com/in28minutes/config-server.git
git push -u origin master

cf create-service p-config-server trial config-server -c config-server.json

cf update-service config-server -c  '{ "count":1, "git":{  "uri":"https://github.com/in28minutes/dev-config-server-test.git", "label":"master", "searchPaths":"currency-exchange-service" }}'

cf set-env currency-conversion-service hystrix.command.default.circuitBreaker.requestVolumeThreshold 2

cf set-health-check currency-conversion-service http --endpoint /manage/health
cf set-health-check currency-conversion-service http --endpoint /manage/health-error
cf set-health-check currency-conversion-service http --endpoint /manage/health

cf set-env currency-exchange-service spring.cloud.services.registrationMethod direct
cf network-policies
cf remove-network-policy currency-conversion-service --destination-app currency-exchange-service --protocol tcp --port 8080
cf network-policies
cf unset-env currency-exchange-service spring.cloud.services.registrationMethod

cf map-route hello-world-rest-api-green cfapps.io --hostname hello-world-rest-api-ranga-101
cf unmap-route hello-world-rest-api cfapps.io --hostname hello-world-rest-api-ranga-101

Diagrams

digraph architecture {
rankdir = TB;
node[shape=component]
Git[shape=cylinder]
{rank=same; CurrencyConversionService, CurrencyExchangeService};
CurrencyExchangeService -> SpringCloudConfigServer;
CurrencyConversionService -> SpringCloudConfigServer;
SpringCloudConfigServer -> Git

}

digraph architecture {
rankdir = TB;
node[shape=component]
{rank=same; CurrencyConversionService, CurrencyExchangeService};
CurrencyExchangeService -> EurekaNamingServer;
CurrencyConversionService -> EurekaNamingServer;
}

digraph architecture {
rankdir = TB;
node[shape=component]

{rank=same; CurrencyExchangeService1, CurrencyExchangeService2, CurrencyExchangeService3};
{rank=same; LoadBalancer };
LoadBalancer -> CurrencyExchangeService1
LoadBalancer -> CurrencyExchangeService2
LoadBalancer -> CurrencyExchangeService3
CurrencyConversionService -> LoadBalancer

}

graph architecture {

node[style=filled,color="#59C8DE"]
//node [style=filled,color="#D14D28", fontcolor=white];
rankdir = TB
node[shape=record, width=2.5]
edge [width=0]
graph [pad=".75", ranksep="0.05", nodesep="0.25"];

Applications -- CloudFoundry [style=invis]
CloudFoundry -- CloudProvider [style=invis]
#OS -- Hardware [style=invis]
CloudProvider[label=<Cloud Provider <BR /><FONT POINT-SIZE="10"> AWS or Azure or GCP or Others</FONT>>]

}

graph architecture {

node[style=filled,color="#59C8DE"]
//node [style=filled,color="#D14D28", fontcolor=white];
rankdir = TB
node[shape=record, width=2.5]
edge [width=0]
graph [pad=".75", ranksep="0.05", nodesep="0.25"];

Applications -- PivotalCloudFoundry [style=invis]
PivotalCloudFoundry -- CloudProvider [style=invis]
#OS -- Hardware [style=invis]
CloudProvider[label=<AWS>]

}

digraph architecture {
  rankdir=LR;

node[shape=record]

  User -> LoadBalancer -> GoRouter -> Cell

  subgraph Cell {
      {rank=same; App, Cell};
  }

}

Blue Green

hello-world-rest-api-ranga-101.cfapps.io - Blue - Hello World v3 hello-world-rest-api-green hello-world-rest-api-ranga-101-green.cfapps.io Green - Hello World v4

Backup

rangaraokaranam$ cf apps
Getting apps in org currency-services / space development as [email protected]
OK

name                          requested state   instances   memory   disk   urls
currency-conversion-service   stopped           0/2         512M     1G     currency-conversion-service-ranga-101.cfapps.io
currency-exchange-service     stopped           0/2         512M     1G     currency-exchange-service-ranga-101.cfapps.io
hello-world-rest-api          stopped           0/1         1G       1G     hello-world-rest-api-sweet-panda.cfapps.io
hello-world-rest-api-green    stopped           0/1         1G       1G     hello-world-rest-api-ranga-101.cfapps.io, hello-world-rest-api-ranga-101-green.cfapps.io
rest-api-full-stack           stopped           0/1         1G       1G     rest-api-full-stack-ranga-101.cfapps.io
spring-boot-route-service     stopped           0/1         512M     1G     spring-boot-route-service-ranga-101.cfapps.io
todo-app-react-frontend       stopped           0/1         64M      1G     todo-app-react-frontend-ranga-101.cfapps.io
todo-rest-api                 stopped           0/1         1G       1G     todo-rest-api-terrific-mandrill.cfapps.io
todo-web-application-h2       stopped           0/1         1G       1G     todo-web-application-h2-ranga-101.cfapps.io
todo-web-application-mysql    stopped           0/1         1G       1G     todo-web-application-mysql-ranga-101.cfapps.io
rangaraokaranam$ cf routes
Getting routes for org currency-services / space development as [email protected] ...

space         host                                    domain      port   path   type   apps                          service
development   hello-world-rest-api-sweet-panda        cfapps.io                        hello-world-rest-api
development   hello-world-rest-api-ranga-101          cfapps.io                        hello-world-rest-api-green
development   todo-web-application-h2-ranga-101       cfapps.io                        todo-web-application-h2
development   todo-web-application-mysql-ranga-101    cfapps.io                        todo-web-application-mysql
development   rest-api-full-stack-ranga-101           cfapps.io                        rest-api-full-stack
development   todo-app-react-frontend-ranga-101       cfapps.io                        todo-app-react-frontend
development   currency-exchange-service-ranga-101     cfapps.io                        currency-exchange-service
development   currency-conversion-service-ranga-101   cfapps.io                        currency-conversion-service
development   spring-boot-route-service-ranga-101     cfapps.io                        spring-boot-route-service
development   todo-rest-api-terrific-mandrill         cfapps.io                        todo-rest-api
development   hello-world-rest-api-ranga-101-green    cfapps.io                        hello-world-rest-api-green
rangaraokaranam$ cf services
Getting services in org currency-services / space development as [email protected]

name                        service                       plan       bound apps                                               last operation     broker                    upgrade available
autoscale-development       app-autoscaler                standard   currency-exchange-service                                create succeeded   app-autoscaler            
config-server               p-config-server               trial      currency-conversion-service                              create succeeded   p-spring-cloud-services   
hystrix-dashboard           p-circuit-breaker-dashboard   trial      currency-conversion-service                              create succeeded   p-spring-cloud-services   
naming-server               p-service-registry            trial      currency-conversion-service, currency-exchange-service   create succeeded   p-spring-cloud-services   
spring-boot-route-service   user-provided                                                                                                                                  
todo-database               cleardb                       spark      todo-web-application-h2, todo-web-application-mysql      create succeeded   appdirect                 
rangaraokaranam$ 

Troubleshooting

Youtube Playlists - 500+ Videos

Click here - 30+ Playlists with 500+ Videos on Spring, Spring Boot, REST, Microservices and the Cloud

Keep Learning in28Minutes

in28Minutes is creating amazing solutions for you to learn Spring Boot, Full Stack and the Cloud - Docker, Kubernetes, AWS, React, Angular etc. - Check out all our courses here