<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/"><channel><title>Docker on Tux-Sudo</title><link>https://blog.tux-sudo.com/tags/docker/</link><description>Recent content in Docker on Tux-Sudo</description><generator>Hugo</generator><language>en-us</language><lastBuildDate>Fri, 20 Sep 2019 06:19:22 +0000</lastBuildDate><atom:link href="https://blog.tux-sudo.com/tags/docker/index.xml" rel="self" type="application/rss+xml"/><item><title>Go: Spin-Up Databases for CI Testing</title><link>https://blog.tux-sudo.com/posts/ci-docker-dbs/</link><pubDate>Fri, 20 Sep 2019 06:19:22 +0000</pubDate><guid>https://blog.tux-sudo.com/posts/ci-docker-dbs/</guid><description>&lt;p&gt;One thing has always bothered me while writing tests is the lack of a real datasource to run tests against. Most projects I&amp;rsquo;ve worked with in the past have either mocked responses from a datastore or used a &amp;ldquo;common&amp;rdquo; datastore to perform tests against. While mocks are good for quick unit tests, I still prefer using a &amp;ldquo;real&amp;rdquo; datasource, especially for integration tests.&lt;/p&gt;
&lt;p&gt;While taking Bill Kennedy&amp;rsquo;s Ultimate Go training a while ago, I saw Bill recommend a testing approach which involved &amp;ldquo;spinning up&amp;rdquo; a database container right from within your test code, run your tests, and clean-up. See &lt;a href="https://github.com/ardanlabs/service/blob/master/internal/platform/database/databasetest/docker.go"&gt;this&lt;/a&gt; for reference. I love this approach. It provides a wonderful way to do everything from within &lt;code&gt;go test&lt;/code&gt; without meddling with external scripts, thereby providing much greater interoperability. My only gripe with this is the fact that it uses &lt;code&gt;os.exec&lt;/code&gt; to command communicate with the docker daemon. The approach is sound, however, I find forking out to use docker-cli to be a bit clunky. Docker&amp;rsquo;s client for go is pretty good and offers imho, a better way to achieve the same. It adds a dependency to the code, however, I believe that is a good thing. The real dependency here is the daemon on the underlying system. Taking a dependency in Go code, makes the management of the API easier and offers more control than relying on the cli api silently. Moreover, if you only use the dependency in your &lt;code&gt;_test.go&lt;/code&gt; files, it won&amp;rsquo;t impact the final build binary (or that&amp;rsquo;s my understanding atleast, someone correct me if I&amp;rsquo;m wrong). In most cases the exec approach is perhaps good enough and the right thing to do, but I have an alternative.&lt;/p&gt;</description></item><item><title>ARM Your Golang Containers</title><link>https://blog.tux-sudo.com/posts/armyourcontainers/</link><pubDate>Mon, 19 Mar 2018 11:52:57 +0530</pubDate><guid>https://blog.tux-sudo.com/posts/armyourcontainers/</guid><description>&lt;p&gt;So then, here is the deal. I write tiny microservices that may or may not serve any purpose. Despite how meaningless they might be, I give them the perfect operations treatment.&lt;/p&gt;</description></item><item><title>Caddy! Team 443 FTW</title><link>https://blog.tux-sudo.com/posts/caddy-autohttps/</link><pubDate>Mon, 19 Feb 2018 11:01:54 +0530</pubDate><guid>https://blog.tux-sudo.com/posts/caddy-autohttps/</guid><description>&lt;p&gt;This one is a gamechanger. It really is.&lt;/p&gt;
&lt;p&gt;On a recent Golang obsessed Github browsing spree, I read the following project description: &amp;ldquo;Fast, cross-platform HTTP/2 web server with automatic HTTPS&amp;rdquo;. I&amp;rsquo;ve read that before, and more often than not ended up disappointing myself and resorting to hacks like [this] (&lt;a href="https://blog.tux-sudo.com/posts/letsencrypt-nginx-docker/"&gt;https://blog.tux-sudo.com/posts/letsencrypt-nginx-docker/&lt;/a&gt;) to create an automatic TLS system for my websites. There are other ways, but almost all of them were semi-automatic in the long run (yay cron!). I decided to try out [Caddy] (&lt;a href="https://caddyserver.com/)"&gt;https://caddyserver.com/)&lt;/a&gt;.&lt;/p&gt;</description></item><item><title>LetsEncrypt Certificates for Dockerized Nginx</title><link>https://blog.tux-sudo.com/posts/letsencrypt-nginx-docker/</link><pubDate>Tue, 26 Sep 2017 16:25:49 +0530</pubDate><guid>https://blog.tux-sudo.com/posts/letsencrypt-nginx-docker/</guid><description>&lt;p&gt;I like nginx. I like docker. I like SSL. I also like not paying for SSL certificates.&lt;br&gt;
If you, like me are operating a small time website, you probably don&amp;rsquo;t want to dish out a few hundred dollars for an SSL certificate.Thankfully, &lt;a href="https://letsencrypt.org"&gt;LetsEncrypt&lt;/a&gt; provides &lt;strong&gt;free&lt;/strong&gt; ssl certificates and is now trusted by most major browsers.&lt;br&gt;
However, integrating &lt;a href="https://certbot.eff.org/"&gt;certbot&lt;/a&gt; to automatically configure my nginx inside a docker container has been a pain. In the past, I generated the standalone cert with &amp;ndash;cert-only and then linked my docker container to use it but this was a far from usable solution given the horrid automation code I had to write. &lt;br&gt;
Recently, I tried to come up with a more automation friendly solution and ended up with the following:&lt;br&gt;&lt;/p&gt;</description></item></channel></rss>