<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en_IE"><generator uri="https://jekyllrb.com/" version="4.0.0">Jekyll</generator><link href="https://blog.davidbyrne.dev/feed.xml" rel="self" type="application/atom+xml" /><link href="https://blog.davidbyrne.dev/" rel="alternate" type="text/html" hreflang="en_IE" /><updated>2026-01-06T21:58:03+00:00</updated><id>https://blog.davidbyrne.dev/feed.xml</id><title type="html">David Byrne’s Blog</title><subtitle>Ramblings of a software engineer and tech enthusiast living in the west of Ireland.</subtitle><author><name>David Byrne</name></author><entry><title type="html">Trying out GitHub Actions (Beta)</title><link href="https://blog.davidbyrne.dev/2019/10/12/github-actions" rel="alternate" type="text/html" title="Trying out GitHub Actions (Beta)" /><published>2019-10-12T18:00:00+00:00</published><updated>2019-10-12T18:00:00+00:00</updated><id>https://blog.davidbyrne.dev/2019/10/12/github-actions</id><content type="html" xml:base="https://blog.davidbyrne.dev/2019/10/12/github-actions">&lt;p&gt;Github is developing a new workflow automation feature called Actions. This allows you to run a sequence of operations in response to an event occurring on Github. Whilst the CI/CD features are the main selling point, I actually find some of the other potential use cases more interesting. Just to note, I’ve gotten access to Github Actions limited public beta, so the details of this post could potentially be out of date when the feature becomes generally available on &lt;a href=&quot;https://github.blog/2019-08-08-github-actions-now-supports-ci-cd/&quot;&gt;November 13th&lt;/a&gt;. With that disclaimer out of the way, let’s dive in!&lt;/p&gt;

&lt;p&gt;The main benefit Github Actions brings over existing CI and automation systems is its simplicity. It doesn’t offer any incredibly novel features, just a good UX that takes full advantage of being built directly into the Github platform. Whilst you could make any automation you wanted using Jenkins or Github App integrations, the principle of least resistance means Actions could become a very popular option in the future. Why go to the effort of setting up a separate automation platform when you could just use what Github provides you directly?&lt;/p&gt;

&lt;p&gt;As each workflow is entirely source code based and tracked in git, it makes it very easy to collaborate on and reuse pre-existing actions. If there’s no existing action that does what you need, it’s only a small bit of yaml and maybe a Dockerfile away from being created. Before we get to that though, I should clarify some of the terminology I’ll be using in the rest of the post:&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;Tasks: A task is a single command or operation, and it’s the smallest building block used by Actions. Examples could be &lt;code class=&quot;highlighter-rouge&quot;&gt;npm test&lt;/code&gt; or &lt;code class=&quot;highlighter-rouge&quot;&gt;./deploy.sh&lt;/code&gt;.&lt;/li&gt;
  &lt;li&gt;Actions: Each action is a yaml file defining a series of tasks and the environment to run them in. They’re a higher-level concept than tasks and the smallest portable building block of a workflow. Examples could be &lt;code class=&quot;highlighter-rouge&quot;&gt;maven verify&lt;/code&gt; or &lt;code class=&quot;highlighter-rouge&quot;&gt;notify slack on build failure&lt;/code&gt;.&lt;/li&gt;
  &lt;li&gt;Workflows: These are the highest-level concept in Github Actions. Each workflow is a yaml file that specifies what actions to run and when (on commit, on PR merge to master etc.).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In most cases, a project will define its workflows and these will re-use shared actions. The workflow file would look something like:&lt;/p&gt;
&lt;div class=&quot;language-yaml highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;na&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;Test changes&lt;/span&gt;
&lt;span class=&quot;na&quot;&gt;on&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;pi&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;push&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;# on what events should this action be triggered&lt;/span&gt;

&lt;span class=&quot;na&quot;&gt;jobs&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;# stages inside the workflow,&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;unit-tests&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;runs-on&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;ubuntu-latest&lt;/span&gt;

    &lt;span class=&quot;na&quot;&gt;steps&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;# the list of actions your workflow runs and their configuration&lt;/span&gt;
    &lt;span class=&quot;pi&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;uses&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;actions/checkout@v1&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;# checks out the commit that triggered this run&lt;/span&gt;
    &lt;span class=&quot;pi&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;uses&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;actions/npm@master&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;# uses the Github Action's NPM action&lt;/span&gt;
      &lt;span class=&quot;na&quot;&gt;args&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;test&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;# and configures it to run the test command&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;If you wanted to run a custom action, you’d create a folder for the action (e.g. &lt;code class=&quot;highlighter-rouge&quot;&gt;.github/actions/your-custom-action&lt;/code&gt;). This would contain a yaml file, describing the action, potentially as simple as this:&lt;/p&gt;
