SlideShare a Scribd company logo
1 of 34
Download to read offline
Rock, Paper,
Scissors
https://crossnative.github.io/cloudland-rps/
The Plan
Build a RESTful API forRock, Paper, Scissors
Learn more about Go and Spring
Learn cloud-native Development
#
#
#
How?
2 Sessions: Go and Spring
Collaborative programming of the API
Frontend is provided
You may workin groups
Successive fishbowl fordiscussing results
#
#
#
#
#
What's
cloud-native?
There is no cloud.
It's just someone else's computers.
Cloud native Technologies
empowerto build and run
scalable applications
in modern, dynamic environments.
Cloud Native Computing Foundation
The 12-Factor-App and Beyond
1. One Codebase, One App
2. API First
3. Dependency Management
4. Design, Build, Release, Run
5. Configuration, Credentials and
Code
6. Logs
7. Disposability
8. Backing Services
9. Environment Parity
10. Administrative Processes
11. Port Binding
12. Stateless Processes
13. Concurrency
14. Telemetry
15. Authentication and Authorization
Getting Started
Project Overview
Playervs. ComputerAPI Calls
>_ Demo
Split into Session
# Go Session
# Spring Session
Go Session
Prerequisites Go Session
Editor
Clone ,
checkout branch go-start
Go
optional: forhot reload
go install github.com/cosmtrek/air@latest
Frontend
# Visual Studio Code
# Postman
# github.com/crossnative/cloudland-rps
# Go Compiler
# air
# Node.js
First Steps in Go
1. Get up and running
2. Complete REST API
3. oradd
Make Cloud Native yourFeatures
Go Cloud Native Path
...
# Configure Port from
Environment Variable
# Handle Errors properly
# Middleware forLogging
and Recovery
# Add a Health Check
# Run in Container
# Use PostgreSQL for
Storage
# Deploy to the cloud
# Add OpenTelemetry
#
Cheatsheet Middleware forLogging
and Recovery
Using middlewares from chi routerorothers.
What does the recovery middleware do?
Bonus: How can you set a request timeout using
middleware?
r := chi.NewRouter()
r.Use(middleware.Logger)
r.Use(middleware.Recoverer)
#
#
Cheatsheet Configure Port
from Environment Variable
Using the Standard Library
Using envconfig
github.com/kelseyhightower/envconfig
func main() {
http.ListenAndServe(fmt.Sprintf(":%v", os.Getenv("PORT")), r)
}
// Application Configuration
type Config struct {
Port string `envconfig:"PORT" default:"8080"`
}
func main() {
http.ListenAndServe(fmt.Sprintf(":%v", c.Port), r)
}
Cheatsheet Handle Errors properly
Using the Standard Library
Using Problem forHTTPAPIs
Use with schneider.vip/problem
if err != nil {
http.Error(w, "Oops, that went wrong!", http.StatusInternalServerError)
return
}
rfc7807
if err != nil {
problem.New(
problem.Wrap(err),
problem.Status(http.StatusInternalServerError)
).WriteTo(w)
return
}
Cheatsheet Run in Container
# 1. RPS Builder
FROM golang as builder
WORKDIR /app
ADD . /app
RUN CGO_ENABLED=0 go build -ldflags="-w -s" -o build/rps .
# 2. RPS Container
FROM gcr.io/distroless/static
COPY --from=builder /app/build/rps /usr/bin/
EXPOSE 8080
ENTRYPOINT ["/usr/bin/rps"]
Cheatsheet Add a Health Check
See github.com/hellofresh/health-go/v5.
// Register Health Check
h, _ := health.New(health.WithChecks(
health.Config{
Name: "db",
Timeout: time.Second * 2,
SkipOnErr: false,
Check: healthPgx.New(healthPgx.Config{
DSN: config.Db,
}),
},
))
// Register Health Check Handler Function
r.Get("/health", h.HandlerFunc)
Cheatsheet Use PostgreSQL for
Storage
Sample application
# SQL Tutorial with Go
# PostgreSQL DriverPGX
# offer
Cheatsheet Cloud Deployment
Example Deployment forrender
services:
- type: web
name: backend-go
env: go
plan: free
rootDir: backend-go
buildCommand: go build -o rps .
startCommand: ./rps
Cheatsheet OpenTelemetry
Use otelchi
Spring Session
Prerequisites Spring Session
Install some IDE (e.g. or )
Install
Install Java JDK(e.g. )
Clone and checkout branch
spring-start
Frontend
(npm is included)
# IntelliJ Visual Studio Code
# Postman
# Temurin
# github.com/crossnative/cloudland-rps
# Node.js
First Steps Spring Session
1. Run local Frontend togetherwith example backend
https://backend-spring.onrender.com/api/v1
2. Build and Run Spring Backend
3. Implement REST API
4. oradd
Make Cloud Native furtherFeatures
Spring Cloud Native Path
...
# Configurable
Application Port
# Improve ErrorHandling
# Configure proper
Logging
# Health Check
# Run in Container
# Use Database for
persistence
# Deploy to the Cloud
# Add OpenTelemetry
#
Cheatsheet ErrorHandling
# Use JSON Problem Details (RFC 7807)
# Create a Http ErrorHandler
Cheatsheet Run in Container
With Buildpacks run
./mvnw spring-boot:build-image -Dspring-
boot.build-image.imageName=myorg/myapp
# Spring Official Guide
# Baeldung: Dockerizing a Spring Boot Application
Feature Ideas Rock, Paper, Scissors
Add a leaderboard with top 10 Players
Make Game realtime (e.g. WebSocket, ...)
Enhance to
Add rooms people can play many Games in
...
#
#
# Rock, Paper, Scissors, Spock, Lizard
#
#
Interesting Links
# The Twelve FactorApp
# Beyond the Twelve FactorApp
# Cloud-native entwickeln mit Go
# Building a MultiplayerGame with API
Gateway+Websockets, Go and DynamoDB
Jan Stamer
Lena Grimm
Fynn JasparStempel
jan.stamer@crossnative.com
lena.grimm@crossnative.com
fynn.jaspar.stempel@crossnative.com

