Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Inside spring.io: a production spring reference...

Brian Clozel
September 09, 2014

Inside spring.io: a production spring reference application

Brian Clozel

September 09, 2014
Tweet

More Decks by Brian Clozel

Other Decks in Programming

Transcript

  1. © 2014 SpringOne 2GX. All rights reserved. Do not distribute

    without permission. Inside spring.io: a Production Spring Reference Application Brian Clozel - @brianclozel
  2. …and, well, me. ! Brian Clozel ! • Spring Framework

    committer • Sagan developer • Bad at Photoshop @brianclozel
  3. Why did we open source Sagan? ! ! • The

    Example/Sample App problem • The Reference App problem • We’re committed to Open Source
  4. Writing blog posts ! ! • spring.io/blog • Project Sagan:

    open sourcing spring.io • Project Sagan: zero downtime deployments • Project Sagan: client side architecture • Project Sagan: upgrading to JDK 8
  5. Partial/total rewrites ! • Getting started experience… • JDK8 features

    • Code architecture • Client side architecture
  6. Build integration with Gradle 1/2 ! // install NPM dependencies!

    task npmInstall(type:Exec) {! inputs.files "package.json", "bower.json"! outputs.dir "node_modules"! commandLine 'npm', 'install'! }! // run the Gulp.js build! task npmBuild(dependsOn: npmInstall, type:Exec) {! inputs.dir "src"! inputs.file "gulpfile.js"! outputs.dir "dist"! commandLine 'npm', 'run', 'build'! }
  7. Build integration with Gradle 2/2 apply plugin: 'java'! // create

    a webjar to be served by the sagan-site module! jar {! from 'dist'! eachFile { ! details -> details.path = ! details.path.startsWith('META-INF') ?: 'static/'+details.path! }! }! ! jar.dependsOn npmBuild
  8. Modular JavaScript application // using curl.js as a module loader!

    curl.config({! packages: {! app: { location: 'app'}! },! paths: {! jquery: 'lib/jquery/jquery.min',! ! gmaps: {location: 'lib/gmaps/gmaps', config:cjsConfig }, ! }! });! ! // Promises-based API for executing callbacks! curl(['app', 'jquery']).then(start, fail);
  9. Gulp, a streaming build system // concatenate and minify CSS

    files! gulp.task('minify-css', function() {! return gulp.src('src/css/*.css')! .pipe(cssmin({root: 'src/css'}))! .pipe(gulp.dest('./dist/css'));! });! ! // tasks run in parallel! gulp.task('build', [‘minify-css', 'bower-files'], function(){ });
  10. Gulp, a streaming build system // using cram and uglify

    to concatenate and minify! gulp.task(‘build-modules', function() {! return cram(paths.run, opts).into("run.js")! .pipe(sourcemaps.init())! .pipe(uglify())! .pipe(sourcemaps.write("./"))! .pipe(gulp.dest('./dist/'));! })!
  11. Early feedback for Spring Framework ! • Changed our opinion

    on Resource Handling • Real client side experience • « Project Sagan: client-side architecture » • « JavaScript modularity, without the buzzwords » Resource Handling in Spring 4.1 • Rossen Stoyanchev & Brian Clozel • Tomorrow 8:30AM
  12. Spring Boot, in production > 1 year “Spring Boot lets

    you pair-program with the Spring team. Josh Long, @starbuxman
  13. Boot Actuators ! curl spring.io/info! ! curl spring.io/autoconfig! ! curl

    spring.io/health! ! curl spring.io/beans! ! * some endpoints are protected!
  14. Green/Blue: Session management? ! • PWS default: sticky sessions •

    CF java-buildpack: session replication with Redis • No Sessions :-)
  15. Green/Blue: DB schema updates? ! • Sagan: FlywayDB • Divide

    and conquer (read-only flags) • DB Store that fits your needs
  16. Sagan - services architecture 45 sagan-site hosted on GET http://spring.io

    search - get raw guides - render blogs ElephantSQL
  17. What I’ve learned ! • With small or distributed teams:

    • time spent on managing issues is important • contributor/developer experience is a top priority • Always learn with monitoring, profiling • In cloud environments: • you can throw resources at problems • or use the marketplace (scale better, save money)
  18. Sagan is ! • An reference app • An open

    source project • A space for discussion and experiments • A JDK8, Spring 4, Spring Boot, critical app in production