<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Matthieu FRONTON on Medium]]></title>
        <description><![CDATA[Stories by Matthieu FRONTON on Medium]]></description>
        <link>https://medium.com/@frntn?source=rss-d0bcda2304a4------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/2*xnNuuHGOJFYKzCxKmnwfYw.png</url>
            <title>Stories by Matthieu FRONTON on Medium</title>
            <link>https://medium.com/@frntn?source=rss-d0bcda2304a4------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 30 Nov 2026 04:49:03 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@frntn/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Imaginary numbers are reals]]></title>
            <link>https://medium.com/@frntn/imaginary-numbers-are-reals-d8bcb4753bc0?source=rss-d0bcda2304a4------2</link>
            <guid isPermaLink="false">https://medium.com/p/d8bcb4753bc0</guid>
            <dc:creator><![CDATA[Matthieu FRONTON]]></dc:creator>
            <pubDate>Sun, 27 Jul 2025 22:31:40 GMT</pubDate>
            <atom:updated>2025-07-27T22:31:40.199Z</atom:updated>
            <content:encoded><![CDATA[<p>Here is a crisp summary of the video “Imaginary Numbers Are Real [Part 1: Introduction]”:</p><ul><li>The video begins with the polynomial function f(x) = x² + 1 and the challenge of finding its roots on a graph.</li><li>It shows that the parabola does not intersect the x-axis, implying no real roots, but Gauss’s fundamental theorem of algebra states every polynomial of degree n must have n roots.</li><li>This apparent contradiction points to missing numbers beyond the real number line, introducing the idea of numbers existing in an additional dimension.</li><li>The video covers the historical doubts about zero and negative numbers and how math expanded to include them for solving previously unsolvable equations.</li><li>It suggests renaming “imaginary numbers” to “side numbers” to clear up confusion and better describe their meaning.</li><li>Finally, the video mentions how these extra numbers solve lost solutions to equations and teases a deeper look into their discovery in the next part.</li></ul><p><a href="https://www.youtube.com/watch?v=T647CGsuOVU">https://www.youtube.com/watch?v=T647CGsuOVU</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d8bcb4753bc0" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Fix : dpkg-preconfigure: unable to re-open stdin]]></title>
            <link>https://medium.com/@frntn/fix-dpkg-preconfigure-unable-to-re-open-stdin-6978a3c3e6ae?source=rss-d0bcda2304a4------2</link>
            <guid isPermaLink="false">https://medium.com/p/6978a3c3e6ae</guid>
            <category><![CDATA[sudo]]></category>
            <category><![CDATA[ubuntu]]></category>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[nodejs]]></category>
            <dc:creator><![CDATA[Matthieu FRONTON]]></dc:creator>
            <pubDate>Sat, 07 Jan 2023 21:22:18 GMT</pubDate>
            <atom:updated>2024-11-27T17:40:43.610Z</atom:updated>
            <content:encoded><![CDATA[<h3>Fix : dpkg-preconfigure: unable to re-open stdin</h3><h3>Context</h3><p>I found out that there is no official node image on docker hub based on Ubuntu. So I considered creating my own Dockerfile following the nodesource <a href="https://github.com/nodesource/distributions/blob/d6ad558cef7fca0e803a02f6f280660701aa752d/README.md#using-ubuntu-1">install instructions</a></p><pre>curl -fsSL &quot;https://deb.nodesource.com/setup_18.x&quot; | sudo -E bash - &amp;&amp; sudo apt-get install -y nodejs</pre><h3>Problem</h3><p>I now have this very simple Dockerfile</p><pre>FROM mcr.microsoft.com/devcontainers/base:ubuntu<br>ENV DEBIAN_FRONTEND=noninteractive<br>RUN curl -fsSL &quot;https://deb.nodesource.com/setup_18.x&quot; | sudo -E bash - &amp;&amp; sudo apt-get install -y nodejs</pre><p>But it failed at building and the following error is shown</p><pre>debconf: unable to initialize frontend: Dialog<br>debconf: (Dialog frontend will not work on a dumb terminal, an emacs shell buffer, or without a controlling terminal.)<br>debconf: falling back to frontend: Readline<br>debconf: unable to initialize frontend: Readline<br>debconf: (This frontend requires a controlling tty.)<br>debconf: falling back to frontend: Teletype<br>dpkg-preconfigure: unable to re-open stdin:</pre><figure><img alt="Build image can gives you some hard times" src="https://cdn-images-1.medium.com/max/1024/1*1gFOob_77VPsv_zCz-S7cQ.jpeg" /><figcaption>Photo by Anna Tarazevich from Pexels: <a href="https://www.pexels.com/photo/a-woman-touching-her-forehead-while-eyes-closed-6173666/">https://www.pexels.com/photo/a-woman-touching-her-forehead-while-eyes-closed-6173666/</a></figcaption></figure><h3>Solution</h3><p>You can find <a href="https://serverfault.com/questions/500764/dpkg-reconfigure-unable-to-re-open-stdin-no-file-or-directory">various</a> <a href="https://github.com/phpdocker-io/phpdocker.io/issues/159">fix</a> <a href="https://stackoverflow.com/questions/34773745/debconf-unable-to-initialize-frontend-dialog">proposal</a> while searching online but none of them actually worked out and it sometimes felt like a dirty working solution that nobody actually understand…</p><p>I finally figured out what was going on so I decided to write that very short article to share it for the dev and ops from the future who will time travel back to 2023 to find this solution :)</p><blockquote>remove sudo</blockquote><pre>FROM mcr.microsoft.com/devcontainers/base:ubuntu<br>ENV DEBIAN_FRONTEND=noninteractive<br>RUN curl -fsSL &quot;https://deb.nodesource.com/setup_18.x&quot; | bash - &amp;&amp; apt-get install -y nodejs</pre><p>You’r welcome fellow time traveler ;)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6978a3c3e6ae" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[DARK Season 3 Family Tree [SPOILERS]]]></title>
            <link>https://medium.com/@frntn/dark-season-3-family-tree-spoilers-857a843c9542?source=rss-d0bcda2304a4------2</link>
            <guid isPermaLink="false">https://medium.com/p/857a843c9542</guid>
            <category><![CDATA[dark]]></category>
            <category><![CDATA[genealogy]]></category>
            <category><![CDATA[netflix]]></category>
            <dc:creator><![CDATA[Matthieu FRONTON]]></dc:creator>
            <pubDate>Wed, 08 Jul 2020 07:38:05 GMT</pubDate>
            <atom:updated>2020-08-05T21:33:03.454Z</atom:updated>
            <content:encoded><![CDATA[<h3>— DO NOT READ BELOW IF YOU DON’T WANT TO GET SPOILED —</h3><h3>Adam’s World : Season 3 Complete Family Tree</h3><p>I tried my best to give an overview of all characters relations and why there’s only 6 left at the very end…</p><p>It helped me realize things like :</p><ul><li><strong>Noah </strong>killed his grandmother <strong>Claudia</strong></li><li><strong>Noah </strong>killed his wife’s childhood “boyfriend” <strong>Yasin</strong></li><li><strong>Hannah </strong>is anancestor for 3 of the 4 families</li><li><strong>Bartosz </strong>married his grandmother’s step sister <strong>Silja</strong></li><li><strong>Bartosz </strong>is <strong>Franziska</strong>’s great-grandfather</li><li><strong>Bartosz </strong>is <strong>Magnus</strong>’ great-great-grandfather</li><li><strong>Ulrich </strong>had an affair with his great-great-grandmother <strong>Hannah</strong></li><li><strong>Mikkel </strong>had <strong>Jonas </strong>with his great-great-great-grandmother <strong>Hannah</strong></li><li><strong>Marta </strong>is grandmother and granddaughter of <strong>Tronte</strong></li><li>…</li></ul><p>Also posted on reddit : <a href="https://www.reddit.com/r/DarK/comments/i4e81x/spoilers_s3_the_big_picture_fixed/">https://www.reddit.com/r/DarK/comments/i4e81x/spoilers_s3_the_big_picture_fixed/</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Shx9cNvSzmWLnmZTSNIOtA.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=857a843c9542" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A visual guide to gitlab-ci caching mechanisms]]></title>
            <link>https://medium.com/@frntn/a-visual-guide-to-gitlab-ci-caching-mechanisms-c3d616dc047e?source=rss-d0bcda2304a4------2</link>
            <guid isPermaLink="false">https://medium.com/p/c3d616dc047e</guid>
            <category><![CDATA[gitlab-runner]]></category>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[gitlab]]></category>
            <category><![CDATA[gitlab-ci]]></category>
            <dc:creator><![CDATA[Matthieu FRONTON]]></dc:creator>
            <pubDate>Fri, 25 Oct 2019 22:26:26 GMT</pubDate>
            <atom:updated>2019-10-25T22:26:26.261Z</atom:updated>
            <content:encoded><![CDATA[<h3>A visual guide to gitlab-ci caching</h3><p>If you’ve ever worked with gitlab-ci you may have needed, at some point, to use a cache to share content between jobs.</p><p>But the decentralized nature of gitlab-ci, the understanding of where/how the setup must be set, and the overlaping of concepts between cache and artifacts may have get you struggled.</p><p>It did to me.</p><p>So while going back and forth between the documentation, my hosts, my runners and my projects, I took note of my understanding and ultimately end up with a visual guide for my co-workers</p><p>I thought some people outside of my company may find it useful. <br>Hope you’ll like it.</p><h3>Before we start : cache vs artifacts</h3><p>The concepts may seems to overlaps because it’s about sharing content between jobs. But it differs fundamentally :</p><ul><li>If your job does <strong>not </strong>rely on the the previous one (i.e. can produce it by itself but if content already exist the job will run faster) then use <a href="https://docs.gitlab.com/ce/ci/yaml/#cache">cache</a></li><li>If your job does rely on the output of the previous one (i.e.<strong> cannot </strong>produce it by itself) then use <a href="https://docs.gitlab.com/ce/ci/yaml/#artifacts">artifacts</a> and <a href="https://docs.gitlab.com/ce/ci/yaml/#dependencies">dependencies</a></li></ul><p>Just remember the following : <em>“Cache is here to speedup your job, but it may not exist : don’t rely on it”. </em>This article is about <strong>cache</strong></p><h3>Simple Model</h3><p>We’ll use a simple representation of the gitlab-ci pipeline and forget the jobs can be executed on any runners and any hosts. It will help get the basics.</p><p>Lets say you have 1 project, 2 <strong>docker</strong> <strong>runners</strong> and 3 branches</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dy6wv9LPbGMGkZIB23hF3A.png" /></figure><h4>Local Cache : Docker Volume</h4><p>If you want a <a href="https://docs.gitlab.com/ce/ci/caching/index.html#where-the-caches-are-stored">local cache</a> between all your jobs running on <strong>the same </strong>runner, use the <a href="https://docs.gitlab.com/ce/ci/yaml/#cache">cache statement</a> in your .gitlab-ci.yml</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/127ef7f64274bc2da1a5bbbf91d1e37c/href">https://medium.com/media/127ef7f64274bc2da1a5bbbf91d1e37c/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Cv6K0yV2H_U7cu8sgXXx5A.png" /></figure><p>Using the <a href="https://docs.gitlab.com/ce/ci/variables/predefined_variables.html">predefined variable</a> “CI_COMMIT_REF_NAME” as the <a href="https://docs.gitlab.com/ce/ci/yaml/README.html#cachekey">cache key</a> you can ensure the cache is tied to a <strong>specific branch</strong></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/99c1eb5888e7365d9af1b1e9a089c083/href">https://medium.com/media/99c1eb5888e7365d9af1b1e9a089c083/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sImi4i8MYYoCZB9czzZvkQ.png" /></figure><p>Using the <a href="https://docs.gitlab.com/ce/ci/variables/predefined_variables.html">predefined variable</a> “ CI_JOB_NAME” as the <a href="https://docs.gitlab.com/ce/ci/yaml/README.html#cachekey">cache key</a> you can ensure the cache is tied to a <strong>specific job</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bKeXGPATar1peq23kczRDA.png" /></figure><h4>Local Cache : Bind Mount</h4><p>If you don’t want volume for caching purpose (debugging purpose, cleanup disk space more easily, etc…) you can set a “bind mount” <strong>while registering </strong>the runner. With this setup you do not need to setup the <a href="https://docs.gitlab.com/ce/ci/yaml/#cache">cache statement</a> in your .gitlab-ci.yml</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/bad3e7fbba89b6bb69f3659443d8c048/href">https://medium.com/media/bad3e7fbba89b6bb69f3659443d8c048/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MupfZizXviuNZ6JIp-2aAQ.png" /></figure><p>In fact this setup even allows you to share a cache between jobs <strong>running on the same host </strong>without requiring you to setup a distributed cache (which we’ll talk about later…)</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/06f96ce763d8b0420df4ca0ff2f5d40f/href">https://medium.com/media/06f96ce763d8b0420df4ca0ff2f5d40f/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wDjel6lGS2GAgqsAu50gqQ.png" /></figure><h4>Distributed Cache</h4><p>If you want a <a href="https://docs.gitlab.com/runner/configuration/autoscale.html#distributed-runners-caching">shared cache</a> between all your jobs running on <strong>multiple runners and hosts</strong>, use the <a href="https://docs.gitlab.com/runner/configuration/advanced-configuration.html#the-runnerscache-section">[runner.cache]</a> section in your <a href="https://docs.gitlab.com/runner/configuration/advanced-configuration.html#advanced-configuration">config.toml</a></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/7b19138e9a092634e9257101bf3241ee/href">https://medium.com/media/7b19138e9a092634e9257101bf3241ee/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DufniHujKZpL5Tcc4e0-KA.png" /></figure><p>Using the <a href="https://docs.gitlab.com/ce/ci/variables/predefined_variables.html">predefined variable</a> “CI_COMMIT_REF_NAME” as the <a href="https://docs.gitlab.com/ce/ci/yaml/README.html#cachekey">cache key</a> you can ensure the cache is tied to a specific branch <strong>between multiple runner and hosts</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XpOVU_crc4bwiFAiEcpAGQ.png" /></figure><h3>Real Life Model</h3><p>The above is a simplified model where you know on which runner/host you run the jobs. It allows you to understand the concepts and even sometimes use it in real life (register local runners, use tags to select the ones you want and you’re set…)</p><p>In real life this may not be true (autoscaling, …) but this article is more a TL;DR than a reference guide. The above should be enough to help you understand the basics required to play with more advanced setup.</p><p>Just to give you a sneak peak, here is an exercice for you :</p><blockquote>Setup a cache between all the jobs of a specific stage, running on any runner and any hosts, but only between pipeline of the same branches</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7YlCRH_2PmuGCmLUSxzrWA.png" /></figure><p>Have fun :)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c3d616dc047e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Continuous Pipelines for DevOps]]></title>
            <link>https://medium.com/@frntn/pipelines-for-devops-6cfbabc3dd8d?source=rss-d0bcda2304a4------2</link>
            <guid isPermaLink="false">https://medium.com/p/6cfbabc3dd8d</guid>
            <category><![CDATA[continuous-integration]]></category>
            <category><![CDATA[continuous-deployment]]></category>
            <category><![CDATA[continuous-delivery]]></category>
            <category><![CDATA[devops]]></category>
            <dc:creator><![CDATA[Matthieu FRONTON]]></dc:creator>
            <pubDate>Mon, 22 Aug 2016 13:17:53 GMT</pubDate>
            <atom:updated>2017-06-01T13:17:52.317Z</atom:updated>
            <cc:license>http://creativecommons.org/licenses/by/4.0/</cc:license>
            <content:encoded><![CDATA[<h4>The Definitive Disambiguation Guide</h4><p>From the multiple resources edited by some software companies out there, we can see it’s quite difficult to get a consensual definition of <strong><em>Continuous Delivery</em></strong> and/or <strong><em>Continuous Deployment</em></strong>.</p><p>It appears that each one is trying to defend its own point of view, which is actually fair. But now it starts to mess with the meaning for the whole devops community.</p><p>How can we rebuild a clear and simple definition so we never get confused again ?</p><p>You can either jump to the Conclusion section of this article or you can jump in and let me take you to a journey, starting back from the very basics,</p><p>Lets go back to the 70s…</p><h3>Automation vs Orchestration.</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xrYar4kcjHAjO4ZM4pY2PQ.png" /></figure><h3>Automation</h3><p>Prior to 1976, automated builds were performed by some OS-dependent shell scripts.</p><p>In Apr 1976, <a href="https://en.wikipedia.org/wiki/Stuart_Feldman">Stuart Feldman</a> released the first dependency-tracking, OS agnostic, build utility called “make” which uses a file containing a set of directives : the <strong>Makefile</strong>.</p><p>Its main purpose was to <strong><em>Automate the build</em></strong> of executable programs and libraries from source code.</p><p>This <em>Automation</em> strategy have then been generalized and spread to each <strong>stages</strong> of the software lifecycle :</p><ul><li>Build stage :<strong> Automated Build </strong>(code),</li><li>Test stage :<strong> Automated Tests </strong>(unit/acceptance/user),</li><li>Release stage :<strong> Automated Release </strong>(version x.y.z),</li><li>Deploy stage :<strong> Automated Deployment </strong>(infra/server/app provisioning)</li></ul><p>Some <strong>stages</strong> may have dedicated tools helping the automation process.</p><h4>Automated Builds</h4><blockquote>Generate artifacts from source following directives.</blockquote><p>Example tools are :</p><ul><li><a href="https://www.gnu.org/software/make/manual/make.html#Introduction">Make</a></li><li><a href="https://github.com/ruby/rake">Rake</a> (<em>Ruby make</em>)</li><li><a href="https://github.com/microsoft/msbuild">MS Build</a></li><li><a href="http://maven.apache.org/">Maven</a></li><li><a href="https://gradle.org/">Gradle</a></li><li>…</li></ul><h4>Automated Tests</h4><blockquote>Get insight of the application behavior and reliability.</blockquote><p>The testing <strong>stage</strong> can cover multiple area. Example tools in these areas are :</p><p><strong>Unit Tests :</strong></p><ul><li><a href="http://junit.org/">Junit</a></li><li>…</li></ul><p><strong>Load Tests :</strong></p><ul><li><a href="http://jmeter.apache.org/">Jmeter</a></li><li><a href="http://gatling.io/">Gatling</a></li><li>…</li></ul><p><strong>Acceptance Tests :</strong></p><ul><li><a href="http://behat.org/">Behat</a></li><li><a href="https://cucumber.io/">Cucumber</a></li><li><a href="http://seleniumhq.org/">Selenium</a></li><li>…</li></ul><h4>Automated Release</h4><blockquote>Create a release to the specified version</blockquote><p>Package your delivery and make the resulting resource(s) available for the next <strong>deploy</strong> stage.</p><p>With any Build automation tool or raw scripting language, you will package and upload to a central repository server.</p><p>Here is a non exhaustive list of repository servers :</p><ul><li>Artifact Repository (<a href="http://www.sonatype.org/nexus/">Nexus</a>, <a href="https://www.jfrog.com/artifactory/">Artifactory</a>, <a href="http://docs.gitlab.com/ee/user/project/builds/artifacts.html">Gitlab</a>…)</li><li>Object Storage (<a href="https://aws.amazon.com/s3/">Cloud Hosted S3 Bucket</a>, <a href="https://minio.io/">OnPremise Minio.io</a>, …)</li><li>Container Registry (<a href="https://aws.amazon.com/ecr/">Cloud Hosted ECR</a>, <a href="https://docs.docker.com/docker-trusted-registry/">OnPremise DTR</a>)</li><li>…</li></ul><h4>Automated Deployment</h4><blockquote>Deploy specific version to the target</blockquote><p>The deployment <strong>stage</strong> can cover 3 distinct steps.</p><p><strong>Infrastructure Provisioning :</strong></p><ul><li>AWS <a href="https://aws.amazon.com/cloudformation/">Cloud Formation</a></li><li>Azure <a href="https://msdn.microsoft.com/en-us/library/azure/dn790549.aspx">Resource Template</a></li><li>Google <a href="https://cloud.google.com/deployment-manager/">Cloud Deployment Manager</a></li><li>VMWare <a href="https://github.com/vmware/pyvmomi">pyVmomy</a></li><li><a href="https://www.terraform.io/">Terraform</a></li><li>…</li></ul><p><strong>Server Provisioning :</strong></p><ul><li><a href="https://puppet.com/">Puppet</a></li><li><a href="https://chef.io/">Chef</a></li><li><a href="https://ansible.com/">Ansible</a></li><li><a href="https://saltstack.com/">SaltStack</a></li><li>…</li></ul><p><strong>Application Provisioning :</strong></p><ul><li><a href="https://docker.com/">Docker</a></li><li><a href="http://capistranorb.com/">Capistrano</a></li><li><a href="http://www.fabfile.org/">Fabric</a></li><li><a href="https://www.nomadproject.io/">Nomad</a></li><li>…</li></ul><p><strong><em>NOTE : </em></strong><em>Nowadays tools are overlapping on many features. For example, I am currently working on a project where I use Ansible for the 3 provisioning steps : infrastructure, server </em><strong><em>and</em></strong><em> application provisioning.</em></p><h3>Orchestration</h3><p>Once you’ve automated 2+ consecutive stages, you need to <em>coordinate</em> them.</p><p>Orchestration is about coordination : you define <em>how</em><strong><em> </em></strong><em>and</em><strong><em> when</em></strong> you want to execute the automated scripts. Orchestration solutions allow to define if they are executed on a <strong><em>scheduled</em></strong>, <strong><em>triggered</em>, </strong>or <strong><em>on-demand</em> </strong>basis.</p><p>We can implement CI/CD pipelines on any orchestration solution :</p><ul><li><a href="https://about.gitlab.com/gitlab-ci/">GitlabCI</a></li><li><a href="https://travis-ci.org/">TravisCI</a></li><li><a href="https://jenkins.io/">Jenkins</a></li><li><a href="https://www.atlassian.com/software/bamboo">Bamboo</a></li><li><a href="https://www.gocd.org/">GoCD</a></li><li>…</li></ul><p>Yes, you <strong>can</strong> implement CD pipeline even on your old Jenkins 1.x orchestration server ! Remember that’s just about defining how and when you run automated scripts...</p><p>So what’s all this hype around Continuous Delivery/Deployment ?</p><p>It’s because orchestration solutions makers are creating additional capabilities (builtin or plugin) to help you implement pipelines.</p><p>Here are the two most recommended capabilities :</p><h4>Pipeline as Code</h4><p>The real important change in the field of CI/CD definition is that you should require the ability to <em>code your pipeline</em> and submit it inside your scm repository, along with your code.</p><blockquote>Pipeline as Code is key to ensure long term maintainability.</blockquote><p><strong><em>Prior “Pipeline as Code”,</em></strong> your code and your automation was commited to a scm. The pipeline was defined through a webui, has multiple tasks and with their own <strong><em>unversioned lifecycle</em></strong>, making difficult to ensure long term maintainability. You also needed access to the orchestration server to create your tasks.</p><p><strong><em>With “Pipeline as Code”,</em></strong><em> </em>your code, your automation <strong><em>and</em></strong><em> your orchestration</em> are now commited to the scm. The pipeline have the <em>exact same</em><strong><em> versioned lifecycle</em></strong>, helping you to ensure long term maintainability.</p><blockquote><strong>“You need to setup a new pipeline for your project”</strong></blockquote><blockquote><strong>then:</strong> you needed an account and the required acls to the orchestration server</blockquote><blockquote><strong>now: </strong>that’s ok, push the code</blockquote><blockquote><strong>“You need to bugfix and package an old app version for security purpose”</strong></blockquote><blockquote><strong>then:</strong> chances are the tasks no longer fits with your old app requirements. You weren’t able to run the current pipeline.</blockquote><blockquote><strong>now:</strong> that’s ok, pull, fix, push the code and the legacy pipeline will be started.</blockquote><blockquote><strong>“You work on a branch requiring a slighlty different orchestration”</strong></blockquote><blockquote><strong>then: </strong>you have to duplicate all tasks making your orchestration dashboard more and more complex over the time.</blockquote><blockquote><strong>now:</strong> that’s ok, push the new definition and the new improved pipeline will be started.</blockquote><h4>Remote Agents</h4><p>Legacy orchestration servers used to require lots of cpu/memory/disk to ensure all your companies tasks can be executed. Complex and constant actions was required to operate these servers with high quality level : Plugins Management, Users Management, Versions Update, Capacity Provisioning, Monitoring,…. (just ask you OPS team for more)</p><blockquote>Legacy orchestration servers were complex for OPS and deceptive for DEV</blockquote><p><strong><em>Prior “Remote Agents”,</em> </strong>The tasks are executed on the orchestration server itself or one of its slaves, in raw environment.</p><p><strong><em>With “Remote Agents”,</em></strong> The tasks is executed on the remote agent, in a dedicated environment context.</p><blockquote>“<strong>You want to build with a very specific component version which are not the ones on the orchestration server</strong>”</blockquote><blockquote><strong>then: </strong>If you update the raw environment, it’ll have an impact on all the next builds to come. Not only yours, but all the build running on the system. So you need to manually setup a new context (virtualenv, version manager, virtual machine, containers, …)</blockquote><blockquote><strong>now:</strong> Your agent itself can guaranty a new dedicated context using virtual machine or container technology by design (transparent for you)</blockquote><blockquote><strong>“You want your orchestration server to start a deployment”</strong></blockquote><blockquote><strong>then: </strong>The orchestration server will need to have access to the targetted environment. This will require you to ask an inbound whitelist on <strong>multiple</strong> IP/Port/Protocol which is often difficult to obtain, to maintain, and opens up a security concern…</blockquote><blockquote><strong>now:</strong> The orchestration agent can securely register to the orchestration server from within the targetted environment. This may require you to ask an outbound whitelist on <strong>one</strong> IP/Port/Protocol which is often easy to obtain, to defend, and less an issue to the security team (I said “less”, not… “not”)</blockquote><h3>Disambiguation</h3><blockquote>“Automation” != “Automatic”</blockquote><p>Having an automated stage (automation), doesn’t mean it is automatically started (automatic promotion).</p><blockquote>“Continuous” != “Automatic”.</blockquote><p><em>Continuous Deployment</em> doesn’t mean each time someone push to the repository, the change will be spread up to the production without manual validation between stages.</p><p>Continuous is the <strong><em>idea of continuity</em></strong> between multiple distinct sections. Like when you plug multiple pipes together to get a <em>(…wait for it…)</em> pipeline ;)</p><blockquote>“Orchestration” != “Orchestration” (duh)</blockquote><p>In this article I am focused on top-level Ochestration : coordinating your pipes (automated stages) to create your pipeline (continuous integration/delivery/deployment).</p><p>Be aware you can speak of (and you will hear about) Orchestration at multiple sublevel of your pipeline. In the automated deployment stage for example :</p><ul><li>Ansible maps arbitrary IT process to a concrete complex multi-tier worflow orchestration,</li><li>MCollective used on top of Puppet will help you build server orchestration and parallel job-execution systems,</li><li>Docker will manage your container orchestration,</li><li>…</li></ul><p>So each time you hear about Orchestration, ask yourself what’s the Ochestration level first :</p><ul><li>Pipeline level or Stage level ?</li><li>Which Stage ?</li><li>If in Deployment Stage, is it in Server Provisioning or in Application provisioning ?</li><li>etc…</li></ul><blockquote>Ochestration can have multiple meaning at multiple levels. <br>So without context, it has no meaning at all.<br> — Captain Obvious</blockquote><p>So if you’re asked to implement the <strong><em>DevOps Ochestration</em></strong> (<em>Achievement Unlocked : “Buzz Word Combo”</em>) of company X or for projet Y, well… just laught and move on :)</p><h3>Feedback Loop</h3><p>Continuous Pipelines are not just about tooling.</p><p>You <strong>must not</strong> (!) forget the <em>Feedback Loop</em> to ensure constant improvement…</p><h3>Conclusion</h3><h4>Typical Workflow</h4><p>Typical software development process from early thinking to end user is the following :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zJcwighBJ2bs6s9N9FRWOA.png" /></figure><h4>Continuous Pipelines</h4><p>Starting from a SCM to pull code from, we create scripts to <strong>build</strong> and<strong> test</strong> the delivery. Once each step is automated, we can coordinate them with an orchestator.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Xtoxv_gJ2tBfEQYySua32A.png" /></figure><p>Starting from a Continuous Integration worflow, we now automate the Release of the tested artifacts to a ready-to-deploy version. Once each step is automated, we can coordinate them with an orchestator.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tHYrUCZiecCkPw9zGze65w.png" /></figure><p>Starting from a Continuous Delivery worflow, we now automate the deployment to the targeted environment. Once each step is automated, we can coordinate them with an orchestator.</p><p>For many of us, that will be our (asymptotic ?) target.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*B_8KEH3E6ikd3qsRK9GPSw.png" /></figure><h4>Finally</h4><p>With all the above in mind I’m confident you’ll be able to define your needs and choose the tool that fits your company’s requirements. You’ll also be able to get definition approval consensus from your coworker. Hope I did in the first place ! :)</p><p>I finally came up with this clear and simple definition I was searching for in the first place :</p><blockquote>Continuous Pipeline is the orchestration of automated stages in your software lifecycle.</blockquote><p>Happy Pipelining.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6cfbabc3dd8d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[#SwarmWeek : 100% Unattended install of Docker’s UCP]]></title>
            <link>https://medium.com/@frntn/swarmweek-100-unattended-install-of-docker-s-ucp-3c8d8ca01f77?source=rss-d0bcda2304a4------2</link>
            <guid isPermaLink="false">https://medium.com/p/3c8d8ca01f77</guid>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[swarmweek]]></category>
            <category><![CDATA[swarm]]></category>
            <dc:creator><![CDATA[Matthieu FRONTON]]></dc:creator>
            <pubDate>Mon, 07 Mar 2016 15:16:01 GMT</pubDate>
            <atom:updated>2016-03-08T20:54:10.696Z</atom:updated>
            <content:encoded><![CDATA[<p>This week, from March 7 2016 to March 11 2016, <em>Docker Inc.</em> puts its native clustering solution in the spotlight.</p><p>Most of its communication will be promoting <strong>Docker Swarm</strong> with :</p><ul><li>a dedicated <a href="http://www.meetup.com/Docker-Online-Meetup/events/229144311/">online meetup</a>,</li><li>jump start <a href="https://www.youtube.com/playlist?list=PLkA60AVN3hh8lmRdhPKzsNJvZxJ8dpj4t">videos</a>,</li><li><a href="https://blog.docker.com/tag/swarmweek/">blog posts</a>,</li><li>and <a href="https://twitter.com/#swarmweek">more</a>…</li></ul><p>In this context I’ll show you how to get an highly-available swarm cluster locally using their commercial product <a href="https://www.docker.com/products/docker-universal-control-plane">Docker Universal Control Plane</a></p><h3>Docker On Premise Products</h3><p>New <strong><em>Docker Datacenter</em></strong> commercial product brings container management and deployment services to enterprises with a production-ready platform.</p><p>It includes their two on-premise products :</p><h4>Docker Trusted Registry</h4><p>DTR allows you to store and manage your Docker images on-premise or in your virtual private cloud (VPC) to support security or regulatory compliance requirements.</p><h4>Docker Universal Control Plane</h4><p>UCP provides an on-premises, or virtual private cloud (VPC) container management solution for Docker apps and infrastructure. It’s based on a <strong>Swarm Cluster</strong> to manage your distributed docker applications across the platform.</p><h3>Testing Purpose</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/320/1*Bh09TPeZ3XR2P44G4q8rhg.png" /></figure><p>At <a href="http://www.ekino.com/">ekino.</a> we like building great softwares, using latest services, tools and concepts to empower end-user experience. For that reason we have to keep our teams theorical and practical knowledge up to date with the latest concepts and technology stacks.</p><p>To do so we want to be able to spinup and destroy the stack we want to play with very quickly !</p><h4>Automate all the things</h4><p>Most of the intallation process of <a href="https://docs.docker.com/docker-trusted-registry/">DTR</a> and <a href="https://docs.docker.com/ucp/">UCP</a> is automated by the containers you start during the process. A lot of things happens under the hood and most of the install complexity is hidden and limit user inputs to its minimum. But for our testing purpose we needed a <strong>fully unattended installation</strong>.</p><blockquote>Introducing “Docker Datacenter Helper” : <a href="https://github.com/frntn/docker-datacenter-helper">https://github.com/frntn/docker-datacenter-helper</a></blockquote><h3>Docker Datacenter Helper : UCP</h3><p>This project requires linux, git and vagrant installed. You’ll also need a CS license : you can get a free 30-days trial <a href="https://hub.docker.com/enterprise/trial">here</a> (expected location is at the root of the project, with default name ‘<em>docker_subscription.lic</em>’)</p><h4>Basic Usage</h4><p>To start your docker UCP instance just clone the repository and execute the start_ucp script. With default configuration you’ll end up with a 6 nodes UCP platform. So called “Cluster Controllers” are actually your Swarm Cluster nodes.</p><p>Below are the asciicast of the ‘start_ucp’ script execution, respectively forthe standard output and logfile content :</p><figure><a href="https://asciinema.org/a/cdzjbkx6hgm5lfbda48j1oi0q?autoplay=1&amp;speed=2"><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sgrvE2VmhANzV1APzf-T0g.png" /></a><figcaption>./start_ucp: stdout</figcaption></figure><figure><a href="https://asciinema.org/a/86c053i316wj2k06c4ur7alpb?autoplay=1&amp;speed=3"><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*grnLmEtKcKqEtizmF8AksA.png" /></a><figcaption>./start_ucp: logfile content</figcaption></figure><h4>Advanced Usage</h4><p>You can tweak the generated infrastructure :</p><ul><li>Edit config.yml file to change the numbers of nodes in your cluster and/or declare which ones will be cluster controllers</li><li>Edit the Vagrantfile to change the amount of memory for each VMs (1.5G recommended. Defaults is 1G)</li><li>Use environment variables to change various defaults settings. Check the helper.sh file to figure out which ones are available.</li></ul><h4>Result</h4><p>At the end of the process, the script echos the login/password and dashboard URL(s).</p><ol><li>Copy/Paste one of it to your browser and connect. You’ll get an “untrusted certificate” warning at first because the certificate hasn’t been issued by any known CA of your system (this can be changed later on in the ‘settings’ tab )</li><li>Login using the default login/password</li><li>Enjoy :)</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*O5nrZpwweMjbQGqXVO-hew.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2X2S1O6yrD5RI8y_d60orQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*17aCsVWE06qOqpGlLaUdLA.png" /></figure><p>Almost same thing to create your private DTR. Check out the <a href="https://github.com/frntn/docker-datacenter-helper/blob/master/README.md">README file</a> for more informations and asciicasts.</p><p><strong>Feel free to try it, fork it, improve it…</strong></p><h3>Happy #SwarmWeek to everybody ! :)</h3><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3c8d8ca01f77" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[One+ year feedback of using Docker and Swarm in DEV and QA environments]]></title>
            <link>https://medium.com/@frntn/one-year-feedback-of-using-docker-and-swarm-in-dev-and-qa-environments-deaf2ec6dc61?source=rss-d0bcda2304a4------2</link>
            <guid isPermaLink="false">https://medium.com/p/deaf2ec6dc61</guid>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[swarm]]></category>
            <category><![CDATA[devops]]></category>
            <dc:creator><![CDATA[Matthieu FRONTON]]></dc:creator>
            <pubDate>Thu, 25 Feb 2016 14:56:24 GMT</pubDate>
            <atom:updated>2016-03-10T12:17:18.379Z</atom:updated>
            <content:encoded><![CDATA[<blockquote>TL;DR How we use docker and swarm without major issue in one year and how we configured the whole to achieve cloud and onpremise compliant scalability at developers level.</blockquote><h4>Context</h4><p>At <a href="http://www.ekino.com/">ekino.</a> we like building great software, using latest services, tools and concepts to empower end-user experience. We mostly work on web and mobile applications (but <a href="https://medium.com/l-atelier-d-ekino">not only</a>). A team of 200+ passionate people.</p><p>End of November 2014, I’ve started a new project for one of our client. We basically came to build a new linux-based java API, backed with neo4j cluster, inside an existing windows-base .NET application backed with SQL Server. We agreed on an interface between the new linux stack and the legacy windows stack, so we can develop side-by-side in confined environments to successfully achieve that heterogeneous application.</p><h4>Timeline</h4><p>At first I used chef to provision our servers. So KitchenCI comes in the way for on-push testing of the cookbooks. The Jenkins/KitchenCI was installed on a VM so I had to use a docker driver (virtual machine inception is not a good idea). And I was pleased to see how fast and leightweight the testing process was.</p><p>I decided to extend docker usage (but not for microservice as it wasn’t the end goal of my mission). Knowing docker was reliable for it’s build-ship-deploy capabilities I started to build <a href="https://hub.docker.com/r/ekino/">public images</a> for our required engines (<a href="https://hub.docker.com/r/ekino/haproxy/">reverse-proxy</a>, <a href="https://hub.docker.com/r/ekino/java/">oracle java</a>, <a href="https://hub.docker.com/r/ekino/neo4j-cluster/">neo4j cluster</a>) and used bind mounted volumes for project-specific versioned packages (configuration, jar, database).</p><p>Now each deployment consist of 1) removing all existing packages and containers and 2) deploy the new ones. <em>Immutable infrastructure here we come.</em></p><p>At this point I stopped using Chef to provision applications engines as they are now self-contained thanks to docker. I just kept it to ensure basic server state : users, pubkeys, ntp…</p><p>It’s about march 2015, swarm 0.1 is released <em>(checkout the </em><a href="https://speakerdeck.com/vieux/whats-new-in-swarm-1-dot-1"><em>last 1.1 slides</em></a><em> from core developer </em><a href="https://medium.com/u/45b6d0fc4524"><em>Victor Vieux</em></a><em>)</em> and I decided to take look at it. Basically at this time and version, I saw swarm as a docker proxy : it implements almost all docker server endpoints (required to forward the requests), and add some clustering features like discovery, filters or strategy.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DAiLOXJqI50amm_VqNACaA.png" /><figcaption>swarm is a docker proxy</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AIjRRWs8rrWhsLwtz4tP3Q.png" /><figcaption>swarm is a docker server++</figcaption></figure><blockquote>A whole new idea came into my mind : I could use swarm to change the way we saw environments for developers !</blockquote><h4>Rethink Environments</h4><p>At OPS point of view the more environments, the more complex the work is. At DEV point of view the more environments, the more workflows can fit in : integration, acceptance, load testing, interoperability, presales demos, etc…</p><blockquote>Docker Swarm brings the white flag. DevOps style !</blockquote><p>Using Docker Swarm in combination with <a href="https://docs.docker.com/engine/userguide/labels-custom-metadata/">docker labels</a> each docker server instance can be attached to an environment. Swarm brings environments at application/developers level, as Docker brought networking at application/developers level.</p><p>So I can now ask client OPS to provide me a pool of server, managed and monitored as a whole : <em>The environment group</em>. Creating a tiny jenkins jobs to change to docker daemon configuration, DEV are now free to (re)define environments within an <em>environment group</em>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*c9-ckVhCEfx0fV4PXahyqA.png" /><figcaption>5 static Environnements</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eDPU30e4s_2eNfY89IZhhA.png" /><figcaption>2 static environment groups + 5 dynamic environments</figcaption></figure><p>This setup is on-premise compliant (QA, PRESALES) <strong><em>and</em></strong> cloud ready as it will be transparent (PREPROD, PROD).</p><h3>Enough theory ? Let’s take a look at the implementation now.</h3><h4>Implementation: Discovery</h4><p>I use swarm’s <strong>file://</strong> backend as it appeared to be the simplest way to define nodes with dynamic sizing pool while keeping the setup 100% internal.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/574/1*Qs-NvvxXqsffpJRGVPWjRQ.png" /></figure><h4>Implementation: Filters</h4><p>I use <strong>constraints</strong> to select the environment <em>(that’s the magic trick!)</em> and <strong>affinities</strong> to prevent containers of a cluster to run on the same node.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/615/1*4n4U18a7DKqoy89L2ExlJQ.png" /></figure><h4>Implementation: Tags</h4><p>Finally the jenkins job to update the docker server configurations will basically do the following</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9Go-R2ANeKLNhfeFC7NrTw.png" /></figure><h4>Result</h4><p>DEV have now the ability to scale up/down any environment to test various configuration :</p><ul><li>Adjust cluster size</li><li>Reduce compute nodes</li><li>etc..</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KGSwnNA8N0ua_4Ucmo-I4A.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aH-9YQypzFq_kupNP9dgsA.png" /><figcaption>after DEV change the environment layout</figcaption></figure><h3>One-year feedback conclusion</h3><h4>Systematic Deployment</h4><p>To achieve our fully automated immutable infrastructure the whole stack is deployed at once for each environment ! It means that even if you just change port number in a configuration file, you’ll end up removing all assets and containers for that environment. Yes. But a full deployment take about 3 minutes…. First steps to continuous deployment!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*z3Z8DaRcOG-QKlrbB0dZrg.png" /></figure><h4>Reliability</h4><p>Today every developers and consultant deploy multiple times a day. And no team member is afraid of to deploy anymore (Do you wish you could say the same right now ? :) ).</p><p>Yes, errors appears but it’s mostly because of container respawning too quickly (failed to create the new one as the old one is not yet known as actually deleted). Just restart the deployment job and it’s fixed (3 minutes…)</p><h4>Networking and Service Discovery</h4><p>As services may move around various nodes, we needed to add a <a href="https://www.consul.io/">consul</a> <em>layer</em> for service registration and discovery.</p><h3>What’s next</h3><h4>Docker Datacenter</h4><p>Two days ago Docker <a href="https://blog.docker.com/2016/02/docker-datacenter-caas/">announced their Docker Datacenter product line</a> availability. It’s the combination of two products :</p><ul><li><a href="https://www.docker.com/products/docker-trusted-registry">DTR</a> : on-premise image management and storage</li><li><a href="https://www.docker.com/products/docker-universal-control-plane">UCP</a> : on-premise docker applications management</li></ul><p>It requires a CS subscription but can be tested with a <a href="https://hub.docker.com/enterprise/trial/">free 30 days trial</a>.</p><p>With private registry, networking, clustering, high availability… t<strong>his solution goes way beyond the setup I have today !</strong></p><h4>Docker Datacenter Helper</h4><p>To optimize my free <strong>but limited duration</strong> trial, I have created a github project to automate the building of a Docker Datacenter (DDC) infrastructure. Feel free to fork it, improve it, try it :</p><blockquote>Github Project Page : <a href="https://github.com/frntn/docker-datacenter-helper">frntn/docker-datacenter-helper</a></blockquote><blockquote>Two last things : <a href="https://jobs.ekino.com/">Ekino is is hiring</a> ;) and you can follow us on <a href="https://twitter.com/3k1n0">twitter</a> or on …<a href="https://twitter.com/ekinoExperts">twitter</a></blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=deaf2ec6dc61" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Not your grandmother’s Docker environment]]></title>
            <link>https://medium.com/@frntn/not-your-grandmother-s-docker-environment-c3c5c1a5aab?source=rss-d0bcda2304a4------2</link>
            <guid isPermaLink="false">https://medium.com/p/c3c5c1a5aab</guid>
            <category><![CDATA[cloud9-ide]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[docker]]></category>
            <dc:creator><![CDATA[Matthieu FRONTON]]></dc:creator>
            <pubDate>Tue, 23 Feb 2016 13:40:12 GMT</pubDate>
            <atom:updated>2016-02-24T10:33:46.458Z</atom:updated>
            <cc:license>http://creativecommons.org/licenses/by/4.0/</cc:license>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xcKkMXpKRCUbharP7IC7gA.png" /></figure><blockquote>TL;DR : How I started from a simple docker image creation to allow remote file editing, and end up with a quite advanced Docker environment setup with user namespaces, TLS, and one dedicated docker daemon per user (!)…</blockquote><p>Hello and welcome onboard. Fasten your seatbelt. I’m gonna show you why and how I have tuned my servers for my ssh users.</p><p>First I wanted my ssh users to be able to remotely edit hosted files with a real IDE. Even though I personally use vim as an IDE, they should not be forced to.</p><h4>Cloud9 image</h4><p>So I decided to create a docker image with <a href="https://c9.io/">Cloud9</a> <a href="https://github.com/c9/core">core SDK</a> :</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/6a43b6e46f71e3d02d0dcd121e92f447/href">https://medium.com/media/6a43b6e46f71e3d02d0dcd121e92f447/href</a></iframe><p>Once built, we are able to start a web-based IDE and start editing a remote workspace from your web browser :</p><pre>docker run -d -v /path/to/project:/workspace -p 80:80 frntn/cloud9</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UjNCCVN7vA-KjtddOWuwNQ.png" /></figure><h4>Transparent container</h4><p>Containers technology, and more over Docker, benefits a great exposure and hype. Even outside of the DevOps community. But as I have explained above about vim, I don’t want my ssh users to become docker experts nor start messing around with their setup that I’ll need to fix later on.</p><p>Also I believe the “<em>loosely coupled” </em>concept we’re all talking about in microservice infrastructure should be applied here : I want to be able to change my tooling in 6 months without the user even noticing.</p><p>So I’ve declared a function at session start. When invoked it will load the workspace provided as first argument (defaults to current working dir) :</p><pre><strong>c9() {</strong><br>  publicip=&quot;$(ip -o -4 route get 8.8.8.8 | cut -f8 -d&#39; &#39;)&quot;<br>  workspace=&quot;$(/bin/readlink -f &quot;${1:-&quot;$(pwd)&quot;}&quot;)&quot;</pre><pre>  docker run -d \<br>    -p 80:80 -v &quot;$workspace:/workspace&quot; \<br>    frntn/cloud9</pre><pre>  echo &quot;Go to http://$publicip&quot;<br><strong>}</strong></pre><p>So the <strong>c9</strong> “<em>command” </em>can be transparently invoked as any other binary.</p><pre>$ c9 /var/www/<br>Go to http://&lt;publicip&gt;</pre><h4>Permissions</h4><p>Now you may have noticed the current setup I have achieved is not good for a multi-user environment and I’ll come back to that later. First I want to talk about cloud9&#39;s dot-folder.</p><p>When starting a container on a path, the cloud9 application creates an hidden <em>.c9</em> folder to store it’s setup among other things. It’s a standard behavior for IDE no problem here. But this folder have <strong>root:root</strong> permissions. And it will apply to all the new folders/files you’ll create in that workspace.</p><blockquote>Docker 1.10 comes with a <a href="https://github.com/docker/docker/blob/master/docs/reference/commandline/daemon.md#daemon-user-namespace-options">new feature</a> called “User Namespace” which will help us getting things right !</blockquote><p>First try : I’ve enabled the feature in the docker daemon configuration file and restart the service :</p><pre>$ cat /etc/default/docker<br>DOCKER_OPTS=&quot;${DOCKER_OPTS} <strong>--userns-remap=default</strong>&quot;</pre><p>The first noticeable think here is that all previously pulled images are missing. They’ve disappeared from image listing. Ok, so what I understood here is that the images are namespaced too. And we can confirm this by setting the feature on/off and note the consistency of that behavior.</p><p>Nevermind. Let’s start our <em>c9</em> command and check out the new files and folders created :</p><pre>$ ls -l<br>total 32<br>drwxrwxrwx 4  fronton fronton 4096 Feb 23 08:51 ./<br>drwxrwxr-x 11 fronton fronton 4096 Feb 23 04:20 ../<br><strong>drwxr-xr-x 3  110000  110000  4096 Feb 23 01:45 .c9/</strong><br>-rw-rw-r-- 1  fronton fronton 971  Feb 23 08:51 Dockerfile<br>drwxrwxr-x 8  fronton fronton 4096 Feb 23 09:44 .git/<br>-rw-rw-r-- 1  fronton fronton 4    Feb 23 02:05 .gitignore<br>-rw-rw-r-- 1  fronton fronton 974  Feb 23 04:18 sourceme<br>-rw-rw-r-- 1  fronton fronton 202  Feb 22 22:37 supervisord.conf</pre><p>Well… good thing is it’s <strong>not a privileged user anymore</strong> : it will protect us from a user using “/” as workspace and deleting the whole host. But we have a fancy uid:gid, with very high value which is unknown by the server and <strong>doesn’t have write access to our workspaces</strong>.</p><blockquote>RTFM</blockquote><p>As usually I ended up reading the whole documentation about this feature, understood how the mapping was done and how to tune it.</p><p>Second try : I have mapped 1:1 with my real uid/gid</p><pre><em>#=== before</em></pre><pre>$ cat /etc/default/docker<br>DOCKER_OPTS=&quot;${DOCKER_OPTS} --userns-remap=default&quot;</pre><pre>$ grep fronton /etc/subuid /etc/subgid<br>fronton:110000:65536<br>fronton:110000:65536</pre><pre><em>#=== after</em></pre><pre>$ cat /etc/default/docker<br>DOCKER_OPTS=&quot;${DOCKER_OPTS} --userns-remap=<strong>fronton</strong>&quot;</pre><pre>$ grep fronton /etc/subuid /etc/subgid<br>fronton:<strong>1006</strong>:<strong>1006</strong><br>fronton:<strong>1006</strong>:<strong>1006</strong></pre><p>Restart docker service, start my <em>c9</em> command …<em>and voilà</em> :</p><pre>$ ls -l<br>total 32<br>drwxrwxr-x 4  fronton fronton 4096 Feb 23 08:51 ./<br>drwxrwxr-x 11 fronton fronton 4096 Feb 23 04:20 ../<br><strong>drwxr-xr-x 3  fronton fronton 4096 Feb 23 01:45 .c9/</strong><br>-rw-rw-r--1   fronton fronton 971  Feb 23 08:51 Dockerfile<br>drwxrwxr-x 8  fronton fronton 4096 Feb 23 09:44 .git/<br>-rw-rw-r-- 1  fronton fronton 4    Feb 23 02:05 .gitignore<br>-rw-rw-r-- 1  fronton fronton 974  Feb 23 04:18 sourceme<br>-rw-rw-r-- 1  fronton fronton 202  Feb 22 22:37 supervisord.conf</pre><h3><em>Having a good time ? Let’s move on to some even more exciting stuff…</em></h3><h4>Multi-User : Ports binding</h4><p>I am happy with these first achievements but I am playing alone here. I need to make things more generic. Let’s take a look at port binding.</p><p>I am statically binding host port 80 to container port 80. Docker have a dynamic binding feature and we then have the ability to inspect the running container to get the binded host port :</p><pre>c9() {<br>  publicip=&quot;$(ip -o -4 route get 8.8.8.8 | cut -f8 -d&#39; &#39;)&quot;<br>  workspace=&quot;$(/bin/readlink -f &quot;${1:-&quot;$(pwd)&quot;}&quot;)&quot;</pre><pre>  docker run -d \<br>    <strong>-P</strong> -v &quot;$workspace:/workspace&quot; \<br>    frntn/cloud9</pre><pre>  port=&quot;$(docker inspect --format &#39;{{ range $key, $value := .NetworkSettings.Ports }}<strong>{{ if eq $key &quot;80/tcp&quot; }}{{ (index $value 0).HostPort }}{{ end }}</strong>{{ end }}&#39; $name)&quot;</pre><pre>  echo &quot;Go to http://$publicip:$port&quot;<br>}</pre><p>So I can now start a cloud9 container against any path without interfering with existing instances :</p><pre>$ c9 /var/www<br>Go to http://&lt;publicip&gt;:32774</pre><pre>$ c9 /opt/logstash/conf<br>Go to http://&lt;publicip&gt;:32775</pre><pre>$ c9 .<br>Go to http://&lt;publicip&gt;:32776</pre><h4>Multi-User : User Namespace</h4><p>Docker have implement their user namespacing feature with <em>“a single mapping per-daemon restriction”</em>. It means for any running daemon instance, only one user:group mapping is allowed. In my current setup (1:1 mapping with real uid:gid) it means one docker daemon per user…</p><p><strong>Seems kinda freaky or overkill at first</strong>, but if we think about it we’ll benefits from even more isolation between users’ containers and images.</p><blockquote>Okay let’s try it : one Docker daemon per user !</blockquote><p>For each user, I create all the certificates and keys required to secure TLS access to the docker daemon. For that I use my <a href="https://github.com/frntn/docker-tls-helper">docker-tls-helper</a> :</p><pre>mkdir -pv ~/.docker<br>chmod 700 ~/.docker<br>cd ~/.docker</pre><pre>curl -sSL <a href="https://raw.githubusercontent.com/frntn/docker-tls-helper/master/dockertls.sh">https://raw.githubusercontent.com/frntn/docker-tls-helper/master/dockertls.sh</a> | CERTS_PATH=&quot;.&quot; SRV_SAN=&quot;<strong>IP:127.0.0.1,DNS:localhost</strong>&quot; SRV_SUBJ=&quot;<strong>/CN=$(hostname)</strong>&quot; CLT_SUBJ=&quot;<strong>/CN=$USER Docker CLI</strong>&quot; bash</pre><p>All files are created with correct permissions :</p><pre>$ ls -l ~/.docker<br>total 36<br><strong>-rw-r--r--</strong> 1 fronton fronton 1960 Feb 23 00:58 <strong>ca.crt</strong><br>-rw------- 1 fronton fronton 3394 Feb 23 00:58 ca.key<br>-rw------- 1 fronton fronton 65   Feb 23 00:58 ca.pass<br>-rw------- 1 fronton fronton 17   Feb 23 00:58 ca.srl<br><strong>-rw-r--r--</strong> 1 fronton fronton 1797 Feb 23 00:58 <strong>client.crt</strong><br><strong>-rw-------</strong> 1 fronton fronton 3272 Feb 23 00:58 <strong>client.key</strong><br><strong>-rw-r--r--</strong> 1 fronton fronton 1834 Feb 23 00:58 <strong>server.crt</strong><br><strong>-rw-------</strong> 1 fronton fronton 3272 Feb 23 00:58 <strong>server.key</strong></pre><p>I then configure de 1:1 mapping for that user</p><pre># extract infos<br>myuid=$(id -u $USER)<br>mygid=$(id -g $USER)<br>mygrp=$(id -gn $USER)</pre><pre># delete existing if any<br>sudo sed -i &quot;/^$USER/d&quot; /etc/subuid<br>sudo sed -i &quot;/^$mygrp/d&quot; /etc/subgid</pre><pre># inject new values<br>echo &quot;$USER:$myuid:$myuid&quot; | sudo tee -a /etc/subuid<br>echo &quot;$(id -gn $USER):$mygid:$mygid&quot; | sudo tee -a /etc/subgid</pre><p>Start the server, binded port is the user uid <em>(add this to user session startup and make sure it is started only if needed)</em></p><pre>sudo /usr/bin/docker daemon \<br>   <strong>--userns-remap=$USER</strong> \<br>   --tlsverify \<br>   --tlscacert=$HOME/.docker/ca.crt \<br>   --tlscert=$HOME/.docker/server.crt \<br>   --tlskey=$HOME/.docker/server.key \<br>    -H <strong>127.0.0.1:$(id -u $USER)</strong> \<br>    -p <strong>$HOME/.docker/run.pid</strong> &amp;</pre><p>And finally I create an alias for the client</p><pre>alias docker=&quot;/usr/bin/docker --tls --tlsverify --tlscacert=$HOME/.docker/ca.crt --tlscert=$HOME/.docker/client.crt --tlskey=$HOME/.docker/client.key -H 127.0.0.1:$(id -u $USER)&quot;</pre><p><strong>Congrats !</strong> Now each user have it’s very own docker environment, only accessible by himself as we use user-defined server and client certificates for verification and authentication (stored in “<em>.ssh”-</em>like secure location)</p><pre><em># Cannot connect to Server without certificates/keys</em></pre><pre>$ <strong>\docker version</strong>   <em># &lt;-- bakslash to unalias the command on the fly</em><br>Client:<br> Version: 1.10.1<br> API version: 1.22<br> Go version: go1.5.3<br> Git commit: 9e83765<br> Built: Thu Feb 11 19:27:08 2016<br> OS/Arch: linux/amd64<br><strong>Cannot connect to the Docker daemon. Is the docker daemon running on this host?</strong></pre><pre><em># Successfully connect to Server with certificates/keys</em></pre><pre>$ <strong>docker version</strong>    <em># &lt;-- alias with tls en remotehost specs</em><br>Client:<br> Version: 1.10.1<br> API version: 1.22<br> Go version: go1.5.3<br> Git commit: 9e83765<br> Built: Thu Feb 11 19:27:08 2016<br> OS/Arch: linux/amd64</pre><pre><strong>Server:<br> Version: 1.10.1<br> API version: 1.22<br> Go version: go1.5.3<br> Git commit: 9e83765<br> Built: Thu Feb 11 19:27:08 2016<br> OS/Arch: linux/amd64</strong></pre><h4>Other improvements</h4><p>I have made other improvements available in my public repository :</p><ul><li>Name container based on <em>sha1sum(folder’s inode)</em></li><li>If container already exists and running, just echo the url</li><li>Add a <em>c9c</em> command to stop and remove the container</li></ul><p>I know a lot more improvements can be achieved journey (HTTPS, authentication, fine grained user mapping with distinct username but shared groups between container and hosts…) and there are some drawbacks to consider (unshared images increase disk usage…) <strong><em>but</em></strong> <strong><em>it has been a pretty funny hacking session to get this working</em></strong>.</p><p>Happy Hacking.</p><p><em>Fun fact : It has been a 8h journey and it actually took me the same time to write this article :)</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VcZjcVDj5RH6rUxYexjtOw.png" /><figcaption>c9 “$HOME/lab/src/github.com/docker/docker”</figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c3c5c1a5aab" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>