More Related Content

Similar to CloudLand 2023: Rock, Paper, Scissors Cloud Competition - Go vs. Java

Meetup 2022 - APIs with Quarkus.pdf
Meetup 2022 - APIs with Quarkus.pdfMeetup 2022 - APIs with Quarkus.pdf
Meetup 2022 - APIs with Quarkus.pdfLuca Mattia Ferrari
 
OpenShift: Java EE in the clouds
OpenShift: Java EE in the cloudsOpenShift: Java EE in the clouds
OpenShift: Java EE in the cloudsMax Andersen
 
Timings API: Performance Assertion during the functional testing
 Timings API: Performance Assertion during the functional testing Timings API: Performance Assertion during the functional testing
Timings API: Performance Assertion during the functional testingPetrosPlakogiannis
 
Apache OpenWhisk Serverless Computing
Apache OpenWhisk Serverless ComputingApache OpenWhisk Serverless Computing
Apache OpenWhisk Serverless ComputingUpkar Lidder
 
Node.js Build, Deploy and Scale Webinar
Node.js Build, Deploy and Scale WebinarNode.js Build, Deploy and Scale Webinar
Node.js Build, Deploy and Scale Webinarjguerrero999
 
Microservices DevOps on Google Cloud Platform
Microservices DevOps on Google Cloud PlatformMicroservices DevOps on Google Cloud Platform
Microservices DevOps on Google Cloud PlatformSunnyvale
 
Kubernetes for the PHP developer
Kubernetes for the PHP developerKubernetes for the PHP developer
Kubernetes for the PHP developerPaul Czarkowski
 
Gitlab ci, cncf.sk
Gitlab ci, cncf.skGitlab ci, cncf.sk
Gitlab ci, cncf.skJuraj Hantak
 
JDD2015: Kubernetes - Beyond the basics - Paul Bakker
JDD2015: Kubernetes - Beyond the basics - Paul BakkerJDD2015: Kubernetes - Beyond the basics - Paul Bakker
JDD2015: Kubernetes - Beyond the basics - Paul BakkerPROIDEA
 
