In the past, application deployment meant moving lots of components – provided by developers to lots of servers, databases etc. managed by Operations. With Docker and containers, we often hear statements like: “That all goes away now – developers simply have to deliver a ready-to-go Docker image, and we’re done! No more need for app deployment tools like XL Deploy!”
Having worked with many users moving towards container-based deployments, it turns out that that statement simply isn’t true: while Docker and containers can certainly make some aspect of packaging and deployment easier, many challenges remain that tools like XL Deploy can help with.
The packaging of an traditional application depends how it has been written: operating system (Linux, Windows), language (Java, C#, Ruby Python, JS..), its behaviors (Frontend, Backend, Web, Processing), using or not database (SQL, NoSql)… It is also true with the associated environment and its infrastructure: Host (Virtual, Cloud), the operating system (Linux, Windows), the middleware (Tomcat, Apache Httpd, IIS, IBM WebSphere, ..), the data (MySQL, MongoDB).
In XL Deploy, we would have the following classic deployment where:
- the PetPortal version 2.0-89 contains: petclinic (jee.War), petclinic-backedn (jee.War), petDatasource (jee.Datasource), sql (sql.SqlFolder), logger (a custom type to configure log4j.properties)
- the Tomcat-Dev environment contains: tomcat-dev (tomcat.Server), tomcat.vh (tomcat.VirtualHost), sql-dev (sql.MySqlClient), smoke-test (smoketest.Runner).
Docker’s promise is the following: “one single kind of item in the package (docker.Image) will be deployed on a single kind of target (docker.Machine) to become a running Docker container.”
What are the modifications if I package and deploy my PetPortal application using Docker?
- in the package, instead of having 2 jee.War file (petclinic, petclinic-backend), I would have 2 docker.Image based on a tomcat:8.0 from the Docker Hub and that contains the war file and its configuration but I would keep my ‘smoke test’ and my ‘sql’ folder. Moreover, I would need to package the property file externally to my image (an image is like a commit, do not modify it! )
- in the environment, I would replace the ‘tomcat.Server’ and the ‘tomcat.VirtualHost’ by a single ‘docker-machine’ only and I would keep my ‘sql-dev’ MySql SQL client, test-runner-1 (smoketest.Runner).
If we examine the result, there are surprisingly few changes between the original deployment plan generated by XL Deploy, and the ‘dockerized’ version. The main difference is that we are now using a couple of docker commands:
- No more ‘war copy’ steps but ‘docker pull’ steps
- No more ‘start tomcat process’ steps but ‘docker run’ steps
If we detail into the docker run 2 commands generated by XL Deploy and its xld-docker-plugin:
- for the ‘petclinic-backend’ container, the command is simple as we can read in any docker blog post or documentation:
docker run -d --name petclinic-backend petportal/petclinic-backend:1.1-20150909055821
- for the ‘petclinic’ container, the command is a bit complex because we need to configure it – according to the documentation the ‘docker run’ command may accept up to 56 parameters, many of them can be added several times. In our simple case: we need
- to link it with the petclinic-backend,
- to manage exposed ports,
- to mount volumes to apply the configuration,
- to set environment variables:
- so the generated command is:
docker run -d -p 8888:8080 --link=petclinic-backend:petclinic-backend -v /home/docker/volumes/petportal:/application/properties -e "loglevel=DEBUG" --name petclinic petportal/petclinic:3.1-20150909055821
As the ‘petclinic’ container needs to be linked to the ‘petclinic-backend’, the xld-docker-plugin takes care to generate the steps in the right order to run first the linked container and then the other container.
Like the other middleware, the main pain point is not to call remote commands but to generate the right commands with the right configuration in the right order.
Two pain points in particular stand out immediately:
- the container configuration with its more than 50 parameters including the network, os, security settings: TCP port mapping, links with other containers, Memory, Privileges,….cf docker run documentation
- the volume management, for example: The container configuration is often done by providing a set of files that need to be first uploaded to docker-machine and then mount the volume in the container; Same story when you run the container that manages data (e.g : SQL database)
In the following scenario, the configuration is managed by the ‘config’ docker.Folder that contains placeholders in .properties files. When a value is modified, the folder should be uploaded and the container restarted.
So it can be difficult to manage the configuration for a given environment, but the application still needs to be deployed on several environments. XL Deploy’s dictionaries help you. Moreover, moving to Docker implies most of the time moving to a Microservices architecture that will imply more deployments. See the XL Deploy Docker Microservice Sample Application
Q: Does Docker mean the end of application deployment tools like XL Deploy?
A: No, definitely not!
Q: Does XL Deploy help me and my organization use Docker successfully?
A: It most definitely does! XL Deploy can allow your organization to transition to Docker at your own pace, with minimal disruption to your app delivery process.
- XL Deploy Docker Plugin https://github.com/xebialabs-community/xld-docker-plugin
- XL Deploy Docker Sample Application https://github.com/bmoussaud/xld-petclinic-docker
- XL Deploy Docker Microservice Sample Application https://github.com/bmoussaud/xld-micropet-docker