paint-brush
Simplifying Docker management with Exoframeby@yamalight
565 reads
565 reads

Simplifying Docker management with Exoframe

by Tim ErmilovSeptember 8th, 2016
Read on Terminal Reader
Read this story w/o Javascript
tldt arrow

Too Long; Didn't Read

Docker is an <a href="https://medium.freecodecamp.com/a-beginner-friendly-introduction-to-containers-vms-and-docker-79a9e3e119b#.111rlevmh" target="_blank">amazing</a> tool. It can help you <a href="https://medium.com/@RemindEng/introducing-empire-a-self-hosted-paas-built-on-docker-amazon-ecs-7f8beb7f6ae4" target="_blank">setup self-hosted PaaS</a>, <a href="https://medium.com/@andrewmclagan/you-thought-laravel-homestead-was-easy-say-hello-to-docker-2c0639a0501#.z53ssycbo" target="_blank">scale things</a>, do <a href="https://medium.com/@Malinskiy/android-ci-with-docker-a2f522086640" target="_blank">Android CI</a> and even <a href="https://medium.com/google-cloud/developing-for-arduino-with-docker-and-johnny-five-on-osx-cc6813ae6e9d#.k6xwqu87h" target="_blank">develop for IoT</a>.<br>But even though Docker is a great tool, it has its own problems.

Companies Mentioned

Mention Thumbnail
Mention Thumbnail
featured image - Simplifying Docker management with Exoframe
Tim Ermilov HackerNoon profile picture


Docker is an amazing tool. It can help you setup self-hosted PaaS, scale things, do Android CI and even develop for IoT.But even though Docker is a great tool, it has its own problems.

First of all — it’s not that easy to use. Mainly because there are so many different flags you can use during pretty much every step. Even after using it daily for the past few years, I still have to open the manual to remember how to correctly forward ports or how to set resource constraints.

Then there’s a challenge of setting up an authentication, access control as well as ownership of the images and running containers. Right now you can setup authorization using Docker plugins, but it’s far from simple. And it doesn’t give you a way to define ownership. You can, of course, use labels or security opts to set the user. But you’d have to do that manually.


And that’s if you know how to use Docker. In our research group, we recently decided to migrate all our demos and services to Docker. Turns out it’s quite hard to teach people what Docker is and how to properly use it. And it’s even harder to make everyone set correct labels and security opts to make sure admins know e.g. who is responsible for container causing trouble.

And so I set out to create a better, simpler way of working with Docker.

Update: Exoframe beta is out! Simpler, faster, smaller and as user-friendly as ever.

Meet Exoframe —a power armor for docker containers


The idea behind Exoframe is quite simple — to help users tackle the aforementioned problems in a simple intuitive way with as little configuration as possible. Sort of, to give you a way to use it as a power armor to move those heavy docker containers around.

Exoframe consists of two parts: Exoframe server and Exoframe CLI.

Exoframe server is installed alongside your Docker on the remote server you want to use for deployment. It is essentially as a smart proxy for Docker remote API with authentication, access control and ownership features.

Exoframe CLI is installed on your local machine and is used for all the common Docker tasks like building and deploying images using Exoframe server API.

Exoframe server setup


First, you will need to setup Exoframe server.Since your server should already be running docker, it’s quite easy to do:





docker run -d \-p 3000:3000 \-v /var/run/docker.sock:/var/run/docker.sock:ro \-v /path/to/exoframe-folder:/root/.exoframe \exoframe/server



This will start an Exoframe server, forward port 3000 to your host and init default Exoframe server config. Be sure to navigate to /path/to/exoframe-folder and adjust username and password in server.config.yml because default admin:admin pair is not exactly secure :)You can also configure additional server auth plugins (e.g. LDAP or your other corporate user DB) that can be used instead of config-based user list.

Done. The server is ready to work!

Exoframe CLI setup


Next, you will need to setup Exoframe CLI on your local machine.Since Exoframe is written using Node.js, you will need to have Node.js (v6 or later) installed. Once you have it, simply execute npm install command to get Exoframe CLI:

npm install exoframe -g

Once install finishes, you can specify your server endpoint using the following command:

exoframe endpoint http://your.server.url:3000

Then execute “exoframe login” to authenticate on the server and you are ready to go!

Building and deploying an example project



Now let’s see it in action! We are going to create, build and deploy a simple static HTML project.You can find all the steps explained below in one simple screencast on asciinema:


Exoframe short demo_Short demo of Exoframe.js command line interface used to deploy Node.js project. Exoframe intends to do all the heavy…_asciinema.org

First, create a new folder and add a new index.html file that has some content, e.g.:

Then, execute “exoframe build” and pick a name for your image (or just leave it as a default one):

Exoframe build command output



At this point, Exoframe will automatically detect the project type and pick a suitable Dockerfile for it. Since we only have one index.html file, Exoframe reasons that it might be suitable for basic Nginx image.This detection is done using the templating engine. Templates are simple Node.js packages that provide a set of methods to detect if a project is suitable for them, ignore files, add type-specific labels and ask a user for additional input if required. The output of the template is a complete Dockerfile that is used to build a project.You can find an example of Nginx template that is used in this case on GitHub.

Once the build is finished, you can get list of your owned images and services using “exoframe list” command:

Exoframe list command output


Now that you have built a new image, let’s deploy it.Simply execute “exoframe deploy” and you will get a list of available images to deploy — no need to remember all of your image names:

Exoframe deploy images selection

Once you’ve selected the image you want to deploy, Exoframe will ask what exactly do you want to do during the deployment — do your want to forward ports, specify restart policy, etc?

Exoframe deploy feature selection

In this case we only want to forward ports, so that’s what is selected in the screenshot above. After you hit enter, Exoframe will present you with additional inputs that will guide you through all of the selected actions, e.g. for ports input looks like this:

Exoframe deploy port mapping example

Note that Exoframe shows you inline how the port mappings should look and which of the ports is inside a container and on a host. As you can see, it also allows you to map multiple ports.

After hitting enter, you will see a message that says the image was successfully deployed. You can now see your new service in a list that we have already called before using “exoframe list”:

Exoframe list with full info about running service


As you can see, the list now includes running html-test service with full info about it — forwarded ports, status, template, name.If you open your browser at http://your.domain you should see the static HTML you’d created.


Now that you’ve seen that service works, let’s stop and remove it.You can use “exoframe stop” command to stop your running services and “exoframe rm” to remove stopped services. Once again, you don’t need to remember names of your services, if you don’t provide service name — Exoframe will present you with an interactive list:

Exoframe stop command example



Exoframe also provides a way to interact with images from registries.Using “exoframe pull <image>” will pull given image from docker registry.You can then get list of all locally available registry images by executing “exoframe list public” command:

Exoframe registry images list

Deployment of the images from registry can be done by executing deploy command with an additional image argument, e.g.:

Exoframe deployment of registry image

After that running services can be managed in the same manner as shown above.

Conclusion

Exoframe is still in its alpha stage and some features are missing here and there. But I’ve been already using it to manage and deploy a set of demos on my own servers and it made my life a lot easier.


Exoframe is available now on GitHub. Free. Licensed under MIT.Any feedback you might have is highly appreciated.