<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Michael Driscoll</title>
    <description>The latest articles on DEV Community by Michael Driscoll (@syncsynchalt).</description>
    <link>https://dev.to/syncsynchalt</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1822%2F950417.png</url>
      <title>DEV Community: Michael Driscoll</title>
      <link>https://dev.to/syncsynchalt</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/syncsynchalt"/>
    <language>en</language>
    <item>
      <title>Safe HTTP/3 Experimentation With Caddy</title>
      <dc:creator>Michael Driscoll</dc:creator>
      <pubDate>Mon, 25 Apr 2022 01:22:29 +0000</pubDate>
      <link>https://dev.to/syncsynchalt/safe-http3-experimentation-with-caddy-447f</link>
      <guid>https://dev.to/syncsynchalt/safe-http3-experimentation-with-caddy-447f</guid>
      <description>&lt;h1&gt;
  
  
  The Bleeding Edge Problem
&lt;/h1&gt;

&lt;p&gt;I'm writing &lt;a href="https://quic.ulfheim.net"&gt;QUIC documentation&lt;/a&gt; and thought it would be great to have the site available as HTTP/3 (which runs on top of QUIC). This is a relatively new protocol, so I ran into some familiar problems:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;em&gt;Tooling&lt;/em&gt;: The webserver that I'm using (apache) doesn't offer HTTP/3 support, and has no current plans to&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;Uptime&lt;/em&gt;: The page in question is relatively popular, and I don't want to risk it going down while I set this up&lt;/li&gt;
&lt;/ul&gt;

&lt;h1&gt;
  
  
  The QUIC Possibility
&lt;/h1&gt;

&lt;p&gt;Luckily the details of the QUIC transport protocol give us some flexibility here:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;QUIC uses a different underlying protocol (UDP vs TCP), so I can leave apache on TCP port 443 and put up a reverse proxy on the UDP port&lt;/li&gt;
&lt;li&gt;All HTTP/3-capable browsers will try QUIC and, if they get a connection error, will fall back to TCP (and the unmodified apache setup)&lt;/li&gt;
&lt;/ul&gt;

&lt;h1&gt;
  
  
  The Solution
&lt;/h1&gt;

&lt;p&gt;The fix is a simple Caddy reverse proxy. It's running in a docker container to let me "split the bindings": Caddy wants to bind both TCP and UDP ports but I can only give it the UDP port. Containerizing gives me the flexibility of letting it bind both in its container, but only exposing the UDP port to the world.&lt;/p&gt;

&lt;h3&gt;
  
  
  Details
&lt;/h3&gt;

&lt;p&gt;The Caddy installation looks like this. You'll want to tweak a few lines, indicated with "&lt;code&gt;youruser&lt;/code&gt;" or "&lt;code&gt;yoursite&lt;/code&gt;" placeholders:&lt;/p&gt;

&lt;p&gt;setup:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;### change as appropriate for your OS
sudo snap install docker

mkdir ~/caddy/
mkdir ~/caddy/caddy_data
mkdir ~/caddy/caddy_config
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;~/caddy/docker-compose.yaml&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;version: "3.7"

services:
  caddy:
    container_name: caddy
    hostname: caddy
    image: caddy:2.4.6
    restart: unless-stopped
    ports:
      - "443:443/udp"
    volumes:
      - /home/youruser/caddy/Caddyfile:/etc/caddy/Caddyfile
      - /path/to/yoursite/fullchain.pem:/caddy.crt
      - /path/to/yoursite/privkey.pem:/caddy.key
      - /home/youruser/caddy/caddy_data:/data
      - /home/youruser/caddy/caddy_config:/config
    extra_hosts:
      - "host-gateway:172.17.0.1"

volumes:
  caddy_data:
    external: true
  caddy_config:
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;~/caddy/Caddyfile&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{
    auto_https off
    servers {
        protocol {
            experimental_http3
        }
    }
}

