<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>docker &#8211; Virtually Fun</title>
	<atom:link href="https://virtuallyfun.com/tag/docker/feed/" rel="self" type="application/rss+xml" />
	<link>https://virtuallyfun.com</link>
	<description>Fun with Virtualization</description>
	<lastBuildDate>Wed, 28 Mar 2018 10:10:59 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.0</generator>
	<item>
		<title>Fun with Docker</title>
		<link>https://virtuallyfun.com/2018/03/28/fun-with-docker/</link>
					<comments>https://virtuallyfun.com/2018/03/28/fun-with-docker/#comments</comments>
		
		<dc:creator><![CDATA[neozeed]]></dc:creator>
		<pubDate>Tue, 27 Mar 2018 23:30:11 +0000</pubDate>
				<category><![CDATA[encryption]]></category>
		<category><![CDATA[random updates]]></category>
		<category><![CDATA[docker]]></category>
		<guid isPermaLink="false">http://virtuallyfun.com/wordpress/?p=8252</guid>

					<description><![CDATA[Well it&#8217;s not really all that fun. SO&#8230; in the start of the year I had decided I didn&#8217;t want to play site admin all day, and went to a hosted platform.Â  Things went well for a few months, then &#8230; <a href="https://virtuallyfun.com/2018/03/28/fun-with-docker/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
										<content:encoded><![CDATA[<p>Well it&#8217;s not really all that fun.</p>
<p><img decoding="async" class="alignnone size-medium wp-image-8256" src="https://virtuallyfun.com/wp-content/uploads/2018/03/underconstruction-300x99.gif" alt="" width="300" height="99" /></p>
<p>SO&#8230; in the start of the year I had decided I didn&#8217;t want to play site admin all day, and went to a hosted platform.Â  Things went well for a few months, then things didnt go well with constant database issues.</p>
<p><a href="https://virtuallyfun.com/wordpress/2018/02/21/and-were-back-2/">Then we went down hard for over 24 hours.</a>Â  I was going to move back, but then everything started to work again.Â  But things had been spiraling down to unusability again.</p>
<p>So instead of just making a big VM like I had done before , I thought I&#8217;d try using Docker to host my website, with a few containers, namely each tier separate.</p>
<p>And oh boy does everyone love edge case docker stuff, but when it comes to actually moving something *INTO* docker, its basically you are on your own.</p>
<p><img decoding="async" class="alignnone size-full wp-image-8257" src="https://virtuallyfun.com/wp-content/uploads/2018/03/ahouseulunderconstruction.gif" alt="" width="236" height="56" /></p>
<p>So yes, <del>the http-https redirect is broken</del>.Â  <del>My categories are all missing</del>. lots of stuff is busted.Â  <del>And the supergloblamegacorp.com redirect stuff is missing. I&#8217;ll have to re-create that one after I get more stuff sorted out.</del></p>
<p>I haven&#8217;t given up yet&#8230;</p>
<p>Half of the fun was setting up the haproxy container, which in itself wasn&#8217;t so bad, although some times it wouldn&#8217;t pick up any config file changes, so I had to destroy it a few times, but naturally once I ask someone to look, and it&#8217;s working fine now.</p>
<p>So for the hell of it, here is my haproxy.cfg</p>
<p><code><br />
global<br />
maxconn 256<br />
defaults<br />
mode http<br />
timeout connect 5000ms<br />
timeout client 50000ms<br />
timeout server 50000ms</code></p>
<p>frontend http-in<br />
bind *:80<br />
bind *:443 ssl crt /etc/haproxy/haproxy.pem<br />
http-request set-header Host virtuallyfun.com if { hdr(host) -i virtuallyfun.superglobalmegacorp.com }<br />
http-request set-header Host virtuallyfun.com if { hdr(host) -i superglobalmegacorp.com }<br />
redirect scheme https code 301 if !{ ssl_fc }<br />
mode http<br />
acl host_virtuallyfun hdr(host) -i virtuallyfun.com<br />
acl host_virtuallyfun hdr(host) -i virtuallyfun.superglobalmegacorp.com<br />
acl host_virtuallyfun hdr(host) -i superglobalmegacorp.com<br />
use_backend virtuallyfun if host_virtuallyfun</p>
<p>backend virtuallyfun<br />
balance leastconn<br />
option httpclose<br />
option forwardfor<br />
reqadd X-Forwarded-Proto:\ https<br />
server node1 172.17.0.3:80</p>
<p>I wanted to use Let&#8217;s Encrypt to &#8216;secure&#8217; access to the domains I have, and running the certbot manually&#8230;. in a &#8216;dry run&#8217; I always got this fun and informative error:</p>
<p style="padding-left: 30px;">NewIdentifier : ACMESharp.AcmeClient+AcmeWebException: Unexpected error<br />
+Response from server:<br />
+ Code: BadRequest<br />
+ Content: {<br />
â€œtypeâ€: â€œurn:acme:error:malformedâ€,<br />
â€œdetailâ€: â€œError creating new authz :: DNS name does not have enough labelsâ€,<br />
â€œstatusâ€: 400<br />
}</p>
<p>Which of course got me absolutely nowhere searching.Â  I thought it may be docker screwing things up, so I shut it down, and fire up an old fashioned standalone copy of Apache, and run the following:</p>
<p style="padding-left: 30px;">certbot certonly &#8211;dry-run &#8211;non-interactive &#8211;register-unsafely-without-email &#8211;agree-tos &#8211;expand &#8211;webroot &#8211;webroot-path /docker/wordpress/html &#8211;domain virtuallyfun.com &#8211;domain virtuallyfun.superglobalmegacorp.com &#8211;domain superglobalmegacorp.com</p>
<p>And get the same result.</p>
<p>I get to the point of absolute frustration, and just decide to forget the dry run all together, as I know I can run it at least 5 times a day before I get banned, for a while, but maybe I&#8217;ll get something more useful.</p>
<p style="padding-left: 30px;"># certbot certonly &#8211;non-interactive &#8211;register-unsafely-without-email &#8211;agree-tos &#8211;expand &#8211;webroot &#8211;webroot-path /var/www/html &#8211;domain virtuallyfun.com &#8211;domain virtuallyfun.superglobalmegacorp.com &#8211;domain superglobalmegacorp.com<br />
Saving debug log to /var/log/letsencrypt/letsencrypt.log<br />
Obtaining a new certificate<br />
Performing the following challenges:<br />
http-01 challenge for virtuallyfun.com<br />
http-01 challenge for virtuallyfun.superglobalmegacorp.com<br />
http-01 challenge for superglobalmegacorp.com<br />
Using the webroot path /var/www/html for all unmatched domains.<br />
Waiting for verification&#8230;<br />
Cleaning up challenges<br />
Generating key (2048 bits): /etc/letsencrypt/keys/0000_key-certbot.pem<br />
Creating CSR: /etc/letsencrypt/csr/0000_csr-certbot.pem</p>
<p style="padding-left: 30px;">IMPORTANT NOTES:<br />
&#8211; Congratulations! Your certificate and chain have been saved at<br />
/etc/letsencrypt/live/virtuallyfun.com/fullchain.pem. Your cert<br />
will expire on 2018-06-26. To obtain a new or tweaked version of<br />
this certificate in the future, simply run certbot again. To<br />
non-interactively renew *all* of your certificates, run &#8220;certbot<br />
renew&#8221;<br />
&#8211; If you like Certbot, please consider supporting our work by:</p>
<p style="padding-left: 30px;">Donating to ISRG / Let&#8217;s Encrypt: https://letsencrypt.org/donate<br />
Donating to EFF: https://eff.org/donate-le</p>
<p>Except it actually worked.</p>
<p>Creating the needed haproxy.pem is simple as:</p>
<p style="padding-left: 30px;">cd /etc/letsencrypt/live/virtuallyfun.com/<br />
cat fullchain.pem privkey.pem &gt; /docker/haproxy.pem</p>
<p>To put the needed key along with the certs.Â  Naturally when this expires I&#8217;ll have to scramble to figure out how I did this.</p>
<p>Managing docker is fun as well. I went ahead and tried out <a href="https://portainer.io/">portainer.io</a>, whichÂ  naturally deploys as a container.Â  And it can manage remote servers, which I though was a plus as that means I could deploy it in my office, then simply connect to my server.Â  But that is where I found out that the config files for Debian are hard coded to always listen on a local socket, which breaks setting the proper JSON file to tell it to listen on a socket, and TCP/IP.Â  So just editÂ /etc/systemd/system/docker.service.d/docker.conf and either hard code it all there, or remove it from there and place it inÂ /etc/docker/daemon.json</p>
<p>As always <a href="https://github.com/moby/moby/issues/9889">documentation is conflicting</a> and <a href="https://success.docker.com/article/how-do-i-enable-the-remote-api-for-dockerd">all over the place</a>.</p>
<div id="attachment_8258" style="width: 310px" class="wp-caption alignnone"><img fetchpriority="high" decoding="async" aria-describedby="caption-attachment-8258" class="size-medium wp-image-8258" src="https://virtuallyfun.com/wp-content/uploads/2018/03/mv-rena-300x230.jpg" alt="" width="300" height="230" /><p id="caption-attachment-8258" class="wp-caption-text">My current feelings about docker&#8230;</p></div>
]]></content:encoded>
					
					<wfw:commentRss>https://virtuallyfun.com/2018/03/28/fun-with-docker/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
			</item>
	</channel>
</rss>