&lt;div class=&quot;language-yaml highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;na&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;My custom action&lt;/span&gt;
&lt;span class=&quot;na&quot;&gt;description&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;Runs our custom Docker container as an action&lt;/span&gt;
&lt;span class=&quot;na&quot;&gt;runs&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;using&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;docker'&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;# It can run in either Docker or a JavaScript environment&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;image&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;Dockerfile'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;The &lt;code class=&quot;highlighter-rouge&quot;&gt;action.yaml&lt;/code&gt; in this example would have a Dockerfile in the same directory, which installs and runs whatever we want. The process’ exit code is then used to determine whether the action passed or failed. To run it as part of your workflow, all you’d need to include in the workflow file is &lt;code class=&quot;highlighter-rouge&quot;&gt;- uses ./.github/actions/your-custom-action&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;That example probably covers the majority of use cases, which shows how little is involved in setting up in Github Actions. Of course, there’s a lot more configuration available that I didn’t cover, such as sequential stages and matrix builds, but the &lt;a href=&quot;https://help.github.com/en/categories/automating-your-workflow-with-github-actions&quot;&gt;docs&lt;/a&gt; detail everything I’ve skipped over.&lt;/p&gt;

&lt;p&gt;I said at the start that the CI/CD features weren’t the most exciting possible use-cases, and I stand by that statement. I think the potential of easily setting up other kinds of automation will result in a lot more innovation. Things that previously weren’t worth the effort of setting up are now just a few minutes work. As an example, have you ever been annoyed at having to manually delete the branch after merging a PR&lt;sup&gt;&lt;a href=&quot;#reference-1&quot;&gt;[1]&lt;/a&gt;&lt;/sup&gt;? Since Actions can easily &lt;a href=&quot;https://help.github.com/en/articles/virtual-environments-for-github-actions#github_token-secret&quot;&gt;provide a Github API token&lt;/a&gt;, it’d be fairly trivial to set up a workflow that sends a delete request for the branch on PR merge. Another use case I’ve actually set up is an action that diffs the built version of this blog against the previous version on every change, and comments the result back to Github&lt;sup&gt;&lt;a href=&quot;#reference-2&quot;&gt;[2]&lt;/a&gt;&lt;/sup&gt;. It allows me simply to see what effects a change has, without having to open my browser and try compare the 2 sites. It’s nothing groundbreaking, just a nice quality of life improvement that simplifies my workflow. It’s in small automations like this, that become feasible to implement thanks to Actions, where I think we’ll see the real value-add of the feature.&lt;/p&gt;

&lt;p&gt;&lt;br /&gt;&lt;/p&gt;
&lt;hr /&gt;

&lt;p&gt;&lt;br /&gt;
&lt;span id=&quot;reference-1&quot;&gt;[1]&lt;/span&gt; - There’s &lt;a href=&quot;https://github.blog/changelog/2019-07-31-automatically-delete-head-branches-of-pull-requests/&quot;&gt;now a setting to automatically delete the head branch of a pull request once it has merged&lt;/a&gt;, but if Github Actions was released before this change I think it’d have been a great use case.&lt;/p&gt;

