/pcf-crash-course-with-spring-boot

PCF Crash Course for Java, Spring and Spring Boot Developers - Deploy Spring Boot REST API, Full Stack Applications and Microservices to Pivotal Cloud Foundry (PCF)

Primary LanguageJavaMIT LicenseMIT

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

  • Node v8+ for npm
  • Visual Studio Code - Latest Version
  • Java 8+
  • Eclipse - Oxygen+ - (Embedded Maven From Eclipse)
  • Git
  • Docker
  • ELB CLI

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:

  • REST APIs - Hello World and Todo - Jar
  • Todo Web Application War
  • Full Stack Application with React and Spring Boot
  • CCS and CES Microservices
  • Route Services

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

  • You will Learn the Fundamentals of Pivotal Cloud Foundry ( PCF ) from Zero, no previous experience required
  • You will learn to deploy Spring Boot REST API to Pivotal Cloud Foundry ( PCF )
  • You will learn to deploy Java, Spring Boot Full Stack Applications to Pivotal Cloud Foundry ( PCF )
  • You will be using a number of PCF Services - Databases, Spring Cloud Services including Service Registry, Config Server and Hystrix .
  • You will learn how to Auto Scale applications based on load as well as deploy multiple instances behind a load balancer using Pivotal Cloud Foundry.
  • You will Join 250,000 Learners having AMAZING LEARNING Experiences with in28Minutes

Requirements

  • You have an attitude to learn while having fun :)
  • You have some programming experience with Java, Spring and Spring Boot
  • You DO NOT need to have any experience with Pivotal Cloud Foundry
  • We will help you install Eclipse, Visual Studio Code, Git client, Docker Desktop and Node JS (for npm)

Who is this course for

  • You are a Java Spring Boot developer getting started with the Cloud
  • You want to get your Java applications deployed to PCF (Pivotal Cloud Foundry) Quickly
  • You are a Java Developer and You are curious about PCF and the Cloud
  • You want to learn to deploy a Java Spring Boot full stack application to PCF (Pivotal Cloud Foundry)
  • You want to learn to deploy Spring Boot Microservices with Service Registry, Config Server, Distributed Tracing and Load Balancing to PCF (Pivotal Cloud Foundry)

Step By Step Details

Introduction to the Course

  • 00 Step 01 - Deploy Spring Boot Applications to Pivotal Cloud Foundry - Course Overview
  • 00 Step 02 - Deploy Spring Boot Applications to Pivotal Cloud Foundry - Getting Started

Getting Started with PCF - Pivotal Cloud Foundry

  • 01 Step 01 - Getting Started with PCF - Pivotal Cloud Foundry
  • 01 Step 02 - Creating Pivotal Web Services Accounts and Understanding Org and Space
  • 01 Step 03 - Installing CF CLI - Cloud Foundry Command Line Interface
  • 01 Step 04 - Importing Spring Boot Projects into our IDE

Deploy Java Spring Boot Hello World Rest API to PCF

  • 02 Step 01 - Setting up 01 Spring Boot Hello World Rest API in Local
  • 02 Step 02 - Deploy 01 Hello World Rest API to Pivotal Cloud Foundry - PCF
  • 02 Step 03 - Exploring Cloud Foundry CLI - apps, routes, start, stop and restart
  • 02 Step 04 - Creating Application Manifest manifest yaml for Spring Boot App
  • 02 Step 05 - Understanding Pivotal Cloud Foundry - PCF - Concepts - Droplet and Build Packs
  • 02 Step 06 - Configure PCF Java Build Pack for Spring Boot Application

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

  • 03 Step 01 - Setting up 01 Spring Boot Todo Web Application in Local
  • 03 Step 02 - Deploy Spring Boot Todo Web Application to Pivotal Cloud Foundry - PCF

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

  • 04 Step 01 - Code Review of 03 Todo Web Application MySQL
  • 04 Step 02 - Running MySQL as Docker Container on Local
  • 04 Step 03 - Connect Spring Boot Todo Web App to MySQL on Local
  • 04 Step 04 - Exploring PWS UI and Create Service for Todo Database on PCF
  • 04 Step 05 - Connect Spring Boot Web App with MySQL Database on PCF
  • 04 Step 06 - Understanding PCF Spring Auto Configuration

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

  • 05 Step 01 - Exploring 04 Java Full Stack Spring Boot React App
  • 05 Step 02 - Running React Frontend in Local
  • 05 Step 03 - Deploying Java REST API Backend to Pivotal Cloud Foundry
  • 05 Step 04 - Building React Frontend Code for Pivotal Cloud Foundry
  • 05 Step 05 - Exploring Pivotal Cloud Foundry UI

Getting started with CCS and CES Microservices on PCF

  • 06 Step 04 - Overview of CCS and CES Spring Boot Microservices
  • 06 Step 05 - Push CCS and CES Microservices to Pivotal Cloud Foundry
  • 06 Step 06 - Run CCS and CES Microservices on PCF - Environment Variables and Instance Config
  • 06 Step 07 - Scaling CCS and CES Microservices on Pivotal Cloud Foundry
  • 06 Step 08 - Exploring Distributed Tracing on Pivotal Cloud Foundry

Using Service Registry for Spring Boot Microservices on Pivotal Cloud Foundry

  • 07 Step 01 - Understanding the need for Service Registry and Set up Eureka Server
  • 07 Step 02 - Register CES Microservice with Eureka Service on Local
  • 07 Step 03 - Register CCS Microservice with Eureka Service and connect CES Microservice
  • 07 Step 04 - Create Service Registry on Pivotal Cloud Foundry and deploy CCS and CES

Exploring Auto Scaling on Pivotal Cloud Foundry

  • 08 Step 01 - Auto Scaling Microservices on Pivotal Cloud Foundry
  • 08 Step 02 - Disable Auto Scaling on Pivotal Cloud Foundry

Using Route Services with PCF and Spring Boot

  • 09 Step 01 - Understanding Route Services - Code Review and Deploy
  • 09 Step 02 - Binding Route Services with Spring Boot Microservices
  • 09 Step 03 - Disable Route Services on PCF
  • 09 Step 04 - Quick Review of Pivotal Cloud Foundry

Setting up Centralized Configuration

  • 10 Step 01 - Understanding Centralized Configuration for Microservices
  • 10 Step 02 - Configure CCS Microservice to talk to Spring Cloud Config Server
  • 10 Step 03 - Create a Github Repo for Spring Cloud Config Server
  • 10 Step 04 - Configure Refresh Scope for Spring Boot Application
  • 10 Step 05 - Create Cloud Config Service on Pivotal Cloud Foundry
  • 10 Step 06 - Test Cloud Config Service on Pivotal Cloud Foundry

Setting up Circuit Breaker with Hystrix

  • 11 Step 01 - Setting up Hystrix Circuit Breaker on Local
  • 11 Step 02 - Create Circuit Breaker Service and Deploy App on Pivotal Cloud Foundry
  • 11 Step 03 - Understand Hystrix Open and Close Circuit Features

Exploring More Features on PCF

  • 12 Step 01 - Understand PCF Resilience and configure Health Checks for Microservices
  • 12 Step 02 - Setting up Direct Communication between Microservice Containers
  • 12 Step 03 - Deploying Containers to PCF
  • 12 Step 04 - Blue Green Deployment on Pivotal Cloud Foundry
  • 12 Step 05 - Thank You

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 ranga@in28minutes.com...
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 ranga@in28minutes.com ...

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 ranga@in28minutes.com...

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