Load balancer 101, thou shalt not be alone

Scaling, the dreaded word among developers, because this means more complexity. But why do we need scaling? Imagine a super busy corner store. During early mornings, there might not be a lot of customers, so one cashier might be enough to handle all customers. But during afternoons or evenings, more customers would flock to the store, and our only cashier couldn’t checkout fast enough, and this means losing potential customers....

December 10, 2022 · 2 min · Karn Wong

Cross-platform package (+env) management with Nix

For many years, installing a package on linux means either: Compiling a binary from source, then install it. -> I think we know why this didn’t catch on for the mass. Downloading a compiled binary for your system’s architecture and platform. -> This requires you to also move the executable to something like /usr/local/bin otherwise it won’t be discoverable throughout the system. Using system’s package manager: apt, apk, yum, brew, etc....

December 3, 2022 · 4 min · Karn Wong

Load credentials into your shell via Bitwarden CLI - Fish edition

Recently I work with GitHub CLI a lot, and having to constantly fire up Bitwarden app to retrieve GITHUB_TOKEN gets old real fast… I was thinking of storing it in a gist in a password manager, luckily someone had the same idea and implemented it. The only issue is that I use fish shell. But we live in a world where there are many ways to interact with the shell, so it follows that you can translate zsh syntax to fish syntax....

November 29, 2022 · 1 min · Karn Wong

Cloudflare DNS management with Terraform

I self hosted a lot of services, sometimes I try out a few apps that would get deleted within the same day. All this requires setting up CNAME for reverse-proxy (because I want to make sure there’s no funny reverse-proxy shenanigans going on, for future reference). I can always log into Cloudflare console and manually add CNAME entries, but this is getting too tiresome since all I really need is another CNAME with the same config as the rest of the CNAMEs - pointing to the same DNS for my homelab....

November 20, 2022 · 1 min · Karn Wong

Deploy more efficiently with templating

You are building a website, it’s a simple frontend that needs to call the database for [total lead drops this week]. Your website is still at an infancy stage, with only a few features. At this point, you contemplate whether you need a proper backend or not. But to deploy a backend properly, it would involve docker, backend database, persistence storage, DNS, load balancer, among other things. But it looks like you don’t have enough time, so you decide to go with serverless, since it takes less time to implement and you don’t have to worry about scaling....

November 5, 2022 · 3 min · Karn Wong