Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Microservices for the Masses with Spring Boot, JHipster, and OAuth - Belfast JUG 2019

96 views

Published on

Microservices are being deployed by many Java Hipsters. If you're working with a large team that needs different release cycles for product components, microservices can be a blessing. If you're working at your VW Restoration Shop and running its online store with your own software, having five services to manage and deploy can be a real pain.

This presentation will show you how to use JHipster to create Angular + Spring Boot apps with a unified front-end. You will leave with the know-how to create your own excellent apps!

Bonus: I'll show you how to use Ionic for JHipster to create native applications on mobile. It's pretty darn slick!

Related blog posts:

* Java Microservices with Spring Boot and Spring Cloud: https://developer.okta.com/blog/2019/05/22/java-microservices-spring-boot-spring-cloud
* Java Microservices with Spring Cloud Config and JHipster: https://developer.okta.com/blog/2019/05/23/java-microservices-spring-cloud-config
* Secure Reactive Microservices with Spring Cloud Gateway: https://developer.okta.com/blog/2019/08/28/reactive-microservices-spring-cloud-gateway

Published in: Software
  • Be the first to comment

  • Be the first to like this

Microservices for the Masses with Spring Boot, JHipster, and OAuth - Belfast JUG 2019

  1. 1. Microservices for the Masses with Spring Boot, JHipster, and OAuth September 5, 2019 Matt Raible | @mraible Photo by Nicolas Raymond on https://www.flickr.com/photos/82955120@N05/7995406469
  2. 2. Do you use microservices?
  3. 3. Blogger on raibledesigns.com and developer.okta.com/blog Web Developer and Java Champion Father, Husband, Skier, Mountain Biker, Whitewater Rafter Open Source Connoisseur Hi, I’m Matt Raible! Bus Lover Okta Developer Advocate
  4. 4. developer.okta.com
  5. 5. What About You?
  6. 6. Agenda 1. Introduction to Microservices 2. Microservices with JHipster 3. Deploying to the Cloud 4. Developing Mobile Apps with JHipster 5. JHipster Roadmap
  7. 7. Part 1 Introduction to Microservices History of Microservices Microservices Architecture Philosophy Why Microservices? Demo: A Microservices Architecture with Spring Boot and Spring Cloud
  8. 8. Microservices Visionaries
  9. 9. “Any organization that designs a system (defined broadly) will produce a design whose structure is a copy of the organization's communication structure.” Conway’s Law Melvin Conway 1967
  10. 10. “Do one thing and do it well.”
  11. 11. “You shouldn't start with a microservices architecture. Instead begin with a monolith, keep it modular, and split it into microservices once the monolith becomes a problem.” Martin Fowler March 2014
  12. 12. start.spring.io
  13. 13. Demo Using start.spring.io, create: A service registry A gateway A catalog service Create an endpoint in the catalog service Create a filtered endpoint in the gateway Show failover capabilities Show Spring Security OAuth https://github.com/oktadeveloper/java- microservices-examples
  14. 14. Java Microservices with Spring Boot and Spring Cloud https://developer.okta.com/blog/2019/05/22/java-microservices-spring-boot-spring-cloud
  15. 15. Microservices with JHipster What is JHipster? Installing and Using JHipster JHipster’s Microservice Features Progressive Web Applications Overview Part 2
  16. 16. What is JHipster? + =
  17. 17. JHipster jhipster.tech JHipster is a development platform to generate, develop and deploy  Spring Boot + Angular/React Web applications and Spring microservices.  and Vue! ✨
  18. 18. JHipster is Inclusive https://github.com/jhipster/jhipster-artwork
  19. 19. A powerful workflow to build your application with Webpack and Maven/Gradle JHipster Goals A sleek, modern, mobile-first front-end with modern frameworks A high-performance and robust Java stack on the server side with Spring Boot A robust microservice architecture with JHipster Registry, Netflix OSS, Elastic Stack, and Docker
  20. 20. How to Use JHipster Install JHipster and Yeoman, using npm: npm install -g generator-jhipster Create a directory and cd into it: mkdir newapp && cd newapp Run it! jhipster
  21. 21. Microservices with JHipster
  22. 22. https://www.jhipster.tech/microservices-architecture
  23. 23. yelp.com/callback Back to redirect URI with authorization code Exchange code for access token and ID token accounts.google.com Email ********** Go to authorization server Redirect URI: yelp.com/cb Scope: openid profile Authorization Server yelp.com Connect with Google Resource owner Client accounts.google.com 
 Allow Yelp to access your public profile and contacts? No Yes Request consent from resource owner Hello Matt! accounts.google Get user info 
 with access token /userinfo OAuth 2.0 and OIDC
  24. 24. Monolith Examples JHipster 6 Demo github.com/mraible/jhipster6-demo youtu.be/uQqlO3IGpTU 21-Points Health github.com/mraible/21-points infoq.com/minibooks/jhipster-mini-book
  25. 25. Progressive Web Apps Originate from a secure origin, load while offline, and reference a web app manifest.
  26. 26. Progressive Web Apps Can be installed on your mobile device, look and act like a native application, but are distributed through the web.
  27. 27. Progressive Web Apps Are fast!
  28. 28. Enable PWA in JHipster <script> if ('serviceWorker' in navigator) { window.addEventListener('load', function() { navigator.serviceWorker.register('/service-worker.js') .then(function () { console.log('Service Worker Registered'); }); }); } </script> gateway/src/main/webapp/index.html
  29. 29. Force HTTPS in Spring Boot gateway/src/main/java/com/okta/developer/gateway/config/SecurityConfiguration.java @Configuration public class SecurityConfiguration extends WebSecurityConfigurerAdapter { @Override protected void configure(HttpSecurity http) throws Exception { http.requiresChannel() .requestMatchers(r -> r.getHeader("X-Forwarded-Proto") != null) .requiresSecure(); } } https://developer.okta.com/blog/2018/07/30/10-ways-to-secure-spring-boot
  30. 30. Demo Using JHipster, create: A gateway A store microservices app A blog microservices app Generate entities in apps and on gateway Convert gateway to be a PWA Run everything in Docker https://github.com/oktadeveloper/java- microservices-examples
  31. 31. JHipster 6.2.0 Lighthouse Report
  32. 32. Part 3 Deploy to the Cloud Options for Deploying JHipster Heroku Cloud Foundry AWS Google Cloud Microsoft Azure
  33. 33. For monoliths: jhipster heroku For microservices: Deploy JHipster Registry Build and deploy microservice Build and deploy gateway http://bit.ly/heroku-jhipster-microservices
  34. 34. For monoliths: jhipster cloudfoundry For microservices: Deploy JHipster Registry Build and deploy microservice Build and deploy gateway https://www.jhipster.tech/cloudfoundry/
  35. 35. Using Elastic Container Service jhipster aws-containers Using Elastic Beanstalk jhipster aws Boxfuse boxfuse run -env=prod http://www.jhipster.tech/aws http://www.jhipster.tech/boxfuse
  36. 36. mvn package -Pprod jib:dockerBuild jhipster kubernetes ./kubectl-apply.sh kubectl get svc gateway https://developer.okta.com/blog/2017/06/20/ develop-microservices-with-jhipster
  37. 37. Part 4 Developing Mobile Apps with JHipster What is Ionic? Why? Ionic Module for JHipster JWT and OIDC Support Entity Generator
  38. 38. Ionic Ionic Framework Develop Hybrid & PWA Apps https://ionicframework.com Stencil Vanilla Web Components https://stenciljs.com PWA Toolkit Lightning fast PWAs https://github.com/ionic- team/ionic-pwa-toolkit
  39. 39. Why? The first version of 21-Points Health I wrote with JHipster 2.x was painful to use on a mobile device. Versions 4.x and 5.x are better, but still not great. I want to develop the best user experience. Native apps are painful to distribute, but work better than PWAs (on iOS).
  40. 40. How is a mobile app for JHipster different from its Angular UI?
  41. 41. Run it! yo jhipster-ionic Ionic Module for JHipster Because Ionic Apps need some JHipster 💙 too! https://github.com/oktadeveloper/generator-jhipster-ionic Install Ionic and the Ionic Module for JHipster, using npm: npm install -g ionic generator-jhipster-ionic Profit! 🤑
  42. 42. Use Ionic for JHipster to Create Mobile Apps https://developer.okta.com/blog/2019/06/24/ionic-4-angular-spring-boot-jhipster
  43. 43. Create an app: ignite new myapp -b ignite-jhipster Ignite JHipster https://github.com/ruddell/ignite-jhipster Install Ignite CLI and Ignite JHipster, using npm: npm i -g ignite-cli ignite-jhipster Ignite! 🔥 A React Native boilerplate for JHipster apps
  44. 44. Build a Mobile App with React Native https://developer.okta.com/blog/2018/10/10/react-native-spring-boot-mobile-app
  45. 45. Demo Create an Ionic 4 app for JHipster Generate entities that exist on gateway Deploy to emulator Deploy to phone https://github.com/oktadeveloper/ okta-ionic4-jhipster-example
  46. 46. Part 5 JHipster Roadmap What You Learned What’s Next for JHipster
  47. 47. What You Learned
  48. 48. Microservices with Spring Cloud Config and JHipster https://developer.okta.com/blog/2019/05/23/java-microservices-spring-cloud-config
  49. 49. JHipster Mobile Apps and Microservices on Pluralsight pluralsight.com/courses/play-by-play-developing-microservices-mobile-apps-jhipster
  50. 50. What’s Next for JHipster? Full Reactive with WebFlux and Spring Cloud Gateway Spring Boot 2.2 GraphQL and Micro Frontends
  51. 51. The JHipster Mini-Book
 Written with Asciidoctor Free download from InfoQ: infoq.com/minibooks/jhipster-mini-book Quick and to the point, 164 pages Developed a real world app: www.21-points.com Buy for $20 or download for FREE
  52. 52. Learn More stackoverflow.com Spring Boot spring.io/guides JHipster www.jhipster.tech Okta APIs developer.okta.com
  53. 53. developer.okta.com/blog @oktadev
  54. 54. Reactive Microservices with Spring Cloud Gateway https://developer.okta.com/blog/2019/08/28/reactive-microservices-spring-cloud-gateway
  55. 55. Action: Try JHipster! https://developer.okta.com/blog/2019/04/04/java-11-java-12-jhipster-oidc
  56. 56. git clone https://github.com/oktadeveloper/okta-spring-webflux-react- example.git https://github.com/oktadeveloper/java-microservices-examples Use the Source, Luke!
  57. 57. Thanks! Keep in Touch raibledesigns.com @mraible Presentations speakerdeck.com/mraible Code github.com/oktadeveloper developer.okta.com
  58. 58. developer.okta.com

×