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.

jdays 2015

733 views

Published on

Twelve Factor apps are built for agility and rapid deployment. They enable continuous delivery and reduce the time and cost for new developers to join a project. At the same time, they are architected to exploit the principles of modern cloud platforms while permitting maximum portability between them. Finally, they can scale up without significant changes to tooling, architecture or development practices. In this talk, you will learn the principles and best practices espoused by the Twelve Factor app. We'll discuss how to structure your code, manage dependencies, store configuration, run admin tasks, capture log files, and more. You'll learn how modern Java deployments can benefit from adopting these principles, and why they fit nicely within the cloud.

Published in: Internet
  • Hello there! Get Your Professional Job-Winning Resume Here! http://bit.ly/topresum
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here

jdays 2015

  1. 1. 12 Factor App Best Practices for JVM Deployment
  2. 2. 12 Factor App Best Practices for JVM Deployment Java doesn’t suck when you do things this way
  3. 3. XML sucks
  4. 4. 10 page wikis to set up your app suck
  5. 5. Incongruent environments suck DEV ≠ PROD
  6. 6. Apps that take more than 30 seconds to start up suck
  7. 7. Recompiling your entire codebase after fixing a typo sucks
  8. 8. Monolithic apps suck
  9. 9. The Java language sucks
  10. 10. But Java doesn’t suck
  11. 11. What does modern Java development look like?
  12. 12. Joe Kutner @codefinger JVM Languages Owner @Heroku Joe Kutner
  13. 13. 12 Factor App a methodology Scalability Maintainability Portability
  14. 14. 12 Factor App a methodology Continuous Delivery
  15. 15. 12 Factor App a methodology Sleeping at Night
  16. 16. Continuous Delivery Sleep
  17. 17. The 12 Factors • Codebase • Dependencies • Config • Backing services • Build, release, run • Processes • Port binding • Concurrency • Disposability • Dev/prod parity • Logs • Admin processes
  18. 18. The 12 Factors • Codebase • Dependencies • Config • Backing services • Build, release, run • Processes • Port binding • Concurrency • Disposability • Dev/prod parity • Logs • Admin processes
  19. 19. Graceful shutdown Quick startup Resilience to failure | Disposability |
  20. 20. | Disposability | Application Servers are not disposable
  21. 21. Application Servers are not disposable | Disposability |
  22. 22. | Disposability | Microservices are disposable
  23. 23. | Disposability | Easy to replace Decoupled from external infrastructure Easy to modify
  24. 24. | Disposability | Microservices Java Groovy Scala Clojure Scala Scala
  25. 25. Standalone ➤ Disposable | Disposability |
  26. 26. Bootable ➤ Disposable | Disposability |
  27. 27. The 12 Factors • Codebase • Dependencies • Config • Backing services • Build, release, run • Processes • Port binding • Concurrency • Disposability • Dev/prod parity • Logs • Admin processes
  28. 28. dev sqlite postgres stage mysql postgres prod postgres postgres = ≠ = = ≠ = | Disposable | Parity |
  29. 29. dev jetty jetty stage tomcat jetty prod jboss jetty = ≠ = = ≠ = | Disposable | Parity |
  30. 30. | Disposable | Parity | dev jetty {} stage tomcat {} prod jboss {} = ≠ = = ≠ =
  31. 31. .war Traditional JVM Deployment
  32. 32. .jar Modern JVM Deployment
  33. 33. Reproducible ➤ Parity | Disposable | Parity |
  34. 34. Reproducible ➤ Disposable | Disposable | Parity |
  35. 35. The 12 Factors • Codebase • Dependencies • Config • Backing services • Build, release, run • Processes • Port binding • Concurrency • Disposability • Dev/prod parity • Logs • Admin processes
  36. 36. Configuration belongs in the environment, not in the application Configuration should be strictly separated from code | Disposable | Parity | Config |
  37. 37. Linux Tomcat WAR server.xml context.xml web.xml /etc/... | Disposable | Parity | Config |
  38. 38. Environment Java Application PATH DATABASE_URL AWS_ACCESS_TOKEN JAVA_OPTS | Disposable | Parity | Config |
  39. 39. Containerless ➤ Separation | Disposable | Parity | Config |
  40. 40. Containerless ➤ Parity | Disposable | Parity | Config |
  41. 41. Containerless ➤ Disposable | Disposable | Parity | Config |
  42. 42. Containerless ➤ 12 Factor App | Disposable | Parity | Config |
  43. 43. Containerless Containerless Containerless | Disposable | Parity | Config |
  44. 44. Dropwizard
  45. 45. @Configuration @EnableAutoConfiguration @ComponentScan public class Main { public static void main(String[] args) { SpringApplication.run(Main.class, args); } }
  46. 46. import org.eclipse.jetty.server.Server; import org.eclipse.jetty.servlet.*; public class Main { public static void main(String[] args) throws Exception { Server server = new Server(); ServletContextHandler context = new ServletContextHandler( ServletContextHandler.SESSIONS); context.setContextPath("/"); server.setHandler(context); context.addServlet(new ServletHolder(new App()), "/*"); server.start(); server.join(); } }
  47. 47. (defn -main [& [port]] (jetty/run-jetty (site #'app) {:port port :join? false}))
  48. 48. // Play example does not require any code
  49. 49. The 12 Factors • Codebase • Dependencies • Config • Backing services • Build, release, run • Processes • Port binding • Concurrency • Disposability • Dev/prod parity • Logs • Admin processes
  50. 50. | Disposable | Parity | Config | Concurrency | Scale Up Scale Out
  51. 51. | Disposable | Parity | Config | Concurrency | web.1 web.2 worker.1 clock.1 Workload Diversity NumberofProcesses worker.2 worker.3
  52. 52. The 12 Factors • Codebase • Dependencies • Config • Backing services • Build, release, run • Processes • Port binding • Concurrency • Disposability • Dev/prod parity • Logs • Admin processes
  53. 53. | Disposable | Parity | Config | Concurrency | Admin | Admin tasks should be run in isolated processes
  54. 54. web1 web2 web3 admin | Disposable | Parity | Config | Concurrency | Admin |
  55. 55. The 12 Factors • Codebase • Dependencies • Config • Backing services • Build, release, run • Processes • Port binding • Concurrency • Disposability • Dev/prod parity • Logs • Admin processes
  56. 56. TODO List
  57. 57. Install the JDK Three Steps to Setup Your App Clone the SCM repo Run the app
  58. 58. Get it under 30 seconds Time your app’s startup Get a stopwatch Make Your App Startup Quick
  59. 59. Deploy or Scale Your App in One Step Handle requests Deploy the app Provision a new environment
  60. 60. http://12factor.net
  61. 61. Java Doesn’t Suck
  62. 62. Java Doesn’t Suck (if you use it the right way)
  63. 63. Joe Kutner @codefinger JVM Languages Owner @Heroku http://www.slideshare.net/jkutner/jdays-2015

×