Deploying Spring Boot applications with Docker (east bay cloud meetup dec 2014)
Deploying Spring Boot applications with Docker (east bay cloud meetup dec 2014)Deploying Spring Boot applications with Docker (east bay cloud meetup dec 2014)
Deploying Spring Boot applications with Docker (east bay cloud meetup dec 2014)Chris Richardson
 
[EXTENDED] Ceph, Docker, Heroku Slugs, CoreOS and Deis Overview
[EXTENDED] Ceph, Docker, Heroku Slugs, CoreOS and Deis Overview[EXTENDED] Ceph, Docker, Heroku Slugs, CoreOS and Deis Overview
[EXTENDED] Ceph, Docker, Heroku Slugs, CoreOS and Deis OverviewLeo Lorieri
 
Real World Lessons on the Pain Points of Node.JS Application
Real World Lessons on the Pain Points of Node.JS ApplicationReal World Lessons on the Pain Points of Node.JS Application
Real World Lessons on the Pain Points of Node.JS ApplicationBen Hall
 
Scaling Docker Containers using Kubernetes and Azure Container Service
Scaling Docker Containers using Kubernetes and Azure Container ServiceScaling Docker Containers using Kubernetes and Azure Container Service
Scaling Docker Containers using Kubernetes and Azure Container ServiceBen Hall
 
OWASP ZAP Workshop for QA Testers
OWASP ZAP Workshop for QA TestersOWASP ZAP Workshop for QA Testers
OWASP ZAP Workshop for QA TestersJavan Rasokat
 
An OpenShift Primer for Developers to get your Code into the Cloud (PTJUG)
An OpenShift Primer for Developers to get your Code into the Cloud (PTJUG)An OpenShift Primer for Developers to get your Code into the Cloud (PTJUG)
An OpenShift Primer for Developers to get your Code into the Cloud (PTJUG)Eric D. Schabell
 
Automate Your Automation | DrupalCon Vienna
Automate Your Automation | DrupalCon ViennaAutomate Your Automation | DrupalCon Vienna
Automate Your Automation | DrupalCon ViennaPantheon
 
Containers as a Service with Docker
Containers as a Service with DockerContainers as a Service with Docker
Containers as a Service with DockerDocker, Inc.
 
Docker Container As A Service - March 2016
Docker Container As A Service - March 2016Docker Container As A Service - March 2016
Docker Container As A Service - March 2016Patrick Chanezon
 
Deploying R for Production - SRUG
Deploying R for Production - SRUGDeploying R for Production - SRUG
Deploying R for Production - SRUGHolger Hellebro
 

Similar to CloudLand 2023: Rock, Paper, Scissors Cloud Competition - Go vs. Java (20)

Meetup 2022 - APIs with Quarkus.pdf
Meetup 2022 - APIs with Quarkus.pdfMeetup 2022 - APIs with Quarkus.pdf
Meetup 2022 - APIs with Quarkus.pdf
 
Kubernetes security
Kubernetes securityKubernetes security
Kubernetes security
 
OpenShift: Java EE in the clouds
OpenShift: Java EE in the cloudsOpenShift: Java EE in the clouds
OpenShift: Java EE in the clouds
 
Timings API: Performance Assertion during the functional testing
 Timings API: Performance Assertion during the functional testing Timings API: Performance Assertion during the functional testing
Timings API: Performance Assertion during the functional testing
 
Apache OpenWhisk Serverless Computing
Apache OpenWhisk Serverless ComputingApache OpenWhisk Serverless Computing
Apache OpenWhisk Serverless Computing
 
Node.js Build, Deploy and Scale Webinar
Node.js Build, Deploy and Scale WebinarNode.js Build, Deploy and Scale Webinar
Node.js Build, Deploy and Scale Webinar
 
Microservices DevOps on Google Cloud Platform
Microservices DevOps on Google Cloud PlatformMicroservices DevOps on Google Cloud Platform
Microservices DevOps on Google Cloud Platform
 
Kubernetes for the PHP developer
Kubernetes for the PHP developerKubernetes for the PHP developer
Kubernetes for the PHP developer
 