yoursite.com {
    tls /caddy.crt /caddy.key
    reverse_proxy * https://host-gateway {
        transport http {
            tls_insecure_skip_verify
        }
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;startup:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;cd ~/caddy
sudo docker-compose up -d
### tail the logs with `sudo docker logs -f caddy`
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Advertising HTTP/3
&lt;/h3&gt;

&lt;p&gt;The above sets up a reverse proxy that serves HTTP/3 on UDP port 443, but nothing will try it until you advertise it on your "real" HTTP server. Fortunately this minor config was the only change needed on the production server:&lt;/p&gt;

&lt;p&gt;In my &lt;code&gt;VirtualHost&lt;/code&gt; apache config for the site:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Header set alt-svc "h3=\":443\"; ma=3600, h3-29=\":443\"; ma=3600
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This advertises an HTTP/3 service (both "standard" and "draft 29" versions of the protocol) with the "Alt-Svc:" header. You'll need to bounce apache for this to take effect.&lt;/p&gt;

&lt;h3&gt;
  
  
  Cert Rotation
&lt;/h3&gt;

&lt;p&gt;One last thing is needed to handle cert rotation. The above solution copies your site certificate and key into the Caddy container, but if you're using LetsEncrypt that cert is only good for three months and is likely being rotated monthly. I run the following in cron to ensure the container is always capturing a relatively fresh certificate:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;### bounce the reverse proxy every month
39 0 25 * * cd /home/youruser/caddy &amp;amp;&amp;amp; /path/to/docker-compose down &amp;amp;&amp;amp; /path/to/docker-compose up -d
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;small&gt;cover image by &lt;a href="https://flickr.com/photos/stephencleary/9962828185"&gt;Stephen Cleary&lt;/a&gt; CC 2.0&lt;/small&gt;&lt;/p&gt;

</description>
      <category>quic</category>
      <category>http3</category>
      <category>apache</category>
      <category>caddy</category>
    </item>
    <item>
      <title>Roughing It with Lisp</title>
      <dc:creator>Michael Driscoll</dc:creator>
      <pubDate>Sun, 15 Jan 2017 04:34:09 +0000</pubDate>
      <link>https://dev.to/syncsynchalt/roughing-it-with-lisp</link>
      <guid>https://dev.to/syncsynchalt/roughing-it-with-lisp</guid>
      <description>&lt;p&gt;Like many software devs, I have a wispy, tenuous, almost nonexistent relationship with Lisp.  In high school I'd dabbled with emacs, in college I had one lambda-loving friend that I mostly ignored, and once I was in the workforce I'd always put "learn some Lisp" on my todo list, usually near the bottom.&lt;/p&gt;

&lt;p&gt;It wasn't until a few weeks ago, when reading Eric Normand's article &lt;a href="https://dev.to/ericnormand/the-idea-of-lisp"&gt;"The Idea of Lisp"&lt;/a&gt; that I finally got the itch.  But how should I go about it?  The article describes the original LISP as a set of five primitives of which the runtime is constructed, like Euclidean geometry which is based on five irreducible axioms.  I had never actually written a language interpreter, and I thought it would be fun to read &lt;a href="https://www.brinckerhoff.org/clements/csc530-sp09/Readings/mccarthy-1960.pdf"&gt;the original McCarthy paper&lt;/a&gt; and see if I could implement the language as described.  Not having an IBM 704 handy I was going to write it in C, in as little code as &lt;del&gt;possible&lt;/del&gt; reasonable, and leaning as heavily as I could on the primitives given.  I wasn't going to cheat and look at other Lisp resources, though I did take a peek at the &lt;a href="https://en.wikipedia.org/wiki/S-expression"&gt;Wikipedia article on S-Expressions&lt;/a&gt; as the visual layout in the original paper wasn't as clear to me.  In short, I wanted to pretend it was April 1960 and I'd just gotten the latest copy of CACM, like some modern-day hiker going out into the woods to pretend that they don't have GPS handy.&lt;/p&gt;

&lt;p&gt;There are a few things that you work out as you implement the language in this paper.  For one, most of the code in the paper is in M-expressions, which are not idiomatic to an Algol-ist like me, and apparently never implemented in software.  Once you're over that hurdle and you're transcoding M-expressions into your language of choice, you'll notice that the function definitions in the paper are sometimes missing a termination condition, or the behavior in some area is unspecified, or the parentheses in a definition are not balanced (ironic in a paper about Lisp).  After you've made some fixes and specified the unspecified, you'll also find that there's an error in the definition of &lt;code&gt;eval&lt;/code&gt;.  I spent half a day working out the latter, only to discover later that the error and the fix are well known (McCarthy hints at it in &lt;a href="http://www-formal.stanford.edu/jmc/recursive.ps"&gt;a 1995 update&lt;/a&gt;, and Paul Graham spells it out in &lt;a href="http://paulgraham.com/rootsoflisp.html"&gt;The Roots of Lisp&lt;/a&gt;).&lt;/p&gt;

&lt;p&gt;The result is, well, &lt;a href="https://github.com/syncsynchalt/axiomatic-lisp"&gt;a crude Lisp implementation&lt;/a&gt;, with the features described in the paper including mark-and-sweep GC, plus some 2-function math.  It's remarkable in that it can parse S-expressions and perform recursive functions in a few hundred lines of C, but it's not a language you'd want to live in.  The first thing you'd want to do with it is make the obvious additions to make it more useful (I'd already started by adding a &lt;code&gt;defun&lt;/code&gt; that puts the necessary &lt;code&gt;lambda&lt;/code&gt; and &lt;code&gt;label&lt;/code&gt; references in a global args scope).  You can really tell that the original paper was an attempt to capture a moving object, that it was a snapshot in time, presumably not long after recursive functions were shown to work but before anyone had done useful work with them.&lt;/p&gt;

&lt;p&gt;It's incredible that this existed in the fifties, a full decade before my universe is usually thought to have begun.  The original Lisp is like a John Harrison clock in that you can't imagine how it was conceived, how it was crafted, or how everything fits so well together.  Thanks for the article Eric, you've shown me a gem.&lt;/p&gt;

&lt;p&gt;&lt;small&gt;cover image by &lt;a href="https://www.flickr.com/photos/aviatordave/"&gt;David Fielding (aviatordave@flickr)&lt;/a&gt; CC BY-NC-ND 2.0&lt;/small&gt;&lt;/p&gt;

</description>
      <category>lisp</category>
      <category>c</category>
      <category>gc</category>
    </item>
    <item>
      <title>Hi, I'm Michael Driscoll</title>
      <dc:creator>Michael Driscoll</dc:creator>
      <pubDate>Sun, 15 Jan 2017 02:51:04 +0000</pubDate>
      <link>https://dev.to/syncsynchalt/hi-im-michael-driscoll</link>
      <guid>https://dev.to/syncsynchalt/hi-im-michael-driscoll</guid>
      <description>&lt;p&gt;I have been coding since 1995.&lt;/p&gt;

&lt;p&gt;You can find me on GitHub as &lt;a href="https://github.com/syncsynchalt" rel="noopener noreferrer"&gt;syncsynchalt&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I live in Parker, Colorado (near Denver).&lt;/p&gt;

&lt;p&gt;I have worked for many companies, all of which I started, and am currently retired and bumming around Intel in my free time.&lt;/p&gt;

&lt;p&gt;My coding progression was C, Perl, C++, Java, Groovy, and eventually everything.&lt;/p&gt;

&lt;p&gt;I am currently learning more about calligraphy.&lt;/p&gt;

&lt;p&gt;Nice to meet you.&lt;/p&gt;

</description>
      <category>introduction</category>
    </item>
  </channel>
</rss>
