This post is a work in progress.
Distributed computing systems are an important reality to wrestle with at many levels of technical exposure. Similar to the concept of a cluster I discussed in this blog post, a distributed system is “a collection of autonomous computing elements that appears to its users as a single coherent system” (van Steen, Tanenbaum). Distributed computing environments introduce new dynamics which can affect application development. Enterprise-level corporations (< 500-1000 employees) are best known to operate in distributed environments, and any organization larger than that is guaranteed to use distributed computing. To contrast a cluster from a distributed system, I would say that a cluster is a galaxy and a distributed computing environment is a universe.
It is common for someone new to a distributed system to make some basic assumptions which will cause more issues given time. These assumptions are known as the Fallacies of Distributed Computing.
The fallacies of distributed computing are:
The reading list below is a copy of the currently available version written by Christopher Meiklejohn.
The problems of establishing consensus in a distributed system.
In Search of an Understandable Consensus Algorithm
2013
A Simple Totally Ordered Broadcast Protocol
2008
Paxos Made Live - An Engineering Perspective
2007
The Chubby Lock Service for Loosely-Coupled Distributed Systems
2006
2001
Impossibility of Distributed Consensus with One Faulty Process
1985
The Byzantine Generals Problem
1982
Types of consistency, and practical solutions to solving ensuring atomic operations across a set of replicas.
Highly Available Transactions: Virtues and Limitations
2013
Consistency Tradeoffs in Modern Distributed Database System Design
2012
CAP Twelve Years Later: How the “Rules” Have Changed
2012
Calvin: Fast Distributed Transactions for Partitioned Database Systems
2012
2005
Brewer’s Conjecture and the Feasibility of Consistent, Available, Partition-Tolerant Web Services
2002
Harvest, Yield, and Scalable Tolerant Systems
1999
Linearizability: A Correctness Condition for Concurrent Objects
1990
Time, Clocks, and the Ordering of Events in a Distributed System
1978
Studies on data structures which do not require coordination to ensure convergence to the correct value.
A Comprehensive Study of Convergent and Commutative Replicated Data Types
2011
A Commutative Replicated Data Type For Cooperative Editing
2009
CRDTs: Consistency Without Concurrency Control
2009
Languages aimed towards disorderly distributed programming as well as case studies on problems in distributed programming.
Logic and Lattices for Distributed Programming
2012
Dedalus: Datalog in Time and Space
2011
MapReduce: Simplified Data Processing on Large Clusters
2004
A Note On Distributed Computing
1994
Implemented and theoretical distributed systems.
Spanner: Google’s Globally-Distributed Database
2012
ZooKeeper: Wait-free coordination for Internet-scale systems
2010
A History Of The Virtual Synchrony Replication Model
2010
Cassandra — A Decentralized Structured Storage System
2009
Dynamo: Amazon’s Highly Available Key-Value Store
2007
Stasis: Flexible Transactional Storage
2006
Bigtable: A Distributed Storage System for Structured Data
2006
2003
Lessons from Giant-Scale Services
2001
Towards Robust Distributed Systems
2000
Cluster-Based Scalable Network Services
1997
The Process Group Approach to Reliable Distributed Computing
1993
Overviews and details covering many of the above papers and concepts compiled into single resources.
Distributed Systems: for fun and profit
2013
Programming Distributed Computing Systems: A Foundational Approach
2013
2012
Introduction to Reliable and Secure Distributed Programming
2011
How does one run containers on k3s? Here are a few things I did to play around with my cluster.
The following syntax describes how to run kubectl
commands from the terminal:
kubectl [command] [TYPE] [NAME] [flags]
command
specifies the operation to be performedTYPE
specifies the resource type (e.g. pod, node, deployment, service)NAME
specifies the name of the resourceflags
specifies optional flagsDocumentation: kubectl run
BusyBox is a suite of tools for Linux that provides a shell interface. The image is useful for testing as a running container because the image is lightweight. I used the following command to ephemerally run the container on k3s:
k3s kubectl run -it --rm --restart=Never busybox-test --image=busybox sh
k3s
: CLI for k3skubectl
: CLI for Kubernetes (wrapped by k3s)run
: kubectl command-it
: make the container interactive-rm
: delete the pod after it exits. Only valid when attaching to the container, e.g. with ‘–attach’ or with ‘-i/–stdin’--restart=Never
: do not restart the container upon exitbusybox-test
: the resource name (used by k8s)--image=busybox
: specifies busybox
as the image to build the containersh
: requests sh
access to busybox
shell in containerDid you know there was a package manager for Kubernetes clusters? Helm is a tool useful for installing Charts which is a Helm package containing all resource definitions necessary to run some application, tool, or service on a k8s cluster. In addition to Charts, Helm also embodies two other concepts: a Repository is the place where charts can be collected and shared and a Release is an instance of a chart running on a k8s cluster. From the Helm intro: “Helm installs charts into Kubernetes, creating a new release for each installation. And to find new charts, you can search Helm chart repositories.”
Using Helm, I can leverage my k3s cluster by making use of existing Helm charts.
I want to run a simple VPN server on my network. It won’t handle crazy traffic and I’m mostly trying this just for the sake of learning.
First, I installed Helm
to node1
so that I could use the openvpn-as helm chart. I used the following command to add charts from stenic
to the Helm package repositories:
helm repo add stenic <<<<<<<<https://stenic.github.io/helm-charts>>>>>>>>
The next command deploys the container:
helm install openvpn-ml --set "service.type=LoadBalancer" stenic/openvpn-as
I initally encountered this error after running the helm install
command:
Error: INSTALLATION FAILED: Kubernetes cluster unreachable: Get "<<<<<<<<http://localhost:8080/version":>>>>>>>> dial tcp [::1]:8080: connect: connection refused
The error stems from Helm trying to make use of the same configuration file used by Kubernetes. Since I am running k3s, the following command sets the KUBECONFIG
environment variable to point to the k3s configuration:
export KUBECONFIG=/etc/rancher/k3s/k3s.yaml
Now, Helm should be able to install the chart and make use of the k3s cluster.
I was not able to get OpenVPN properly set up as the pod running OpenVPN Access Server has a status of CrashLoopBackoff
but it does appear that the chart was able to deploy 12 running pods.
In March 2021 I first posted about setting up a Pi cluster. Initially, I had tried (and subsequently failed) to set up a full-fledged Kubernetes (k8s) cluster. Then, I discovered k3s, a lightweight distribution of Kubernetes designed for edge environments (which also works on ARM devices). It ships with an embedded sqlite3 database as default storage when setting up a server node but it is trivial to use etcd3/MySQL/PostgreSQL if desired. I was very pleased with how simple the k3s launcher is and it made the entire installation experience straightforward.
I based my installation on the single-server setup with an embedded database documented by Rancher. In my configuration, node1
is running k3s in server
mode and node[2:6]
is running it in agent
mode. Here’s a breakdown of what I had to do to install k3s.
Note During the installation process I encountered this error:
[INFO] Failed to find memory cgroup, you may need to add "cgroup_memory=1 cgroup_enable=memory" to your linux cmdline (/boot/cmdline.txt on a Raspberry Pi)
To resolve the issue, I added the recommended flags to the linux cmdline as the error message suggests on each node before installing k3s.
On node1
I installed k3s.
curl -sfL <<<<<<<<https://get.k3s.io>>>>>>>> | sh -
Then, I started k3s in server
mode:
k3s server
The other nodes were even easier. When it’s installed and run, k3s will check for K3S_URL
and K3S_TOKEN
environment variables. If they are set, then k3s assumes this is a worker node and starts up in agent
mode. As root
, I copied the token value from node1:/var/lib/rancher/k3s/server/node-token
and used the following command to install k3s and automatically register the node with the server running on node1
(full token values omitted):
curl -sfL <<<<<<<<https://get.k3s.io>>>>>>>> | K3S_URL=<<<<<<<<https://node1:6443>>>>>>>> K3S_TOKEN=K109...f2bb::server:bc1...2e9 sh -
I checked out the results of my installation on node1
using k3s kubectl get nodes
.
Discord is useful for text and voice chat and sharing a screen is trivially simple. Despite these incredibly powerful features, it is less intuitive to share audio from your computer to a Discord channel. Enter, VB-Audio.
This blog post is based on setting up VoiceMeeter Banana on Windows 10 but the software is also supported on Mac OS devices.
The first step for getting audio from desktop applications to Discord is to send the audio to an application we can control. VB-Audio software provides a virtual cable driver. The driver creates a single virtual input and a single virtual output. This enables Windows to pipe audio output to a virtual input. On my computer, this is named VoiceMeeter Input.
Download and install the Virtual Audio Cable from VB-Audio.
VoiceMeeter Banana is a virtual audio mixer. It will allow us to control physical and virtual I/O. In addition to sending audio to Discord this application is useful for streaming or creating networked audio systems.
I have configured Discord to use the virtual cable input as its audio output so that I can control the audio from other speakers in Banana. This audio is sent to my headphones (A1) but if I were to take my headphones off then I would also send it to my desktop speakers (A2).
My headset microphone is configured in input 2 and sent to the virtual output called VoiceMeeter VAIO. This is how I am able to send desktop audio to Discord: it takes the same route as my microphone audio. There is an additional virtual output called VoiceMeeter AUX VAIO, which is useful if configuring an additional output like another pair of monitor headphones.
Download and install VoiceMeeter Banana virtual audio mixer from VB-Audio.
I am in a number of servers but the impetus for setting up a virtual mixer came from my desire to host a watch party in a server I set up for jxnfilm.club
.
Join the discord here: discord.jxnfilm.club
Without using SEO tags to serve metadata for social media, links will appear plainly and without much to draw the eye. I wanted to change how my blog post presents on social media, so I searched for how to add SEO tags to my existing blog. Since my blog is built on GitHub Pages and thus uses Jekyll, I was able to install the jekyll-seo-tag
plugin. Here’s how.
In the Gemfile
of the Jekyll project add the following line:
gem 'jekyll-seo-tag'
The Gemfile
is used when testing my blog locally using bundle exec jekyll serve
.
In the _config.yml
of the project, find the plugins_dir
section and add the following line:
- jekyll-seo-tag
A GitHub Actions workflow will execute builds and include the jekyll-seo-tag
plugin now configured in _config.yml
when generating the static assets during the build process.
My blog is a fork of gh-pages-blog. jekyll-seo-tag
requires frontmatter to be added to two files, located in the _includes/head
directory. I simply added the following frontmatter expression in the <head>
tags of page.html
(which represents the parent blog) and post.html
(which represents any individual post):
{ % seo % }
NOTE I added spaces on either side of the Liquid expression (the braces and percent symbol) to avoid Jekyll from replacing it with the SEO data it generates during the build process of the blog. Check out more about static files from Jekyll.
After this change in the static files, I am now able to add an image
property to any post to specify a social card. Any post without a value for image
will use a default social card, which is also the card used for the parent blog. Posts are written in Markdown (GFM) and the property values are written in a comment header. An example below is how Jekyll knows what to call this post.
---
layout : post
title : Using the jekyll-seo-tag plugin
category : social
image : "/seo/2022-01-11.png"
---
I put all this together thanks to this very helpful blog post from Meagan Waller.
These pages are useful for testing meta tags: