51
Unless otherwise indicated, these slides are © 2013-2014 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Real-World Boot-Up Sequences: QuickBooks Self-Employed By Tim Hobson Engineer @

Panel Session: Real World Boot-Up Sequences

Embed Size (px)

DESCRIPTION

In this Panel session, each of these presenters will have 20 minutes to respond to the question: tell us about your experiences with Spring Boot? Following that is about 30 minutes of moderated panel discussion. Erdem Gunay from Turkcell will present his experience of re-writing a Mobile BaaS originally written with Spring 3.x. He wrote the service from scratch using Boot in one week, integrating spring security, elasticsearch, mongodb, camel, angular.js, for the win: 40x throughput, 100% availability - zero crashes, 3x the users - used on 300k mobile devices. Tim Hobson from Intuit will present his lessons learned from using with Boot - he will take you through what configuration was necessary, what needed to be built, and how the project leveraged Boot to minimize cross-cutting code and configuration, maximize testability, and focus on the application domain. Zach will present a view of Boot from the hospitality industry, where they are using JAX-RS, DropWizard, and Spring Boot to create micro-service applications. He will help you understand which dropwizard-spring integrations work, and which one's don't, what to watch out for, and how to integrate your Spring applications into dropwizard whether you configure your Spring applications with xml, annotations, and/or java config files.

Citation preview

Page 1: Panel Session: Real World Boot-Up Sequences

Unless otherwise indicated, these slides are © 2013-2014 Pivotal Software, Inc. and licensed under a

Creative Commons Attribution-NonCommercial l icense: http://creativecommons.org/licenses/by-nc/3.0/

Real-World Boot-Up Sequences:

QuickBooks Self-Employed

By Tim Hobson – Engineer @

Page 2: Panel Session: Real World Boot-Up Sequences

About Me

• Software Developer with a bad habit of leveraging frameworks

• Not a fan of re-inventing wheels every project

• Still believe you can move fast with good architecture

2

so old

Page 3: Panel Session: Real World Boot-Up Sequences

About Our Product

3

Providing financial management

and compliance solutions for the

Self-Employed in the US and

(soon) globally.

Launched this year and

continuously releasing new

functionality.

very new

Page 4: Panel Session: Real World Boot-Up Sequences

Context – In the Beginning…

New to the world offering, evolving product features

Be ready to pivot, pivot, and

pivot again

4

very ambitious

0 customers, aspirations

of millions

0 lines of code

Aggressive timeline for

initial release

Proven scale-ability,

extensibility required

No legacy, but need to

establish patterns early

Dev/Ops Productivity

essential

Page 5: Panel Session: Real World Boot-Up Sequences

My Requirements

5

such needs

Page 6: Panel Session: Real World Boot-Up Sequences

Powerful AND Simple?

6

?so

inconceivable

Page 7: Panel Session: Real World Boot-Up Sequences

Tell us about your experiences with Spring Boot?

• No XML Config? No web.xml?

• Started prototyping with v0.5

• Bugs found, worked around

them

• Engaged with Spring Team

• Saw continual improvement

• …

7

such promise

Page 8: Panel Session: Real World Boot-Up Sequences

Growing Pains

• WAR-based deployment

• myBatis Spring

• Understanding magic (Source debugging)

• @Conditional* …

• Cost-benefit analysis of defying convention

• Security customizations

• Web Sockets through multiple routers, apache httpd

8

concern

Page 9: Panel Session: Real World Boot-Up Sequences

Tell us about your experiences with Spring Boot?

Cont’d

• Decided to adopt and GO

• Great Success!

• In production since May

• Rolling out new features every few

weeks

• Just released mobile companion

apps

9

amaze

Page 10: Panel Session: Real World Boot-Up Sequences

Observations on what made it work

• Sample apps, documentation

• Enthusiasm, Evangelism and Direction from the Spring team

• Accessible source code with tests you can run!

• Developer inclusion in the process – ideas, contributions, fixes

• Truly no xml configuration – ever, as promised

• Massively simplified POMs

• Developer productivity

• Magic

• I would take this framework with me…

10

wow

Page 11: Panel Session: Real World Boot-Up Sequences

On The Shoulders of Giants…

• General– @EnableAutoConfiguration– @EnableConfigurationProperties– YAML Configuration & Profiles

– “Starter” Dependency Management

– Boot Actuator

– ResourceBundleMessageSource– @Aspect– @EnableAspectJAutoProxy– @EnableTransactionManagement– @PersistenceContext– @EnableJpaRepositories– @Async– @EnableAsync

• Web– @EnableMvcSecurity– @EnableWebMvcSecurity– @EnableWebSocketMessageBroker– @ControllerAdvice– @ModelAttribute– @ExceptionHandler– SpringBootServletInitializer

• Batch– CRaSH ssh

– @EnableBatchProcessing– @EnableScheduling– @Scheduled– @Job

11

so enabled

Page 12: Panel Session: Real World Boot-Up Sequences

What we configured/overrode/extended/built

• General• Data Migration (flywaydb)

• JpaVendorAdapter & EntityManagerFactory

• Batch• Always-on Batch process with @Scheduled

jobs

• On-demand batch job execution using CRaSH groovy commands

• Security• CSRF support for AngularJS

(HttpSessionCsrfTokenRepository)

• Custom Identity/Auth provider for Spring Security

• Hybrid Thymeleaf + Angular UI

• REST Authentication/Authorization

• Session Expiry, Authentication Failure, AccessDenied Handler

• Web• Container Customization (error pages)

• Unsupported Browser handling

• JS Min/SASS Build integration for Maven (exec-maven) calling compass and uglify

• Static asset versioning (git.properties)

12

such customize

Page 13: Panel Session: Real World Boot-Up Sequences

Dev/Ops

• Actuator security

• Custom HealthIndicator• Custom Admin web console (leveraging Actuator

APIs, custom health checks) for ops and customer support

• SLF4J Logging with Logback and Splunk-friendly output

• Server-side error logging for Angular client

• On-demand user-level debug logging

• Memcache session storage to support automated rolling deployments

13

very sudo

Page 14: Panel Session: Real World Boot-Up Sequences

Testing – Mocks and “System” Testing

14

@EnableAutoConfiguration@Profile("test")

@Beanpublic DataSource dataSource() {

return new EmbeddedDatabaseBuilder().setType(H2).build();}

@ActiveProfiles("test")@WebAppConfiguration@SpringApplicationConfiguration(classes={ApplicationConfig.class, TestConfig.class})…

public class UserControllerTest extends AbstractTestNGSpringContextTests {

private MockMvc mvc;

@BeforeClasspublic void setUp() {this.mvc = MockMvcBuilders.webAppContextSetup(this.context).build();

}

@Mockprivate Authentication authentication;…@BeforeTestpublic void setUp() {

MockitoAnnotations.initMocks(this);}

such ease

Page 15: Panel Session: Real World Boot-Up Sequences

What’s Next?

15

Reactor

AMQP (RabbitMQ)

spring-session

Spring IO

Page 16: Panel Session: Real World Boot-Up Sequences

Thanks!

Questions?

16

@hoserdude

@hoserdude

@hoserdude

hoserdude.com

Page 17: Panel Session: Real World Boot-Up Sequences

Unless o therwise indicated, these slides are © 2013 -2014 Pivo tal So f tware, Inc. and licensed under a

Creative Commons Attribution-NonCommercial license: http://creativecommons.o rg/licenses/by -nc/3.0/

Unless o therwise indicated, these slides are © 2013 -2014 Pivo tal So f tware, Inc. and licensed under a

Creative Commons Attribution-NonCommercial license: http://creativecommons.o rg/licenses/by -nc/3.0/

Porting legacy apps to Spring Boot in one week

By Erdem Günay (@gunayus)

Page 18: Panel Session: Real World Boot-Up Sequences

Unless o therwise indicated, these slides are © 2013 -2014 Pivo tal So f tware, Inc. and licensed under a

Creative Commons Attribution-NonCommercial license: http://creativecommons.o rg/licenses/by -nc/3.0/

About Turkcell

2

Page 19: Panel Session: Real World Boot-Up Sequences

Unless o therwise indicated, these slides are © 2013 -2014 Pivo tal So f tware, Inc. and licensed under a

Creative Commons Attribution-NonCommercial license: http://creativecommons.o rg/licenses/by -nc/3.0/

About Turkcell

3

Page 20: Panel Session: Real World Boot-Up Sequences

Unless o therwise indicated, these slides are © 2013 -2014 Pivo tal So f tware, Inc. and licensed under a

Creative Commons Attribution-NonCommercial license: http://creativecommons.o rg/licenses/by -nc/3.0/

How I met Spring Boot?

4

Page 21: Panel Session: Real World Boot-Up Sequences

Unless o therwise indicated, these slides are © 2013 -2014 Pivo tal So f tware, Inc. and licensed under a

Creative Commons Attribution-NonCommercial license: http://creativecommons.o rg/licenses/by -nc/3.0/

Turkcell Video – legacy BaaS

5

Page 22: Panel Session: Real World Boot-Up Sequences

Unless o therwise indicated, these slides are © 2013 -2014 Pivo tal So f tware, Inc. and licensed under a

Creative Commons Attribution-NonCommercial license: http://creativecommons.o rg/licenses/by -nc/3.0/

Turkcell Video – legacy BaaS

6

Page 23: Panel Session: Real World Boot-Up Sequences

Unless o therwise indicated, these slides are © 2013 -2014 Pivo tal So f tware, Inc. and licensed under a

Creative Commons Attribution-NonCommercial license: http://creativecommons.o rg/licenses/by -nc/3.0/

Porting to Spring Boot – end of 1st hour

7

http://spring.io/guides/gs/actuator-service/

Page 24: Panel Session: Real World Boot-Up Sequences

Unless o therwise indicated, these slides are © 2013 -2014 Pivo tal So f tware, Inc. and licensed under a

Creative Commons Attribution-NonCommercial license: http://creativecommons.o rg/licenses/by -nc/3.0/ 8

Porting to Spring Boot – end of 1st day

Page 25: Panel Session: Real World Boot-Up Sequences

Unless o therwise indicated, these slides are © 2013 -2014 Pivo tal So f tware, Inc. and licensed under a

Creative Commons Attribution-NonCommercial license: http://creativecommons.o rg/licenses/by -nc/3.0/ 9

Porting to Spring Boot – end of 1st day

Page 26: Panel Session: Real World Boot-Up Sequences

Unless o therwise indicated, these slides are © 2013 -2014 Pivo tal So f tware, Inc. and licensed under a

Creative Commons Attribution-NonCommercial license: http://creativecommons.o rg/licenses/by -nc/3.0/

Porting to Spring Boot – end of the week

• All the legacy REST APIs are migrated to @RestController(s)

• Architecture is redesigned

• Reimplemented as true, simple Spring 4 web application

• Zero mobile client update

• Faster development, running & debugging

• Jboss netty Apache web server & Tomcat 7

10

Page 27: Panel Session: Real World Boot-Up Sequences

Unless o therwise indicated, these slides are © 2013 -2014 Pivo tal So f tware, Inc. and licensed under a

Creative Commons Attribution-NonCommercial license: http://creativecommons.o rg/licenses/by -nc/3.0/ 11

Porting to Spring Boot – number of sessions

%100

Page 28: Panel Session: Real World Boot-Up Sequences

Unless o therwise indicated, these slides are © 2013 -2014 Pivo tal So f tware, Inc. and licensed under a

Creative Commons Attribution-NonCommercial license: http://creativecommons.o rg/licenses/by -nc/3.0/

Porting to Spring Boot – throughput

12

0

50

100

150

200

250

300

350

400

450

500

Throughput (GB)

Total

Page 29: Panel Session: Real World Boot-Up Sequences

Unless o therwise indicated, these slides are © 2013 -2014 Pivo tal So f tware, Inc. and licensed under a

Creative Commons Attribution-NonCommercial license: http://creativecommons.o rg/licenses/by -nc/3.0/ 13

Android Remote App Configuration

Page 30: Panel Session: Real World Boot-Up Sequences

Unless o therwise indicated, these slides are © 2013 -2014 Pivo tal So f tware, Inc. and licensed under a

Creative Commons Attribution-NonCommercial license: http://creativecommons.o rg/licenses/by -nc/3.0/ 14

Android Remote App Configuration

Page 31: Panel Session: Real World Boot-Up Sequences

Unless o therwise indicated, these slides are © 2013 -2014 Pivo tal So f tware, Inc. and licensed under a

Creative Commons Attribution-NonCommercial license: http://creativecommons.o rg/licenses/by -nc/3.0/

Android Remote App Configuration

[operation] == 'command' and [manufacturer] == ‘turkcell' and [model] == 't50‘

{

"operation": "command",

"manufacturer": "turkcell",

"model": "t50", "appVersion": "31",

"board": "MSM8226",

"device": "msm8226",

"hardware": "qcom",

"networkCountryIso": "tr",

"resolution": "720x1184"

}

15

Page 32: Panel Session: Real World Boot-Up Sequences

Unless o therwise indicated, these slides are © 2013 -2014 Pivo tal So f tware, Inc. and licensed under a

Creative Commons Attribution-NonCommercial license: http://creativecommons.o rg/licenses/by -nc/3.0/

Ongoing projects

• All new projects are "bootiful"

• Object storage project with 1 Million users and 2 PB storage

capacity

• Mobile analytics platform 90 Million transactions per day

16

Spring

Framework

Spring

Security

Spring

Data

Spring

Integration

Spring

Social

Spring REST &

Web Services

Spring

Boot

Page 33: Panel Session: Real World Boot-Up Sequences

Unless o therwise indicated, these slides are © 2013 -2014 Pivo tal So f tware, Inc. and licensed under a

Creative Commons Attribution-NonCommercial license: http://creativecommons.o rg/licenses/by -nc/3.0/

Thanks

17

@gunayus

Page 34: Panel Session: Real World Boot-Up Sequences

Unless otherwise indicated, these slides are © 2013-2014 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/

REAL WORLD BOOT-UP SEQUENCESBy Zach Lendon

@zachlendon

Page 35: Panel Session: Real World Boot-Up Sequences

Unless otherwise indicated, these slides are © 2013-2014 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/

2

How a Journey to Spring Boot is helping save our enterprise brownfield

2

How a Journey to Spring Boot is helping save our enterprise brownfield

Page 36: Panel Session: Real World Boot-Up Sequences

Unless otherwise indicated, these slides are © 2013-2014 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/

Code examples/links/slides

3

https://github.com/zachlendon/SpringOne2GX-2014 Or - contact me! More details/help available

Page 37: Panel Session: Real World Boot-Up Sequences

Unless otherwise indicated, these slides are © 2013-2014 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/

Requisite Josh Long (@starbuxman) Quote

4

Page 38: Panel Session: Real World Boot-Up Sequences

Unless otherwise indicated, these slides are © 2013-2014 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/

5

“Any application of sufficient complexity eventually sprouts a REST API”

- Josh Long, Building ‘Bootiful’ Applications with Spring Boot

Page 39: Panel Session: Real World Boot-Up Sequences

Unless otherwise indicated, these slides are © 2013-2014 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/

6

“We need a ‘RESTful’ API”

• Large Spring Framework “Web Application” used for nearly all facets of hotel-related functionality you can do online

• However, rise in non-web applications, specifically mobile, required a new way to access functionality built into the existing web application

Page 40: Panel Session: Real World Boot-Up Sequences

Unless otherwise indicated, these slides are © 2013-2014 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/

7

Enterprise Projects have “unique” constraints

• Re-use large, diverse set of existing ‘Spring’ services wherever possible, many of which are wired using - dare I say it - XML.

• Use JAX-RS • Re-use existing JAXB definitions, custom marshallers,

validators, etc • Any architectural changes in direction need to be gradual • Approachable technology solutions for a diverse team with

varying skill-sets, OS’s, etc.

Page 41: Panel Session: Real World Boot-Up Sequences

Unless otherwise indicated, these slides are © 2013-2014 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/

8

Some Software Architecture Goals

• Standardize on, by using and/or extend, “best-of-breed” solutions around ancillary API functionality (logging, metrics, etc.) where possible instead of “home-grown” solutions

• Continue to support present-day devops and management comfort with WAR deployment while changing underlying structure to support future-day potential microservice-based dynamic build and deployment options

• Simplify • Provide Efficient, quality test coverage

Page 42: Panel Session: Real World Boot-Up Sequences

Unless otherwise indicated, these slides are © 2013-2014 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/

Project Technology Implementation

9

Page 43: Panel Session: Real World Boot-Up Sequences

Unless otherwise indicated, these slides are © 2013-2014 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/

10

Key Software Technologies Introduced / Explored

Technologies WhyGradle Build flexibility

Groovy / Spock Test Efficiency

Spring + Jersey Known core technology foundation Ultimate flexibility in adding future “pieces”

Still have flexibility to use Dropwizard

dropwizard-spring (hmsonline) Clean Dropwizard + Spring integration

Spring BootKnown, opinionated, simpler core tech foundation

Ultimate flexibility in adding future “pieces” Dropwizard similarities yet more

Page 44: Panel Session: Real World Boot-Up Sequences

Unless otherwise indicated, these slides are © 2013-2014 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/

11

Spring + Jersey

• Configure Jersey ResourceConfig • Register your Jersey JAX-RS resources • Register RequestContextFilter • Register other Jersey Components

• Configure JerseyServlet • @Configuration or web.xml

• Setup Jersey JAX-RS Resources • Bean dependencies

• @Component and auto-wiring (@Autowire) • JSR-330 and @Inject

Page 45: Panel Session: Real World Boot-Up Sequences

Unless otherwise indicated, these slides are © 2013-2014 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/

12

Spring + Jersey : Technical Thoughts : Pros/Cons

• Register your own custom Jersey ObjectMapper to provide data serialization/deserialization hooks

• Spring and Jersey are Best-of-breed solutions that technically fit together nicely and easily

• Developer-friendly and test-friendly • A production-tested solution around for several years

• Not an opinionated or full-stack solution = pro and con • Lack of out-of-the-box related features to easily leverage

• Not lightweight (WAR only) • not micro-service ready

Page 46: Panel Session: Real World Boot-Up Sequences

Unless otherwise indicated, these slides are © 2013-2014 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/

13

Dropwizard-Spring

• Open-sourced by Health Market Science (https://github.com/hmsonline/dropwizard-spring)

• Can configure Jersey resources as Spring @Component • Can configure your Dropwizard components entirely with Spring

through YAML configuration file • Can extend project’s SpringService to hook into Spring /

Dropwizard “marrying” to add/modify behavior

Page 47: Panel Session: Real World Boot-Up Sequences

Unless otherwise indicated, these slides are © 2013-2014 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/

14

Dropwizard-Spring : Technical Thoughts : Pros/Cons

• Use Gradle • Gradle Shadow over Maven Shadow

• Use swagger-jaxrs-groovydoclet for creating Swagger artifacts from Groovy doc

• JAR only deployment (out of box) • Combining potential enterprise leeriness around Dropwizard with

a custom solution to tie it with existing Spring infrastructure

Page 48: Panel Session: Real World Boot-Up Sequences

Unless otherwise indicated, these slides are © 2013-2014 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/

15

Spring Boot + Jersey

• Manual or use Jersey auto configuration from https://github.com/dsyer/spring-boot-jersey

• Auto-configuration allows Spring Boot to find JerseyConfig @Component and setup Jersey for you

• Spring-boot-actuator provides management and monitoring features similar to features Dropwizard surrounds Jersey with

• @AopAutoConfiguration can simplify your AOP/AspectJ mess • Embedded Servlet container (for JAR) vs still supporting WAR

deployment • Groovy & Spock friendly

Page 49: Panel Session: Real World Boot-Up Sequences

Unless otherwise indicated, these slides are © 2013-2014 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/

16

Spring Boot : Technical Thoughts : Pros/Cons

• Integration of Best of Breed Technologies (Spring, Jersey) with strong up-and-coming candidate in Spring Boot, from a known entity already in many enterprises

• Deploy as JAR or WAR huge for enterprise devops • Opinionated app foundation helps:

• set repeatable patterns for how to approach build-out of API and related services

• wrangle dependency tree, ease configuration overload/meltdown, lessen upgrade burden pain

Page 50: Panel Session: Real World Boot-Up Sequences

Unless otherwise indicated, these slides are © 2013-2014 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/

17

Conclusion

• Lots of options for creating RESTful services with Spring, even when limited to specific technology choices (for better or worse)

• Spring Boot’s use cases are many • Help developers with app infrastructure and ancillary services so

that they can have best tools available at their disposal for building custom solutions

• Not just for greenfield - Spring Boot can be your gateway drug to a more modular/micro-service future for your brownfield application(s) as well

• Don’t be afraid to create your own Spring Boot configured components for maintainability of your project and use by other projects at your company (or by community if possible!)

Page 51: Panel Session: Real World Boot-Up Sequences

Unless otherwise indicated, these slides are © 2013-2014 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ 18

Learn More. Stay Connected

Spring Boot is not just for greenfield! Don’t be afraid to gradually introduce in

existing apps big and small

Micro Service Architecture with Spring Boot and Groovy

Thurs, 8:30 with Marco Vermeulen

@springcentral | spring.io/video