&lt;p&gt;&lt;span id=&quot;reference-2&quot;&gt;[2]&lt;/span&gt; - I’ve since moved this Action out into its own repo &lt;a href=&quot;https://github.com/David-Byrne/jekyll-diff-action&quot;&gt;here&lt;/a&gt;, since it could be useful for most Jekyll sites.&lt;/p&gt;</content><author><name>David Byrne</name></author><category term="github" /><category term="tech" /><summary type="html">Github is developing a new workflow automation feature called Actions. This allows you to run a sequence of operations in response to an event occurring on Github. Whilst the CI/CD features are the main selling point, I actually find some of the other potential use cases more interesting. Just to note, I’ve gotten access to Github Actions limited public beta, so the details of this post could potentially be out of date when the feature becomes generally available on November 13th. With that disclaimer out of the way, let’s dive in!</summary><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blog.davidbyrne.dev/assets/images/01/pencil-1200.png" /><media:content medium="image" url="https://blog.davidbyrne.dev/assets/images/01/pencil-1200.png" xmlns:media="http://search.yahoo.com/mrss/" /></entry><entry><title type="html">Zero Configuration Networking - A Brief Introduction</title><link href="https://blog.davidbyrne.dev/2018/11/11/zeroconf-networking" rel="alternate" type="text/html" title="Zero Configuration Networking - A Brief Introduction" /><published>2018-11-11T20:00:00+00:00</published><updated>2018-11-11T20:00:00+00:00</updated><id>https://blog.davidbyrne.dev/2018/11/11/zeroconf-networking</id><content type="html" xml:base="https://blog.davidbyrne.dev/2018/11/11/zeroconf-networking">&lt;p&gt;Something I’ve recently discovered is zero-configuration networking. It’s surprisingly useful so I thought I’d write up a quick post on it. At a very high level, zeroconf’s aim is to allow you &lt;em&gt;easily browse for available services&lt;/em&gt;. If you’re from ‘Apple-land’ you probably know it as Bonjour, their implementation of the standard. To see how it might be useful though, it’s probably worth looking a bit into how it all works. There are 3 key technologies zeroconf uses, Link Local Addressing, Multicast DNS and DNS Service Discovery, so I’ll go through each of them in a high-level overview.&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;
    &lt;p&gt;Link Local Addressing: This allows a device to allocate itself an IP address in the absence of a manually configured one or a DHCP server. To do this, it first randomly selects an IP address in a specified range. It then sends several ARP requests to this address to check if another device is using it. If it doesn’t get any responses, it starts using this address. It’s a rare situation these days that you don’t have a DHCP server, since pretty much every home router has one built in, so it’s probably the least useful of the 3.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;Multicast DNS (mDNS): This allows a device to allocate itself a domain name in the absence of a local DNS server. It follows a similar set of steps as Link Local Addressing to allocate a domain name. First, the device chooses a domain name, often based off its hostname. It then sends mDNS queries for this name to check if it’s taken. If it’s unclaimed, the device starts using it. Given most home networks don’t have a local DNS server set up, this is more likely to be useful than Link Local Addressing. It gives you the benefits of a domain name (easier to remember, fairly constant) over that of an IP address. For example, between devices that support zeroconf, you should be able to go to &lt;a href=&quot;http://hostname.local&quot;&gt;hostname.local&lt;/a&gt; and it will look up the appropriate IP address in the background, just like a normal domain name. This is especially handy if you’ve a home server and you don’t want to memorise an IP address.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;DNS Service Discovery (DNS-SD): This allows devices to advertise what protocols/services they support. It’s built on top of the DNS standard and can work with either regular DNS (unicast) or mDNS. Special SRV records specify the hostname of the machine and the port number used to offer that specific service. E.g. The SRV record &lt;code class=&quot;highlighter-rouge&quot;&gt;_http._tcp.server.local.&lt;/code&gt; might tell us &lt;a href=&quot;http://server.local&quot;&gt;server.local&lt;/a&gt; is serving HTTP pages at port 80. When a new zeroconf device joins a network, it broadcasts announcement packets saying what services it supports. E.g. A file server might advertise the &lt;code class=&quot;highlighter-rouge&quot;&gt;_ftp._tcp&lt;/code&gt; type service. Other devices that can use FTP will remember this and be able to interact with it as needed. DNS-SD employs multiple techniques to reduce protocol traffic on the network, including infrequent polling and &lt;code class=&quot;highlighter-rouge&quot;&gt;goodbye&lt;/code&gt; packets as devices leave.&lt;/p&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;DNS-SD is the layer that really allows you to easily browse for available services, while the 2 other layers are mainly there to ensure networked devices can actually communicate. Each layer doesn’t require the other layers however, as mDNS can use normal DHCP IP addresses as well as Link Local addresses, and DNS-SD supports both unicast and multicast DNS names. Implementing all 3 ensures things should &lt;em&gt;just work&lt;/em&gt; however, regardless of how the network is set up.&lt;/p&gt;

&lt;p&gt;In theory, this would allow much easier usage of networked resources. Imagine going to a hotel and connecting to their WiFi. You immediately see they offer a “Guest’s Guide” webpage hosted internally. You can browse it like any other website, unaware that it’s using zeroconf networking. One of the pages is a map of the city which you’d like to bring with you. Choosing to print the page brings up a selection of hotel printers automatically, and you can choose whichever is nearest you (e.g. the one labelled “Third Floor Printer”). Maybe later you need to ask the hotel staff a question. Rather than having to look up the phone number, you open up your messaging client and it provides a list of nearby users, including reception. That night you open your video player, and it shows you movies offered by the hotel just as seamlessly as your own local collection. All these features should &lt;em&gt;just work&lt;/em&gt; thanks to zeroconf, without the user needing to know what was happening behind the curtain.&lt;/p&gt;

&lt;p&gt;So if this is all technically possible, why isn’t it the case already? Unfortunately, support for zeroconf is lacklustre. Apple, having written the original standard, provides good support in both iOS and macOS with Bonjour. Most modern Linux distros also have full support thanks to Avahi. Windows doesn’t have any native implementation, although that &lt;a href=&quot;https://stackoverflow.com/a/41019456/4884846&quot;&gt;could be in the process of changing&lt;/a&gt;. Apple also offer Bonjour for windows, although since it isn’t installed by default, most users don’t know about it. Android supports APIs to allow apps interact with zeroconf devices, but these have to be explicitly used by the developers. It means you &lt;a href=&quot;https://android.stackexchange.com/a/51350&quot;&gt;can’t open a .local domain in your browser&lt;/a&gt; and expect it to just work. With the most popular desktop and mobile OSs not supporting the standard, it hasn’t reached the critical mass of users needed to make it ubiquitous. Maybe some hotels in Cupertino have it all set up, but a regular one doesn’t know what zeroconf is and wouldn’t bother to set it up unless most guests wanted it. It feels like we’re within touching distance of the futuristic computers imagined by sci-fi, but until zeroconf receives wider support it will remain an elusive dream.&lt;/p&gt;

&lt;p&gt;&lt;br /&gt;
&lt;br /&gt;&lt;/p&gt;

