G3 Summit 2016 - Dockerize your Grails!

4,483 views

Published on

The containers and particularly Docker have been one of the buzzwords of the last years, but do they offer what they promise?

In this talk will see a basic Docker 101 introduction and then will see how we can take advantages of all its features for developing and deploying our Grails applications.

Published in: Technology
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
4,483
On SlideShare
0
From Embeds
0
Number of Embeds
4,129
Actions
Shares
0
Downloads
1
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

G3 Summit 2016 - Dockerize your Grails!

  1. 1. G3 Summit Dockerize your Grails! Iván López - @ilopmar
  2. 2. ➢ Iván López - @ilopmar ➢ Groovy & Grails developer Member of Grails team at OCI ➢ @MadridGUG coordinator http://www.madridgug.com ➢ Greach organizer (@greachconf) http://greachconf.com ➢ Speaker: SpringOne 2GX, GR8Conf, Codemotion, GeeCon, Spring IO, Greach, JavaCro, RigaDevDay,... About me...
  3. 3. 1. Problems
  4. 4. If there was another way... Please, kill me to end my pain!
  5. 5. 2. Docker
  6. 6. Basics about Docker ➢ Portable runtime for the app ➢ Run each app in its own isolated container ➢ Eliminate concerns about compatibility on different platforms ➢ Like a VM without the overhead of a VM ➢ Lightweight than a VM
  7. 7. Hypervisor Host OS Server VM App A Guest OS Bins/ Libs App A' Guest OS Bins/ Libs App B Guest OS Bins/ Libs Docker Host OS Server Bins/Libs Container Bins/Libs VM vs Docker A p p A A p p A' A p p B A p p B' A p p B' A p p B'
  8. 8. $ docker run --rm ubuntu echo “Hello G3Summit!” Hello G3Summit! Basics
  9. 9. $ docker run --rm java:9 java -version openjdk version "9-Debian" OpenJDK Runtime Environment (build 9-Debian+0-9b140-1) OpenJDK 64-Bit Server VM (build 9-Debian+0-9b140-1, mixed mode) $ alias java="docker run --rm java:9 java" $ java -version Basics
  10. 10. Create image FROM nginx:1.11.5 COPY index.html /usr/share/nginx/html/ EXPOSE 80 CMD ["nginx", "-g", "daemon off;"] Dockerfile <h1>Hello G3Summit!</h1> index.html
  11. 11. $ docker build -t g3summit . Sending build context to Docker daemon 3.072 kB Step 1 : FROM nginx:1.11.5 ---> 6dde4f9ae735 Step 2 : COPY index.html /usr/share/nginx/html/ ---> c1c0f4eeffe4 Removing intermediate container 08fb8441e6be Step 3 : EXPOSE 80 ---> Running in 4d6151c06c9b ---> e07151354dc9 Removing intermediate container 4d6151c06c9b Step 4 : CMD nginx -g daemon off; ---> Running in 8edd425ce757 ---> ef945069377f Removing intermediate container 8edd425ce757 Successfully built ef945069377f Create image
  12. 12. $ docker run --rm -p 1234:80 g3summit Running our image
  13. 13. $ docker run -it -p 1234:80 greach Running our image $ docker run --rm -p 1234:80 g3summit
  14. 14. 3. Grails & Docker
  15. 15. Let’s fix the problems! ➢ Install Docker ➢ Clone the repo ➢ Run script ➢ Profit!
  16. 16. Our application Producer Consumer Debian 8 Java 8 RabbitMQ 3.6 Postgres 9.4Grails 3.2.3
  17. 17. Two options The easy way One image to rule them all
  18. 18. The easy way ➢ Everything installed on the same container ➢ More than one process per container (!!) ➢ Easy to maintain and use ➢ Focused only on development
  19. 19. Two options The flexible way Orchestration to the rescue
  20. 20. The flexible way ➢ Each application in different container ➢ Only one process per container ➢ More complicated to maintain ➢ More flexible and ready for other environments
  21. 21. 4. Demo
  22. 22. 5. Summary
  23. 23. Summary Easy to start being productive Developers have the exact environment Control the exact version of everything Orchestration is more complicated But it's more powerful Everyone is happy
  24. 24. Thank you! Questions? http://bit.ly/g3summit-docker @ilopmar lopez.ivan@gmail.com https://github.com/ilopmar Iván López

×