In this course we will create a simple Cloud Native Architecture. In completing this task key technologies and cloud native patterns will be reviewed.
- Has completed PCF Developer training
- Java JDK 8 Installed
- STS or IntelliJ
http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
https://www.jetbrains.com/idea/
Through out the course the following will be covered:
- Spring Boot Overview
- Gradle Quick Start
- Testing in Spring Boot
- Using Repositories To Work With Data
- Externalizing Configurations and Working With Profiles
- Review of Working With Data In PCF
- Basic Security with Spring Boot and introduction to OAuth in PCF
- Adding Fault Tolerance
- Overview of Messaging In The Cloud
This course is designed to reinforce concepts already reviewed and learned and give a direction on where to go to learn more. This course is for developers who will be building and running applications on Pivotal Cloud Foundry.
For this course Gradle will be the build tool and dependancy management tool of choice. Maven will not be an option.
First install Gradle on your machine:
In STS Gradle support needs to be added. At the time of writing this Gradle Buildship was not working with STS. Instead classic Gradle was installed.
Get the dashboard open.
Select the IDE Extensions
Select the Gradle Classic Extension
Lombok makes creating domain objects easy. Rather than coding all the boiler plate constructors and methods we normally need, with Lombok we can create JPA Entity Bean with everything we need like this:
@Entity
@Table(name="product")
@Data
@NoArgsConstructor
@AllArgsConstructor
public class Product implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
@Getter @Setter
private Long id;
@Getter @Setter
private String name;
@Getter @Setter
private Double price;
@Getter @Setter
private String description;
@Getter @Setter
private Integer quantity;
}
To get Lombok running we need to do two things:
- Install it into the IDE (https://projectlombok.org/download.html)
- Add it as a Gradle dependancies: compileOnly "org.projectlombok:lombok:1.16.14"
The application can be ran locally (running Spring Boot or PCF Dev) on in a hosted PCF (in this case PWS).
To get the full Cloud Native experience, create an account on PWS for free to complete these labs. This is PCF running in AWS:
You can develop locally against PCF Dev while providing a similar development experience as PWS. It does require 6GB of memory to be free:
To run this application on locally or in PWS the following Services are required.
One of our services is backed with a relation DB. This can be installed locally without much pain:
https://www.postgresql.org/download/
PWS's market place offers Postgres (Elephant SQL). PCF Dev only offers MySQL, due to the way we develop our applications the SQL will not have to change. PWS will take care of puttting in the correct DB driver, for PCF Dev the application package will need to contain the correct driver
Our services use Rabbit MQ to communicate.
Rabbit can be installed locally:
https://www.rabbitmq.com/download.html
It also can be obtained via Docker:
To start rabbit on the Docker images:
docker run -d -p 15672:15672 -p 5672:5672 rabbitmq:3.6.6-management
PWS's market place offers Rabbit as does PCF Dev
Redis is used as a system of record for the Order service.
Redis can be installed locally:
https://redis.io/topics/quickstart
There is also a Docker image:
https://hub.docker.com/_/redis/
PWS market place offers a Redis services