&lt;p&gt;If you’re interested in learning more about zeroconf, &lt;a href=&quot;https://www.oreilly.com/library/view/zero-configuration-networking/0596101007/&quot;&gt;Zero Configuration Networking: The Definitive Guide&lt;/a&gt; is a great resource.&lt;/p&gt;</content><author><name>David Byrne</name></author><category term="tech" /><category term="networking" /><summary type="html">Something I’ve recently discovered is zero-configuration networking. It’s surprisingly useful so I thought I’d write up a quick post on it. At a very high level, zeroconf’s aim is to allow you easily browse for available services. If you’re from ‘Apple-land’ you probably know it as Bonjour, their implementation of the standard. To see how it might be useful though, it’s probably worth looking a bit into how it all works. There are 3 key technologies zeroconf uses, Link Local Addressing, Multicast DNS and DNS Service Discovery, so I’ll go through each of them in a high-level overview.</summary><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blog.davidbyrne.dev/assets/images/01/pencil-1200.png" /><media:content medium="image" url="https://blog.davidbyrne.dev/assets/images/01/pencil-1200.png" xmlns:media="http://search.yahoo.com/mrss/" /></entry><entry><title type="html">Updating Linux using A/B Partitions</title><link href="https://blog.davidbyrne.dev/2018/08/16/linux-ab-partitions" rel="alternate" type="text/html" title="Updating Linux using A/B Partitions" /><published>2018-08-16T16:00:00+00:00</published><updated>2018-08-16T16:00:00+00:00</updated><id>https://blog.davidbyrne.dev/2018/08/16/linux-ab-partitions</id><content type="html" xml:base="https://blog.davidbyrne.dev/2018/08/16/linux-ab-partitions">&lt;p&gt;This is a method I’ve used to upgrade Linux machines that aims to minimise issues and downtime. It’s especially handy if, like me, your main computer runs Linux and you don’t like being unable to use it for long periods of time. It does come at a cost of disk space however, since we’re using extra partitions. If that’s an issue for you, then it’s probably better that you use some other option instead.&lt;/p&gt;

&lt;p&gt;So firstly, a bit of background: what are A/B partitions? It’s basically the idea of having 2 copies of an operating system on your hard drive and only one is updated at a time, ensuring you always have a working OS to boot into. If you’re using A as the main partition, then the next update is applied to B. When you reboot, it loads B first and if that fails for any reason, it falls back to booting A which is untouched since you last used your device. If B works fine however, the system marks B as the new main partition and A will be used to install the next update into. You can think of it like hiking up a mountain, you only lift your back foot when you’re sure your front foot has a solid grip.&lt;/p&gt;

&lt;p&gt;A/B partitions are used by Google to apply ‘seamless’ updates to &lt;a href=&quot;https://source.android.com/devices/tech/ota/ab/&quot;&gt;Android and Chrome OS&lt;/a&gt;, although what we’re doing won’t be quite as effortless as Google’s implementation.  This is because we’ll need to manually decide what is considered the main partition, which has benefits and drawbacks. For example, we can use this to test out Fedora alongside our main Ubuntu installation, without having to set Fedora as the main OS just because it boots successfully. It does mean we have to manage the partitions ourselves though, which somewhat increases the complexity of the system. In general, I apply any normal updates directly to my main partition, but apply any potentially risky updates to the secondary partition.&lt;/p&gt;

&lt;h3 id=&quot;preparing-the-partitions&quot;&gt;Preparing the partitions&lt;/h3&gt;
&lt;p&gt;Before you start doing anything: &lt;strong&gt;make a backup and test it!&lt;/strong&gt; Your data should probably be safe but messing with partitions is always a risky manoeuvre, don’t tempt fate and just have a backup.&lt;/p&gt;

&lt;p&gt;For the purposes of this post, I’m going to assume you have a regular enough partition layout of a boot partition, a single main OS partition and maybe a swap partition. It doesn’t really matter what you have though, just adapt the instructions to your set up and it should work out. The only partition we’ll be working with is that main OS partition so we can ignore the rest.&lt;/p&gt;

&lt;p&gt;First, make a live USB from the latest stable Ubuntu release (or another distro of your choice). Boot into it and use the disk manager to shrink your main OS partition. Ideally shrink it by half, but if you don’t have that much space, make it as small as you can while still having enough space to comfortably run the OS in.&lt;/p&gt;

&lt;p&gt;Next, create a new partition to fill up all the free space you’ve just created. Choose ext4 as the filesystem and &lt;code class=&quot;highlighter-rouge&quot;&gt;/&lt;/code&gt; as the mount point if asked. You can name this partition ‘B’ and the shrunken main OS partition ‘A’ to keep track of which is which.&lt;/p&gt;

&lt;p&gt;You should now have the partition layout set up with an A partition that contains your main OS, and a B partition that’s ready to install an OS into.&lt;/p&gt;

&lt;h3 id=&quot;applying-ab-style-updates&quot;&gt;Applying A/B style updates&lt;/h3&gt;
&lt;p&gt;Given the high frequency of Linux updates, as well as the slight hassle involved in switching the chosen main partition, I usually just apply normal updates directly to the current main partition. I’ve never been burned by this so I figure it’s a safe enough option.&lt;/p&gt;