Gitlab ci, cncf.sk
Gitlab ci, cncf.skGitlab ci, cncf.sk
Gitlab ci, cncf.sk
 
JDD2015: Kubernetes - Beyond the basics - Paul Bakker
JDD2015: Kubernetes - Beyond the basics - Paul BakkerJDD2015: Kubernetes - Beyond the basics - Paul Bakker
JDD2015: Kubernetes - Beyond the basics - Paul Bakker
 
Deploying Spring Boot applications with Docker (east bay cloud meetup dec 2014)
Deploying Spring Boot applications with Docker (east bay cloud meetup dec 2014)Deploying Spring Boot applications with Docker (east bay cloud meetup dec 2014)
Deploying Spring Boot applications with Docker (east bay cloud meetup dec 2014)
 
[EXTENDED] Ceph, Docker, Heroku Slugs, CoreOS and Deis Overview
[EXTENDED] Ceph, Docker, Heroku Slugs, CoreOS and Deis Overview[EXTENDED] Ceph, Docker, Heroku Slugs, CoreOS and Deis Overview
[EXTENDED] Ceph, Docker, Heroku Slugs, CoreOS and Deis Overview
 
Real World Lessons on the Pain Points of Node.JS Application
Real World Lessons on the Pain Points of Node.JS ApplicationReal World Lessons on the Pain Points of Node.JS Application
Real World Lessons on the Pain Points of Node.JS Application
 
Scaling Docker Containers using Kubernetes and Azure Container Service
Scaling Docker Containers using Kubernetes and Azure Container ServiceScaling Docker Containers using Kubernetes and Azure Container Service
Scaling Docker Containers using Kubernetes and Azure Container Service
 
OWASP ZAP Workshop for QA Testers
OWASP ZAP Workshop for QA TestersOWASP ZAP Workshop for QA Testers
OWASP ZAP Workshop for QA Testers
 
An OpenShift Primer for Developers to get your Code into the Cloud (PTJUG)
An OpenShift Primer for Developers to get your Code into the Cloud (PTJUG)An OpenShift Primer for Developers to get your Code into the Cloud (PTJUG)
An OpenShift Primer for Developers to get your Code into the Cloud (PTJUG)
 
Automate Your Automation | DrupalCon Vienna
Automate Your Automation | DrupalCon ViennaAutomate Your Automation | DrupalCon Vienna
Automate Your Automation | DrupalCon Vienna
 
Containers as a Service with Docker
Containers as a Service with DockerContainers as a Service with Docker
Containers as a Service with Docker
 
Docker Container As A Service - March 2016
Docker Container As A Service - March 2016Docker Container As A Service - March 2016
Docker Container As A Service - March 2016
 
Deploying R for Production - SRUG
Deploying R for Production - SRUGDeploying R for Production - SRUG
Deploying R for Production - SRUG
 

More from Jan Stamer

JAX 2024: Go-über-den-Wolken und in der Cloud
JAX 2024: Go-über-den-Wolken und in der CloudJAX 2024: Go-über-den-Wolken und in der Cloud
JAX 2024: Go-über-den-Wolken und in der CloudJan Stamer
 
JAX 2024: Go in der Praxis einsetzen
JAX 2024: Go in der Praxis einsetzenJAX 2024: Go in der Praxis einsetzen
JAX 2024: Go in der Praxis einsetzenJan Stamer
 
W-JAX 2023: Go über den Wolken
W-JAX 2023: Go über den WolkenW-JAX 2023: Go über den Wolken
W-JAX 2023: Go über den WolkenJan Stamer
 
entwickler.de 05/2023: Go über den Wolken
entwickler.de 05/2023: Go über den Wolkenentwickler.de 05/2023: Go über den Wolken
entwickler.de 05/2023: Go über den WolkenJan Stamer
 
IT-Tage 2021: Java to Go - Google Go für Java-Entwickler
IT-Tage 2021: Java to Go - Google Go für Java-Entwickler IT-Tage 2021: Java to Go - Google Go für Java-Entwickler
IT-Tage 2021: Java to Go - Google Go für Java-Entwickler Jan Stamer
 
