This is a recap about how we use the isolation of containers and the power, portability and simplicity of Docker for providing tooling as a service via executable images using DCOS-CLI as an example. True story!
The problem:
- We want to install Mesos Frameworks.
- We want to deploy apps with Marathon.
- We want to automate the installation of Mesos Frameworks.
- We want to automate the deployment of apps.
The pain!
- DCOS-CLI from Mesosphere is the best solution for the first two problems but we need to follow all the steps to install it.
- We need to make sure our environment is suitable to install and run it so it has all the required dependencies.
- We need to make sure every environment where we want to run it is suitable to install and run it so every environment has all the required dependencies.
- We need to ensure all the dependencies and any executables comply with security requirements, as the attack vector can be quite extensive.
The solution:
- To offer DCOS-CLI as a service that can be executed with zero dependencies with the specific environment.
- To consume this service from a given automation tool like Ansible.
But how?
- We use Docker for running an ephemeral container with dcos-cli contained. This means Docker is your only dependency no matter what you want to run.
- The container creates a temporary config file from your environment variables, executes your command and dies. Check out the source code here.
- Now it’s up to you how to automate it. We use ansible and the Frameworks role for Apollo which looks something like this:
The benefits:
- Reduced impacting surface.
- Only one dependency with the run time container, i.e Docker.
- Crazily easy to integrate with other automation tools!
- Reusable.
- Build once, Run everywhere!
At the time of writing this post, Mesosphere, the creators of DCOS-CLI among such other amazing tools around Mesos, are working on their own image for DCOS-CLI