&lt;p&gt;For riskier updates, I do use the A/B partitions to ensure I always have a fallback option. There are 2 different strategies I use to handle these updates and I’ll go through them both:&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;
    &lt;p&gt;Clone and Update: For whatever reason, you’ve decided a new update could be risky. It could be using a new kernel, or switching a core piece of the OS, but the specifics don’t really matter. What I’d do is clone the main partition (e.g. A) into the other partition (e.g. B) before applying any updates. Then, boot into the B partition and install the update. If the update works, set B as the main partition and off you go. If it fails, keep using A as the main partition and no damage was done. This type of approach is probably more useful if you use a rolling release distro such as Arch or Solus.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;Install and Upgrade: Upgrading from an old version of a distro to a newer version can often cause problems that are tricky to solve. While you could just upgrade directly (from the cloned partition of course), it’s usually safest to do a fresh install. This is easy with the A/B partitions as you can install the new OS into the secondary partition, leaving the main partition intact. You can then migrate at your own pace to the new OS and mark the updated partition as the main one whenever you’re ready. I mostly use standard release distros so this is my favoured approach.&lt;/p&gt;
  &lt;/li&gt;
&lt;/ol&gt;

&lt;h3 id=&quot;other-tips&quot;&gt;Other tips&lt;/h3&gt;
&lt;ul&gt;
  &lt;li&gt;
    &lt;p&gt;Specifying the grub loader: If the default grub loader being used isn’t the one you’d like, you can manually set which one to use instead. Boot into the OS that contains your chosen grub loader and run &lt;code class=&quot;highlighter-rouge&quot;&gt;sudo grub-install /dev/sda&lt;/code&gt; , replacing &lt;code class=&quot;highlighter-rouge&quot;&gt;/dev/sda&lt;/code&gt; with the default boot device set in the BIOS. You’ll probably want to run &lt;code class=&quot;highlighter-rouge&quot;&gt;sudo update-grub&lt;/code&gt; afterwards to help it detect any other operating systems that are also installed.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;Customising the grub loader: If you want to further customise your grub loader, &lt;a href=&quot;https://launchpad.net/~danielrichter2007/+archive/ubuntu/grub-customizer&quot;&gt;Grub Customizer&lt;/a&gt; is a useful GUI program. It supports  reordering, renaming and removing boot options, changing the grub colour-scheme and many other features. If you want to do something with your grub that’s not a simple terminal command, this is probably the right tool for the job.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;Testing backups: If you’re using the ‘Install and Upgrade’ option described above, it provides a perfect opportunity to test your backup restoration strategy. You should be able to restore everything you want in your new OS without having to mount the other partition. If this isn’t the case, then it’s a good thing you found it out this way and not in a real failure scenario instead.&lt;/p&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;That’s pretty much all you need to know about using A/B partitions with Linux. Best of luck with it and happy updating!&lt;/p&gt;</content><author><name>David Byrne</name></author><category term="tech" /><category term="linux" /><category term="updates" /><summary type="html">This is a method I’ve used to upgrade Linux machines that aims to minimise issues and downtime. It’s especially handy if, like me, your main computer runs Linux and you don’t like being unable to use it for long periods of time. It does come at a cost of disk space however, since we’re using extra partitions. If that’s an issue for you, then it’s probably better that you use some other option instead.</summary><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blog.davidbyrne.dev/assets/images/01/pencil-1200.png" /><media:content medium="image" url="https://blog.davidbyrne.dev/assets/images/01/pencil-1200.png" xmlns:media="http://search.yahoo.com/mrss/" /></entry><entry><title type="html">Creating a Blog using Jekyll and Netlify</title><link href="https://blog.davidbyrne.dev/2018/07/05/jekyll-and-netlify-blog" rel="alternate" type="text/html" title="Creating a Blog using Jekyll and Netlify" /><published>2018-07-05T19:00:00+00:00</published><updated>2018-07-05T19:00:00+00:00</updated><id>https://blog.davidbyrne.dev/2018/07/05/jekyll-and-netlify-blog</id><content type="html" xml:base="https://blog.davidbyrne.dev/2018/07/05/jekyll-and-netlify-blog">&lt;p&gt;With my blog now set up and all working, I figured I should document the process in case I ever need to re-do it. So here it is: How to create a blog using Jekyll and Netlify. Jekyll is a static website builder with a specific focus on blogs, and Netlify is a free static website host. Both projects offer amazing documentation so a lot of the steps below will mainly be linking back to specific parts of their docs - it’s not just me being lazy with the details, I swear!&lt;/p&gt;

&lt;h3 id=&quot;installing-jekyll&quot;&gt;Installing Jekyll&lt;/h3&gt;
&lt;p&gt;Obviously if you’re going to use Jekyll to generate your blog, you’ll want to have it installed first. They provide &lt;a href=&quot;https://jekyllrb.com/docs/installation/&quot;&gt;detailed installation instructions for Windows, MacOS and Linux here&lt;/a&gt;, so go do as they say and you should have Jekyll up and running in no time.&lt;/p&gt;

&lt;h3 id=&quot;creating-the-blog&quot;&gt;Creating the Blog&lt;/h3&gt;
&lt;p&gt;Again, Jekyll provides &lt;a href=&quot;https://jekyllrb.com/docs/quickstart/&quot;&gt;a quick start guide here&lt;/a&gt; on how to create the blog, but it can be summed up as running &lt;code class=&quot;highlighter-rouge&quot;&gt;jekyll new myblog&lt;/code&gt; (where myblog is the directory it will create to hold everything) and then running &lt;code class=&quot;highlighter-rouge&quot;&gt;bundle exec jekyll serve&lt;/code&gt; from inside the newly created directory. Now you should be able to see your blog up and running at &lt;a href=&quot;http://localhost:4000&quot;&gt;http://localhost:4000&lt;/a&gt;. Congrats, you now have a blog so you’re pretty much halfway there… well, almost!&lt;/p&gt;