entwickler.de Go Day: Go Web Development 101
entwickler.de Go Day: Go Web Development 101entwickler.de Go Day: Go Web Development 101
entwickler.de Go Day: Go Web Development 101Jan Stamer
 
betterCode() Go: Einstieg in Go, Standard-Library und Ökosystem
betterCode() Go: Einstieg in Go, Standard-Library und ÖkosystembetterCode() Go: Einstieg in Go, Standard-Library und Ökosystem
betterCode() Go: Einstieg in Go, Standard-Library und ÖkosystemJan Stamer
 
JCON 2021: Turbo powered Web Apps
JCON 2021: Turbo powered Web AppsJCON 2021: Turbo powered Web Apps
JCON 2021: Turbo powered Web AppsJan Stamer
 
DevOpsCon 2021: Go Web Development 101
DevOpsCon 2021: Go Web Development 101DevOpsCon 2021: Go Web Development 101
DevOpsCon 2021: Go Web Development 101Jan Stamer
 
JavaForum Nord 2021: Java to Go - Google Go für Java-Entwickler
JavaForum Nord 2021: Java to Go - Google Go für Java-EntwicklerJavaForum Nord 2021: Java to Go - Google Go für Java-Entwickler
JavaForum Nord 2021: Java to Go - Google Go für Java-EntwicklerJan Stamer
 
Karlsruher Entwicklertag 2021: Turbo powered Web Apps
Karlsruher Entwicklertag 2021: Turbo powered Web AppsKarlsruher Entwicklertag 2021: Turbo powered Web Apps
Karlsruher Entwicklertag 2021: Turbo powered Web AppsJan Stamer
 
Jugs HH: Elefant unter Strom - von OldSQL über NoSQL zu NewSQL?
Jugs HH: Elefant unter Strom - von OldSQL über NoSQL zu NewSQL?Jugs HH: Elefant unter Strom - von OldSQL über NoSQL zu NewSQL?
Jugs HH: Elefant unter Strom - von OldSQL über NoSQL zu NewSQL?Jan Stamer
 

More from Jan Stamer (12)

JAX 2024: Go-über-den-Wolken und in der Cloud
JAX 2024: Go-über-den-Wolken und in der CloudJAX 2024: Go-über-den-Wolken und in der Cloud
JAX 2024: Go-über-den-Wolken und in der Cloud
 
JAX 2024: Go in der Praxis einsetzen
JAX 2024: Go in der Praxis einsetzenJAX 2024: Go in der Praxis einsetzen
JAX 2024: Go in der Praxis einsetzen
 
W-JAX 2023: Go über den Wolken
W-JAX 2023: Go über den WolkenW-JAX 2023: Go über den Wolken
W-JAX 2023: Go über den Wolken
 
entwickler.de 05/2023: Go über den Wolken
entwickler.de 05/2023: Go über den Wolkenentwickler.de 05/2023: Go über den Wolken
entwickler.de 05/2023: Go über den Wolken
 
IT-Tage 2021: Java to Go - Google Go für Java-Entwickler
IT-Tage 2021: Java to Go - Google Go für Java-Entwickler IT-Tage 2021: Java to Go - Google Go für Java-Entwickler
IT-Tage 2021: Java to Go - Google Go für Java-Entwickler
 
entwickler.de Go Day: Go Web Development 101
entwickler.de Go Day: Go Web Development 101entwickler.de Go Day: Go Web Development 101
entwickler.de Go Day: Go Web Development 101
 
betterCode() Go: Einstieg in Go, Standard-Library und Ökosystem
betterCode() Go: Einstieg in Go, Standard-Library und ÖkosystembetterCode() Go: Einstieg in Go, Standard-Library und Ökosystem
betterCode() Go: Einstieg in Go, Standard-Library und Ökosystem
 
JCON 2021: Turbo powered Web Apps
JCON 2021: Turbo powered Web AppsJCON 2021: Turbo powered Web Apps
JCON 2021: Turbo powered Web Apps
 
DevOpsCon 2021: Go Web Development 101
DevOpsCon 2021: Go Web Development 101DevOpsCon 2021: Go Web Development 101
DevOpsCon 2021: Go Web Development 101
 
