Slide 1

Slide 1 text

TOM HOMBERGS | PRINCIPAL SOFTWARE ENGINEER | @TOMHOMBERGS Platform Engineering with Spring Boot

Slide 2

Slide 2 text

WHY PLATFORM ENGINEERING? Principal Engineer on the Java platform team @ Atlassian Approximately 800 production services currently run on our Spring Boot / Java stack Spring Boot is the central pillar of our Java stack

Slide 3

Slide 3 text

Platform engineering is the discipline of designing and building toolchains and work fl ows that enable self-service capabilities for software engineering organisations. PLATFORM ENGINEERING from platformengineering.org

Slide 4

Slide 4 text

Logging Tracing Auth Metrics Alerting Deployment Resources Environments Local Testing Project setup … (Micro-) Service platform Cloud Provider Integrations

Slide 5

Slide 5 text

Logging Tracing Auth Metrics Alerting Deployment Resources Environments Local Testing Project setup … Integrations (Micro-) Service Cloud Provider

Slide 6

Slide 6 text

Logging Tracing Auth Metrics Alerting Deployment Resources Environments Local Testing Project setup … Integrations (Micro-) Service Cloud Provider

Slide 7

Slide 7 text

Logging Tracing Auth Metrics Alerting Deployment Resources Environments Local Testing Project setup … (Micro-) Service Cloud Provider Spring Boot + Integrations platform engineering 
 with 
 Spring Boot

Slide 8

Slide 8 text

THE JAVA TECH STACK @ ATLASSIAN Standards Recommendations for libraries and tools to use. Project setup Did anyone say start.spring.io? Libraries Java libraries for (micro-) service developers. Guides How to do things with the Java platform?

Slide 9

Slide 9 text

THE JAVA TECH STACK @ ATLASSIAN Standards Recommendations for libraries and tools to use. Project setup Did anyone say start.spring.io? Libraries Java libraries for (micro-) service developers. Guides How to do things with the Java platform? our focus today

Slide 10

Slide 10 text

THE JAVA TECH STACK @ ATLASSIAN Standards Recommendations for libraries and tools to use. Project setup Did anyone say start.spring.io? Libraries Java libraries for (micro-) service developers. Guides How to do things with the Java platform?

Slide 11

Slide 11 text

SPRING BOOT @ ATLASSIAN … … … … … … … … … … … (Micro-) Service AWS BOM Parent POM Spring Boot Starters

Slide 12

Slide 12 text

SPRING BOOT @ ATLASSIAN Base Lifecycle … … Security … MVC WebFlux … … Flyway (Micro-) Service AWS BOM Parent POM Spring Boot Starters

Slide 13

Slide 13 text

Let’s look at some code https://github.com/thombergs/platform-engineering

Slide 14

Slide 14 text

USE CASE 1: ENVIRONMENT PROFILES Platform Spring Boot Pro fi les Environment 
 Variable injects ENVIRONMENT=dev-east|dev-west|… Active profiles: dev, dev-west activates Environment
 PostProcessor

Slide 15

Slide 15 text

USE CASE 2: ENVIRONMENT VARIABLE TRANSLATION Platform Spring Property Environment 
 Variable injects OLD_ENV_VAR=foo
 NEW_ENV_VAR=foo TRANSLATED_PROPERTY=foo activates Environment
 PostProcessor

Slide 16

Slide 16 text

USE CASE 3: DEFAULT PROPERTIES Spring Boot Spring Properties sets default management: tracing: sampling: probability: 0.01 (in local environment) management: tracing: sampling: probability: 1.0 @PropertySource

Slide 17

Slide 17 text

USE CASE 4: TYPE-SAFE ENVIRONMENT VARIABLES Service Descriptor resources: - type: sqs name: my-queue - type: s3 name: my-bucket Platform SQS Queue S3 Bucket reads provisions Environment 
 Variables injects SQS_MY_QUEUE_NAME=…
 SQS_MY_QUEUE_URL=… SQS_MY_QUEUE_ARN=…
 SQS_MY_QUEUE_REGION=… … S3_MY_BUCKET_NAME=…
 S3_MY_BUCKET_PATH=…
 S3_MY_BUCKET_REGION=… … SQSQueueProperties activate S3BucketProperties

