diff options
| author | Kleidi Bujari <mail@4kb.net> | 2025-09-12 20:57:59 -0700 |
|---|---|---|
| committer | Kleidi Bujari <mail@4kb.net> | 2025-09-12 21:00:27 -0700 |
| commit | fe96211bb8dc81fde57bf6900b840e69f2b218fc (patch) | |
| tree | ff1c63e7962c6373199b94b8fd236b15e3441244 /packages/web/site/content | |
| parent | ab58c69b6db2902688841a4008221f72bbbb8692 (diff) | |
| download | depot-fe96211bb8dc81fde57bf6900b840e69f2b218fc.tar.gz depot-fe96211bb8dc81fde57bf6900b840e69f2b218fc.tar.bz2 depot-fe96211bb8dc81fde57bf6900b840e69f2b218fc.zip | |
move packages to overlay and expose certain packages
Diffstat (limited to 'packages/web/site/content')
| -rw-r--r-- | packages/web/site/content/about/index.md | 38 | ||||
| -rw-r--r-- | packages/web/site/content/paper-reviews/_index.md | 7 | ||||
| -rw-r--r-- | packages/web/site/content/posts/_index.md | 7 | ||||
| -rw-r--r-- | packages/web/site/content/posts/deterministic-hostnames.md | 80 | ||||
| -rw-r--r-- | packages/web/site/content/posts/nohup.md | 26 | ||||
| -rw-r--r-- | packages/web/site/content/posts/overusing-emacs-modes.md | 39 | ||||
| -rw-r--r-- | packages/web/site/content/posts/stateless-compute-networks.md | 41 | ||||
| -rw-r--r-- | packages/web/site/content/posts/vim-compilers.md | 20 |
8 files changed, 258 insertions, 0 deletions
diff --git a/packages/web/site/content/about/index.md b/packages/web/site/content/about/index.md new file mode 100644 index 0000000..65c4556 --- /dev/null +++ b/packages/web/site/content/about/index.md @@ -0,0 +1,38 @@ +--- +title: "" +--- + +I'm a programmer working on Linux stuff, +distributed systems, +and compilers/runtimes. + +## Uses + +I run NixOS on all my computers and servers, +and prefer to use simple unixy workflows. + +### Editors + +I use Emacs as my text editor, +although its slowly taking over my workflow as I grow proficient. +Rather than use a premade distribution, +I decided early on to go vanilla and build a config myself. +Part of the reasoning was to get a better understanding of the core emacs philosophy before adding plugins, +the other part being that I didn't know what most plugins even did. + +In the past I enjoyed using neovim but left to try out the emacs hype. +I didn't think they were too different until I tried using neovim again after ~6 months, +and immediately missed all the functionality from emacs, +maybe I'll elaborate in a post one day. +Sure, neovim is a lot more minimal as an editor, +but emacs aims to be a computing platorm with a text editor bolted on. +They are ultimately trying to do different things, +and lisp is just better than lua. + +I've played around with Helix and Kakoune but haven't dedicated serious time yet. + +## Meta + +This site is built mostly using [zola](http://getzola.org), +with other projects built with nix sprinkled in afterwards. +The entire site is then generated as a nix derivation and served from there. diff --git a/packages/web/site/content/paper-reviews/_index.md b/packages/web/site/content/paper-reviews/_index.md new file mode 100644 index 0000000..33c9820 --- /dev/null +++ b/packages/web/site/content/paper-reviews/_index.md @@ -0,0 +1,7 @@ ++++ +title = "Paper Reviews" +sort_by = "date" +generate_feeds = true ++++ + +Once in a while I take some notes.
\ No newline at end of file diff --git a/packages/web/site/content/posts/_index.md b/packages/web/site/content/posts/_index.md new file mode 100644 index 0000000..c7c63df --- /dev/null +++ b/packages/web/site/content/posts/_index.md @@ -0,0 +1,7 @@ ++++ +title = "Posts" +sort_by = "date" +generate_feeds = true ++++ + +Writings and musings.
\ No newline at end of file diff --git a/packages/web/site/content/posts/deterministic-hostnames.md b/packages/web/site/content/posts/deterministic-hostnames.md new file mode 100644 index 0000000..43dc7d8 --- /dev/null +++ b/packages/web/site/content/posts/deterministic-hostnames.md @@ -0,0 +1,80 @@ +--- +title: "Deterministic and unique network hostnames" +date: "2024-11-10" +--- + +As part of building out a Kubernetes cluster, I wanted to build and distribute a +single OS image to create stateless worker nodes. Using network booting, and +some clever tricks to differentiate nodes, we can create a scaleable and +efficient farm of workers for a cluster that don't even need disks. + +The idea came from a plan to build a cluster using the +[compute blade](https://computeblade.com/), and a few Raspberry Pi SBCs I +already own. Running the cluster from an SD card is not recommended due to the +not-so-great reliability of the flash used by most manufacturers, so I wanted to +try PXE booting each Pi to save money rather than purchasing an SSD for each +one. The compute blades do support an NVMe disk, but I plan to use those for a +storage cluster later, so they need to remain empty. + +## Base image + +Alpine Linux has been my preferred server OS for a long time. It provides a very +lightweight base system, and bundles an excellent bootstrapping system, +[apkovl](https://wiki.alpinelinux.org/wiki/Alpine_local_backup), that allows the +user to save a set of customisations to an system as an overlay to a stock +Alpine live image. In other words, we can create our image once, save the +changes as an `apkovl.tar.gz` file, and apply the same changes to a base system +on boot. This file can even be provided as a +[kernel parameter](https://wiki.alpinelinux.org/wiki/PXE_boot#Guide_to_options) +and will be fetched from a remote webserver automatically! + +Since the image and configuration will be shipped to the node via the network, +an added benefit of using Alpine is its tiny space consumption. I'm not using +enough nodes for this to really matter, but it's a cool optimization regardless. + +## Differentiating the nodes + +One of the main goals of this project is that there should be no persistent +storage required outside the boot image itself. Since every node will download +and generate the same root file-system on startup, the first problem that arises +is how the nodes will identify themselves both on the network and the cluster, +given that it's not possible to name them ahead of time. In other words, any +given node has to generate a unique hostname that won't collide with other +workers, and that will be the same each time that node boots. + +Since these nodes will not have a predefined name, we have to rely on +characteristics of the hardware to differentiate each one. The hardware MAC +address is perfect for this, since it's unique to to each node and will not be +wiped away after the node reboots. On a system like Linux that exposes its +hardware through a _sysfs_, we can find a file containing the address at +`/sys/class/net/eth0/address`. I don't really like the idea of attaching the +literal MAC address of the node to its network hostname, since it's a security +risk, and a bit too verbose. Instead, we can transform it into something safer +using a `sha1sum`, which is already present on our Alpine base system: + +```console +sha1sum /sys/class/net/eth0/address | head -c 6 | awk '{print "worker-" $0}' +``` + +### Applying the new name + +Ideally, the node should apply its generated hostname before reaching out for an +address over DHCP or joining the cluster. We can make sure it happens before any +traffic is sent out by adding a `pre-up` command to the right interface in +`/etc/network/interfaces`: + +``` + +... + +auto eth0 +iface eth0 inet dhcp + pre-up sha1sum /sys/class/net/eth0/address | head -c 6 | awk '{print "worker-" $0}' > /etc/hostname + +... +``` + +The VM I tested with looks outputs `worker-e2fae8`. Pretty clean result, and if +you want to know the physical node that maps to each hostname, you can take note +of the MAC address beforehand and generate the same hash on another computer to +match them up. diff --git a/packages/web/site/content/posts/nohup.md b/packages/web/site/content/posts/nohup.md new file mode 100644 index 0000000..64f7983 --- /dev/null +++ b/packages/web/site/content/posts/nohup.md @@ -0,0 +1,26 @@ +--- +title: "Spawning background processes" +date: "2024-11-17" +--- + +Working in a terminal, +I often pair my editor with a background process watching files. +Before reaching for terminal multiplexers, +see if you can get away with simple tty job control. +Spawn the background process, +still attached to the terminal instance: + +``` +program args & +``` + +Also redirect its output to a file, +for when the process writes to the tty from the background: + +``` +nohup program args & +``` + +Extra reading: + +- <https://jvns.ca/blog/2024/07/03/reasons-to-use-job-control/> diff --git a/packages/web/site/content/posts/overusing-emacs-modes.md b/packages/web/site/content/posts/overusing-emacs-modes.md new file mode 100644 index 0000000..1ea1654 --- /dev/null +++ b/packages/web/site/content/posts/overusing-emacs-modes.md @@ -0,0 +1,39 @@ +--- +title: On editors and plugins +date: 2025-08-14 +draft: true +--- + +The healthy package ecosystems that extensible editors have is a standout feature. + +After setting up my first neovim package manager, +I never hesitated testdriving cool plugins from the community. +I installed a terminal plugin that without really having problems with `:term`, +or using a file manager without ever trying `:netrw`. +After a while, I found neovim overloaded with more features than I understood, +and frequently hit problems that encouraged yet another plugin to fix. +The issue wasn't that I had too many plugins per se, +it was that I didn't really understand what they did. +I promptly declared config bankruptcy. + +Going forward I strictly used plugins that were worth their weight. +That is, how they affect performance as well as any cognitive slowdown. +I quickly found that when a plugin strays too far from core neovim, +like not hooking into builtin functionality or not reusing normal keybinds, +it wouldn't make the cut. +It is simply not worth learning if it doesn't enrich the editor as a whole. + +Using this philosophy for a few years, +the only external plugins that survived were +LSP completion, a proper code formatter, and fzf for search. +Some plugins ended up in core neovim, +like language aware commenting and better compile commands. +Most were deleted. + +This meant my editor was really good at editing text and code projects, +and not much more. +It was fine that it didn't have a UI for viewing GitHub stars or whatever. +I could live without + +## Enter emacs +Modes reshape emacs to better fit certain work. diff --git a/packages/web/site/content/posts/stateless-compute-networks.md b/packages/web/site/content/posts/stateless-compute-networks.md new file mode 100644 index 0000000..bac9e5d --- /dev/null +++ b/packages/web/site/content/posts/stateless-compute-networks.md @@ -0,0 +1,41 @@ +--- +title: "On stateless compute networks" +date: "2024-11-10" +draft: true +--- + +On the topic of distributed systems and clustering, +I am quite invested in the idea of compute nodes that rely entirely on the network for configuration. +Arbitrary nodes can join a pre-existing cluster, +offering their CPU time and memory for computation without relying on any pre-existing configuration on the node itself. +In other words, any computer could pick up work, +only needing power and a network connection to the cluster. + +Perhaps this eventually leads into a "self-healing" cluster where only one node is manually bootstrapped, +which then serves a _configuration endpoint_ for other stateless nodes to reach out to for their instructions, +which they will then also serve once they are themselves ready. + +Early revisions of these notes mention Kubernetes, +but I am also trying to achieve similar results with NixOS on a custom project. +In any case, these are my ever-updating notes towards a general implementation of a stateless distributed systems architecture. + +## Self healing cluster + +Assuming control of an external DHCP server, +a self healing Kubernetes cluster would be feasible, +with the PXE boot artifacts supplied by the cluster itself. +That is, as long as one node is running the pod hosting the artifacts on a given endpoint, +other nodes can boot those artifacts and join the cluster, +thereby being able to host the artifacts as well. + +## Configuration endpoint + +The nodes shouldn't require a disk installed to be able to join the network. +Rather, the lofty goal of zero-configuration compute nodes passes the job of node initialization to the supporting network. +This is accomplished with PXE boot instructions supplied over DHCP. + +I delegate the following tasks to a single node in the subnet: + +- Gateway: Optional outbound connections if required +- DHCP server: Cluster IPAM +- TFTP and HTTP server: Serves iPXE firmware and kernel/initrd artifacts diff --git a/packages/web/site/content/posts/vim-compilers.md b/packages/web/site/content/posts/vim-compilers.md new file mode 100644 index 0000000..f735228 --- /dev/null +++ b/packages/web/site/content/posts/vim-compilers.md @@ -0,0 +1,20 @@ +--- +title: "Neovim's built-in compilers" +date: "2025-01-17" +--- + +Today I learned that neovim's `:make` comes with many +[backends](https://neovim.io/doc/user/quickfix.html#_6.-selecting-a-compiler) +already configured. +This works for checking c/cpp and python files, among other, but I was +most interested to see [Typst] and [Pandoc] listed as well. + +I was looking to add this functionality with a plugin or implementing it +manually, +where a document can be compiled on the fly from the editor. +After setting `:compiler pandoc`, +generating a pdf is done with `:make pdf`, +with other pandoc options just appended afterwards if needed. + +[typst]: https://typst.app +[pandoc]: https://github.com/jgm/pandoc |