JavaForum Nord 2021: Java to Go - Google Go für Java-Entwickler
JavaForum Nord 2021: Java to Go - Google Go für Java-EntwicklerJavaForum Nord 2021: Java to Go - Google Go für Java-Entwickler
JavaForum Nord 2021: Java to Go - Google Go für Java-Entwickler
 
Karlsruher Entwicklertag 2021: Turbo powered Web Apps
Karlsruher Entwicklertag 2021: Turbo powered Web AppsKarlsruher Entwicklertag 2021: Turbo powered Web Apps
Karlsruher Entwicklertag 2021: Turbo powered Web Apps
 
Jugs HH: Elefant unter Strom - von OldSQL über NoSQL zu NewSQL?
Jugs HH: Elefant unter Strom - von OldSQL über NoSQL zu NewSQL?Jugs HH: Elefant unter Strom - von OldSQL über NoSQL zu NewSQL?
Jugs HH: Elefant unter Strom - von OldSQL über NoSQL zu NewSQL?
 

Recently uploaded

Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Hr365.us smith
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityNeo4j
 
SpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at RuntimeSpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at Runtimeandrehoraa
 
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxTier1 app
 
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样umasea
 
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio, Inc.
 
Unveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsUnveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsAhmed Mohamed
 
Xen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdfXen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdfStefano Stabellini
 
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)OPEN KNOWLEDGE GmbH
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...stazi3110
 
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)jennyeacort
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...soniya singh
 
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...Matt Ray
 
Unveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesUnveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesŁukasz Chruściel
 
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...Christina Lin
 
Folding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesFolding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesPhilip Schwarz
 
What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWave PLM
 
Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureImplementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureDinusha Kumarasiri
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackVICTOR MAESTRE RAMIREZ
 

Recently uploaded (20)

Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered Sustainability
 
SpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at RuntimeSpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at Runtime
 
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
 
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
 
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
 
Unveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsUnveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML Diagrams
 
Xen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdfXen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdf
 
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)
 
2.pdf Ejercicios de programación competitiva
2.pdf Ejercicios de programación competitiva2.pdf Ejercicios de programación competitiva
2.pdf Ejercicios de programación competitiva
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
 
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
 
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
 
Unveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesUnveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New Features
 
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
 
Folding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesFolding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a series
 
What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need It
 
Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureImplementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with Azure
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStack
 