Slide 18

Slide 18 text

USE CASE 5: ENFORCE BEST PRACTICE (FLYWAY) Spring Boot Platform integration Flyway migrations on startup enables disables Flyway migration endpoints provides

Slide 19

Slide 19 text

SPRING (BOOT) EXTENSION POINTS Application Context Bean Bean Bean Bean Factory BeanDe fi nitionRegistry BeanFactory
 PostProcessor BeanDe fi nition
 RegistryPost
 Processor
 BeanPostProcessor Environment Environment
 PostProcessor Property Property Property Bean De fi nition Bean De fi nition Bean De fi nition

Slide 20

Slide 20 text

How to consume our integrations?

Slide 21

Slide 21 text

Consuming platform integrations Annotation Con fi Always on Conditionally Manually - using an annotation @Configuration @Import(MyCoolAutoConfiguration.class) public class MyConfiguration { }

Slide 22

Slide 22 text

Consuming platform integrations Annotation Con fi Always on Conditionally Manually - using an annotation @Retention(RetentionPolicy.RUNTIME) @Target({ElementType.TYPE}) @Documented @Import(MyCoolAutoConfiguration.class) public @interface EnableMyCoolFeature { } @Configuration @EnableMyCoolFeature public class MyConfiguration { }

Slide 23

Slide 23 text

Consuming platform integrations Annotation Con fi Always on Conditionally Manually - using an annotation @Configuration @EnableMyCoolFeature public class Application { public static void main(String[] args) { SpringApplication.run( Application.class, args); } }

Slide 24

Slide 24 text

Consuming platform integrations Annotation Con fi Always on Conditionally Manually - using an annotation @Configuration @EnableMyCoolFeature public class Application { public static void main(String[] args) { SpringApplication.run( Application.class, args); } } don’t do this!

Slide 25

Slide 25 text

Consuming platform integrations Manually - using a con fi g property Annotation Con fi g property Always on Conditionally # application.yml my-cool-feature: enabled: true @AutoConfiguration @ConditionalOnProperty( value = "my-cool-feature.enabled", havingValue = "true") public class MyCoolAutoConfiguration { }

Slide 26

Slide 26 text

Consuming platform integrations Automatic - always on Annotation Con fi Always on Conditionally @AutoConfiguration // no @Conditional… annotation public class MyCoolAutoConfiguration { }

Slide 27

Slide 27 text

Consuming platform integrations Automatic - conditionally Annotation Con fi Always on Conditionally @AutoConfiguration @ConditionalOnBean(String.class) public class MyCoolAutoConfiguration { }

Slide 28

Slide 28 text

How to encourage teams to actually use our integrations?

Slide 29

Slide 29 text

THE JAVA TECH STACK @ ATLASSIAN Standards Recommendations for libraries and tools to use. Project setup Has anyone said start.spring.io? Libraries Java libraries for (micro-) service developers. Guides How to do things with the Java platform?

Slide 30

Slide 30 text

Encouraging adoption Standard Paved Path Standard … … … OpenRewrite Support

Slide 31

Slide 31 text

Encouraging adoption Standard Paved Path “Paved Path” for the project lifecycle OpenRewrite Support > atlas path paver install \ micros-spring-boot-mvc

Slide 32

Slide 32 text

Encouraging adoption Standard Paved Path OpenRewrite OpenRewrite Recipes for new versions > ./mvnw \ io.atlassian:java-rewrite:run \ -Drewrite.fromVersion=6.9.0 \ -Drewrite.toVersion=6.12.0 Support

Slide 33

Slide 33 text

Encouraging adoption Awesome support Standard Paved Path OpenRewrite Support

Slide 34

Slide 34 text

Thank you for your patience! @TomHombergs tom@re fl ectoring.io re fl ectoring.io

Slide 35

Slide 35 text

No content