Dockerize your Grails!
Iván López - @ilopmar
➢ 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, G3 Summit, Spring IO, Greach, RigaDevDay,...
About me...
1.
Problems
If there was
another way...
Please, kill me to
end my pain!
2.
Docker
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
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'
$ docker run --rm ubuntu echo “Hello GR8Conf!”
Hello GR8Conf!
Basics
$ 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
Create image
FROM nginx:1.13.3
COPY index.html /usr/share/nginx/html/
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]
Dockerfile
<h1>Hello GR8Conf!</h1>
index.html
$ docker build -t gr8conf .
Sending build context to Docker daemon 3.072 kB
Step 1 : FROM nginx:1.13.3
---> 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
$ docker run --rm -p 1234:80 gr8conf
Running our image
$ docker run -it -p 1234:80 greach
Running our image
$ docker run --rm -p 1234:80 g3summit
3.
Grails & Docker
Let’s fix the problems!
➢ Install Docker
➢ Clone the repo
➢ Run script
➢ Profit!
Our application
Producer Consumer
Debian 9 Java 8 RabbitMQ 3.6 Postgres 9.6Grails 3.3.0.RC1
Two options
The easy way
One image to rule them all
The easy way
➢ Everything installed on the same container
➢ More than one process per container (!!)
➢ Easy to maintain and use
➢ Focused only on development
Two options
The flexible way
Orchestration to the rescue
The flexible way
➢ Each application in different container
➢ Only one process per container
➢ More complicated to maintain
➢ More flexible and ready for other environments
4.
Demo
5.
Summary
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
Grails and Docker
➢ Colin Harrington
➢ Tomorrow 2:30 PM
➢ Schultze Hall 127 (this room)
Thank you!
Questions?
http://bit.ly/gr8conf-docker
@ilopmar
lopez.ivan@gmail.com
https://github.com/ilopmar
Iván López

GR8Conf US 2017 - Dockerize your Grails!