CloudLand 2023: Rock, Paper, Scissors Cloud Competition - Go vs. Java

  • 3. The Plan Build a RESTful API forRock, Paper, Scissors Learn more about Go and Spring Learn cloud-native Development # # #
  • 4. How? 2 Sessions: Go and Spring Collaborative programming of the API Frontend is provided You may workin groups Successive fishbowl fordiscussing results # # # # #
  • 6. There is no cloud. It's just someone else's computers.
  • 7. Cloud native Technologies empowerto build and run scalable applications in modern, dynamic environments. Cloud Native Computing Foundation
  • 8. The 12-Factor-App and Beyond 1. One Codebase, One App 2. API First 3. Dependency Management 4. Design, Build, Release, Run 5. Configuration, Credentials and Code 6. Logs 7. Disposability 8. Backing Services 9. Environment Parity 10. Administrative Processes 11. Port Binding 12. Stateless Processes 13. Concurrency 14. Telemetry 15. Authentication and Authorization
  • 13. Split into Session # Go Session # Spring Session
  • 15. Prerequisites Go Session Editor Clone , checkout branch go-start Go optional: forhot reload go install github.com/cosmtrek/air@latest Frontend # Visual Studio Code # Postman # github.com/crossnative/cloudland-rps # Go Compiler # air # Node.js
  • 16. First Steps in Go 1. Get up and running 2. Complete REST API 3. oradd Make Cloud Native yourFeatures
  • 17. Go Cloud Native Path ... # Configure Port from Environment Variable # Handle Errors properly # Middleware forLogging and Recovery # Add a Health Check # Run in Container # Use PostgreSQL for Storage # Deploy to the cloud # Add OpenTelemetry #
  • 18. Cheatsheet Middleware forLogging and Recovery Using middlewares from chi routerorothers. What does the recovery middleware do? Bonus: How can you set a request timeout using middleware? r := chi.NewRouter() r.Use(middleware.Logger) r.Use(middleware.Recoverer) # #
  • 19. Cheatsheet Configure Port from Environment Variable Using the Standard Library Using envconfig github.com/kelseyhightower/envconfig func main() { http.ListenAndServe(fmt.Sprintf(":%v", os.Getenv("PORT")), r) } // Application Configuration type Config struct { Port string `envconfig:"PORT" default:"8080"` } func main() { http.ListenAndServe(fmt.Sprintf(":%v", c.Port), r) }
  • 20. Cheatsheet Handle Errors properly Using the Standard Library Using Problem forHTTPAPIs Use with schneider.vip/problem if err != nil { http.Error(w, "Oops, that went wrong!", http.StatusInternalServerError) return } rfc7807 if err != nil { problem.New( problem.Wrap(err), problem.Status(http.StatusInternalServerError) ).WriteTo(w) return }
  • 21. Cheatsheet Run in Container # 1. RPS Builder FROM golang as builder WORKDIR /app ADD . /app RUN CGO_ENABLED=0 go build -ldflags="-w -s" -o build/rps . # 2. RPS Container FROM gcr.io/distroless/static COPY --from=builder /app/build/rps /usr/bin/ EXPOSE 8080 ENTRYPOINT ["/usr/bin/rps"]
  • 22. Cheatsheet Add a Health Check See github.com/hellofresh/health-go/v5. // Register Health Check h, _ := health.New(health.WithChecks( health.Config{ Name: "db", Timeout: time.Second * 2, SkipOnErr: false, Check: healthPgx.New(healthPgx.Config{ DSN: config.Db, }), }, )) // Register Health Check Handler Function r.Get("/health", h.HandlerFunc)
  • 23. Cheatsheet Use PostgreSQL for Storage Sample application # SQL Tutorial with Go # PostgreSQL DriverPGX # offer
  • 24. Cheatsheet Cloud Deployment Example Deployment forrender services: - type: web name: backend-go env: go plan: free rootDir: backend-go buildCommand: go build -o rps . startCommand: ./rps
  • 27. Prerequisites Spring Session Install some IDE (e.g. or ) Install Install Java JDK(e.g. ) Clone and checkout branch spring-start Frontend (npm is included) # IntelliJ Visual Studio Code # Postman # Temurin # github.com/crossnative/cloudland-rps # Node.js
  • 28. First Steps Spring Session 1. Run local Frontend togetherwith example backend https://backend-spring.onrender.com/api/v1 2. Build and Run Spring Backend 3. Implement REST API 4. oradd Make Cloud Native furtherFeatures
  • 29. Spring Cloud Native Path ... # Configurable Application Port # Improve ErrorHandling # Configure proper Logging # Health Check # Run in Container # Use Database for persistence # Deploy to the Cloud # Add OpenTelemetry #
  • 30. Cheatsheet ErrorHandling # Use JSON Problem Details (RFC 7807) # Create a Http ErrorHandler
  • 31. Cheatsheet Run in Container With Buildpacks run ./mvnw spring-boot:build-image -Dspring- boot.build-image.imageName=myorg/myapp # Spring Official Guide # Baeldung: Dockerizing a Spring Boot Application
  • 32. Feature Ideas Rock, Paper, Scissors Add a leaderboard with top 10 Players Make Game realtime (e.g. WebSocket, ...) Enhance to Add rooms people can play many Games in ... # # # Rock, Paper, Scissors, Spock, Lizard # #
  • 33. Interesting Links # The Twelve FactorApp # Beyond the Twelve FactorApp # Cloud-native entwickeln mit Go # Building a MultiplayerGame with API Gateway+Websockets, Go and DynamoDB
  • 34. Jan Stamer Lena Grimm Fynn JasparStempel jan.stamer@crossnative.com lena.grimm@crossnative.com fynn.jaspar.stempel@crossnative.com