&lt;h3 id=&quot;modifying-the-content&quot;&gt;Modifying the content&lt;/h3&gt;
&lt;p&gt;Ok, I suppose having the blog isn’t much use if it doesn’t contain any of your content, so that’s the next step. You’ll need a text editor to change these files, I quite like &lt;a href=&quot;https://code.visualstudio.com/&quot;&gt;Visual Studio Code&lt;/a&gt; but any one will work. First, open the &lt;code class=&quot;highlighter-rouge&quot;&gt;_config.yml&lt;/code&gt; file inside the &lt;code class=&quot;highlighter-rouge&quot;&gt;myblog&lt;/code&gt; directory. In this, modify the personal details (title, email, description…) to whatever you want.&lt;/p&gt;

&lt;p&gt;Next up is the file called &lt;code class=&quot;highlighter-rouge&quot;&gt;about.md&lt;/code&gt;, which is used to generate the about page for your blog. This uses markdown which gives you more control over the format of the generated page. (Protip: In VS Code, the key combination &lt;code class=&quot;highlighter-rouge&quot;&gt;ctrl + k, v&lt;/code&gt; gives you a side by side view of the markdown you’re editing and the page it’s generating.) You can make any changes to this file, and they should be reflected when you refresh the about page in the browser (assuming &lt;code class=&quot;highlighter-rouge&quot;&gt;bundle exec jekyll serve&lt;/code&gt; is still running from earlier).&lt;/p&gt;

&lt;p&gt;Finally, it’s time to create a post on this new blog of yours. As nice as those default posts are, they’re probably not what you want to show to your readers. So inside the &lt;code class=&quot;highlighter-rouge&quot;&gt;_posts&lt;/code&gt; directory, create a new file with a name matching the format used by the default posts (i.e. YYYY-MM-DD-name-of-post.md). There are some attributes describing the post (called &lt;a href=&quot;https://jekyllrb.com/docs/frontmatter/&quot;&gt;Front Matter&lt;/a&gt;) kept inside triple dashes at the top of the file that Jekyll will look for. You can copy these from some of the default posts included by Jekyll or from here:&lt;/p&gt;
&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;---
layout: post
title: Creating a Blog using Jekyll and Netlify
author: David Byrne
---
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;You’ll obviously want to customise them to suit your own post however. Beneath this, you can start writing the actual content of the post. When you’re happy with what you’ve written, you can refresh the browser window to see your new blog post.&lt;/p&gt;

&lt;h3 id=&quot;pushing-to-github&quot;&gt;Pushing to GitHub&lt;/h3&gt;
&lt;p&gt;Once you’re happy with what you’ve written, it’s time to begin the process of making your blog public. You can’t push your site to Netlify directly, so you’ll have to create a GitHub repo first and then let Netlify access that. Follow the &lt;a href=&quot;https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/&quot;&gt;GitHub instructions here&lt;/a&gt; to create a repo and upload your blog.&lt;/p&gt;

&lt;h3 id=&quot;publishing-with-netlify&quot;&gt;Publishing with Netlify&lt;/h3&gt;
&lt;p&gt;Now that you’ve got everything else set up, it’s time to publish the blog using Netlify’s free hosting. Visit &lt;a href=&quot;https://www.netlify.com/&quot;&gt;www.netlify.com&lt;/a&gt; and link your GitHub account. Then select to create a new site and choose the GitHub repo containing your blog. Netlify should detect it’s a Jekyll site automatically and fill in the appropriate build instructions for you. Click to continue and Netlify will automatically build and deploy your blog. This should take less than a minute, after which Netlify will tell you it was deployed successfully and provide a URL to the site (eg. example.netlify.com). Visit this site and you should find your blog just like you previewed it locally, except now it’s accessible by the entire world! To make any changes or new posts, modify your files locally in the myblog directory, push the updates to GitHub and Netlify should automatically rebuild and deploy your new site.&lt;/p&gt;

&lt;p&gt;And that’s it, you now have a blog that can be written using markdown, built using Jekyll and hosted with Netlify. There are a few extra, nice-to-haves that I added however, so take a look through the next few sections in case you want any of them on your blog.&lt;/p&gt;

&lt;h3 id=&quot;custom-domain&quot;&gt;Custom Domain&lt;/h3&gt;
&lt;p&gt;Although there’s nothing wrong with your blog being on example.netlify.com, it would look fancier to have it on a custom domain. If you don’t have a domain name already, you can buy one from Netlify and they’ll handle configuring everything for you. If you already own the domain you want to use, you’ll have to set it up with your DNS providers. This generally involves creating a CNAME record pointing blog.custom-domain.com to example.netlify.com, obviously using your own values there instead of the placeholders. Your DNS provider will have full instructions on how to do this. Inside the Netlify control panel, you can add and verify the custom domain you’re using, letting Netlify host your blog at that new address. After waiting a few minutes to let DNS changes propagate, you should be able to open blog.custom-domain.com and see your own blog.&lt;/p&gt;

&lt;h3 id=&quot;https&quot;&gt;HTTPS&lt;/h3&gt;
&lt;p&gt;There’s currently a big push towards every site being secure by default on the web. With major browsers moving towards &lt;a href=&quot;https://security.googleblog.com/2018/02/a-secure-web-is-here-to-stay.html&quot;&gt;marking HTTP sites as insecure&lt;/a&gt;, you’ll want to ensure HTTPS is enabled for your blog. Netlify provide HTTPS connections free of charge, including for custom domains, so you’ve no reason not to use it. If Netlify haven’t enabled it by default for your site, you can check a box in the domain management section of your settings to allow them to use HTTPS.&lt;/p&gt;

&lt;h3 id=&quot;disabling-your-old-domain&quot;&gt;Disabling your old domain&lt;/h3&gt;
&lt;p&gt;Just when you thought you were done with messing about with domain names, surprise! Currently your site is available from both blog.custom-domain.com and example.netlify.com. If you want to ensure everyone only uses your custom domain and not your Netlify one, you’ll have to create a redirect. In the root of your myblog folder, create a file called &lt;code class=&quot;highlighter-rouge&quot;&gt;netlify.toml&lt;/code&gt;. In that, add the following (except using your blog’s URLs instead):&lt;/p&gt;
&lt;div class=&quot;language-toml highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nn&quot;&gt;[[redirects]]&lt;/span&gt;
  &lt;span class=&quot;py&quot;&gt;from&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;https://example.netlify.com/*&quot;&lt;/span&gt;
  &lt;span class=&quot;py&quot;&gt;to&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;https://blog.custom-domain.com/:splat&quot;&lt;/span&gt;
  &lt;span class=&quot;py&quot;&gt;status&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;301&lt;/span&gt;
  &lt;span class=&quot;py&quot;&gt;force&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;true&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;This tells Netlify to redirect everyone from any page at your Netlify domain to the same page but at your custom domain. You can test it out by going to the Netlify domain in your browser and watch as you’re sent to the custom domain instead. Now you can rest assured everyone who reads your blog will see it at your fancy custom domain instead.&lt;/p&gt;

&lt;p&gt;If you’re wondering why this section is down here and not up with the rest of the custom domain configuration, it’s because you have to specify the protocol (i.e. HTTP or HTTPS) in the redirect rule. If you didn’t have HTTPS set up and you put it in the redirect rule above, things would break and you wouldn’t be very happy with me. But it’s ok, that’s the end of all the custom domain configuration, I promise!&lt;/p&gt;

&lt;h3 id=&quot;http2&quot;&gt;HTTP/2&lt;/h3&gt;
&lt;p&gt;HTTP/2 is a brand new version of the protocol the web runs on. The major browsers all require HTTPS to be used for HTTP/2 though so if you’ve skipped over the &lt;a href=&quot;#https&quot;&gt;HTTPS section above&lt;/a&gt;, it might be a good idea to go back up there. HTTP/2 has a number of features designed for higher efficiency loading of pages, which in theory would allow your blog to load faster. The blog created by Jekyll is so light though, there’s probably no noticeable benefit of using it… but it’s a new thing, and I like playing with new things, so I did. There’s no real need for you to do anything though, unless you also like playing with new things, in which case you’ve come to the right place.&lt;/p&gt;

&lt;p&gt;Most of the HTTP/2 features are managed automatically by Netlify, so you don’t have to worry about them. The big feature you do need to do something for is called “server push”. This allows servers to send extra resources to browsers before they ask for them, saving a round trip. This can be controlled by adding special headers to your HTTP/2 responses. Jekyll generates a &lt;code class=&quot;highlighter-rouge&quot;&gt;main.css&lt;/code&gt; file that’s used by every page of the blog, so it’s an ideal use-case for server push. Open the &lt;code class=&quot;highlighter-rouge&quot;&gt;netlify.toml&lt;/code&gt; file again and add:&lt;/p&gt;
&lt;div class=&quot;language-toml highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nn&quot;&gt;[[headers]]&lt;/span&gt;
  &lt;span class=&quot;py&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;/*&quot;&lt;/span&gt;
  &lt;span class=&quot;nn&quot;&gt;[headers.values]&lt;/span&gt;
  &lt;span class=&quot;py&quot;&gt;Link&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;
    &lt;span class=&quot;s&quot;&gt;&quot;&amp;lt;/assets/main.css&amp;gt;; rel=preload; as=style&quot;&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;This states that for every request, Netlify should add the appropriate header telling them to push the &lt;code class=&quot;highlighter-rouge&quot;&gt;main.css&lt;/code&gt; file to the client. You can quickly verify the server push is working by checking the network tab of your browser dev-tools, and looking for evidence it was pushed without the browser having to specifically request it. If you have &lt;code class=&quot;highlighter-rouge&quot;&gt;nghttp&lt;/code&gt; installed, it’s easier to test using that by running: &lt;code class=&quot;highlighter-rouge&quot;&gt;nghttp -ans https://blog.custom-domain.com&lt;/code&gt;. This should produce an output containing something like:&lt;/p&gt;
&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;id  responseEnd requestStart  process code size request path
13    +607.47ms       +157us 607.31ms  200   1K /
 2       +1.25s *  +603.54ms 647.11ms  200   1K /assets/main.css
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;The * in the requestStart column of the &lt;code class=&quot;highlighter-rouge&quot;&gt;main.css&lt;/code&gt; entry means the file was pushed without the client having to specifically request it, showing you’ve got it set up correctly.&lt;/p&gt;

&lt;h3 id=&quot;jekyll-plugins&quot;&gt;Jekyll Plugins&lt;/h3&gt;
&lt;p&gt;Jekyll has a massive ecosystem of plugins that can be used to customise your site in countless ways. Chances are if you want to modify something about your blog, someone out there has already done it and published the plugin. Although some plugins may have more complexity in their set up, the main installation steps will be the same. We’ll take the &lt;a href=&quot;https://github.com/jekyll/jemoji&quot;&gt;jemoji&lt;/a&gt; plugin as an example to work through, which adds Slack and Github style emoji support to your posts.&lt;/p&gt;

&lt;p&gt;Go to the jemoji releases section and find the latest version (0.10 at the time of writing). Then, in your &lt;code class=&quot;highlighter-rouge&quot;&gt;Gemfile&lt;/code&gt; file, add &lt;code class=&quot;highlighter-rouge&quot;&gt;gem &quot;jemoji&quot;, &quot;~&amp;gt; 0.10&quot;&lt;/code&gt; inside the Jekyll plugins group section. Next, add &lt;code class=&quot;highlighter-rouge&quot;&gt;- jemoji&lt;/code&gt; to the plugins section of your &lt;code class=&quot;highlighter-rouge&quot;&gt;_config.yml&lt;/code&gt; file, telling Jekyll to use  this plugin when building the site. Now, we have to actually install the plugin, which can be done by running &lt;code class=&quot;highlighter-rouge&quot;&gt;bundle install&lt;/code&gt;. Since we have everything set up, we should be able to take advantage of this plugin to start adding emojis everywhere. Try adding &lt;code class=&quot;highlighter-rouge&quot;&gt;:thumbsup:&lt;/code&gt; to a post, and then re-run &lt;code class=&quot;highlighter-rouge&quot;&gt;bundle exec jekyll serve&lt;/code&gt; to preview your site. You should now see a :thumbsup: instead.&lt;/p&gt;

&lt;p&gt;Plugins can be used to change the site’s theme, add multi-language support (i18n), support blogging formats other than markdown, improve SEO, minify assets etc. so go have a look at what’s available and I’m sure you’ll find a few to use for your blog.&lt;/p&gt;

&lt;h3 id=&quot;wrap-up&quot;&gt;Wrap-up&lt;/h3&gt;
&lt;p&gt;And that’s pretty much it. There’s much more you can do with Jekyll and Netlify but I’ve covered the most important features above. For anything else you want to do, I’m sure there are plenty of guides out there that’ll walk you through it. So go enjoy your new blog!&lt;/p&gt;</content><author><name>David Byrne</name></author><category term="tech" /><category term="blog" /><category term="jekyll" /><summary type="html">With my blog now set up and all working, I figured I should document the process in case I ever need to re-do it. So here it is: How to create a blog using Jekyll and Netlify. Jekyll is a static website builder with a specific focus on blogs, and Netlify is a free static website host. Both projects offer amazing documentation so a lot of the steps below will mainly be linking back to specific parts of their docs - it’s not just me being lazy with the details, I swear!</summary><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blog.davidbyrne.dev/assets/images/01/pencil-1200.png" /><media:content medium="image" url="https://blog.davidbyrne.dev/assets/images/01/pencil-1200.png" xmlns:media="http://search.yahoo.com/mrss/" /></entry><entry><title type="html">Hello World!</title><link href="https://blog.davidbyrne.dev/2018/07/01/hello-world" rel="alternate" type="text/html" title="Hello World!" /><published>2018-07-01T19:16:19+00:00</published><updated>2018-07-01T19:16:19+00:00</updated><id>https://blog.davidbyrne.dev/2018/07/01/hello-world</id><content type="html" xml:base="https://blog.davidbyrne.dev/2018/07/01/hello-world">&lt;p&gt;Hello world! This is the first post in my new blog, and if you’re reading it, I guess that means everything worked. So yay!&lt;/p&gt;

&lt;p&gt;There’ll be occasional posts whenever I get around to writing them, and they’ll probably be a bit longer than this one. But this is a start and it makes everything look slightly less bare, so it’ll do.&lt;/p&gt;</content><author><name>David Byrne</name></author><summary type="html">Hello world! This is the first post in my new blog, and if you’re reading it, I guess that means everything worked. So yay!</summary><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blog.davidbyrne.dev/assets/images/01/pencil-1200.png" /><media:content medium="image" url="https://blog.davidbyrne.dev/assets/images/01/pencil-1200.png" xmlns:media="http://search.yahoo.com/mrss/" /></entry></feed>