December 02, 2022 (2) - Encoding secrets for Kubernetes

Kubernetes uses base64 encoded secrets, but it’s important to make sure that when encoding the secrets, you don’t include any extra newlines - tldr; use echo -n instead of echo # Works > echo -n "my secret" | base64 bXkgc2VjcmV0 # Doesn't work > echo "my secret" | base64 bXkgc2VjcmV0Cg== Otherwise, you could be in for a world of pain :)

December 2, 2022 · 1 min · 61 words

December 02, 2022 - How to use python-dotenv to easily manage env vars

So, I had a project recently where I have a bunch of API keys, but I didn’t want to accidentally commit them to a repo (since that would be bad…). But I also wanted the convencience of just in-lining the code, and not have to worry about sourcing environment variables every time I ran the code (since this would inevitably cause annoyances). To solve this, I found a handy tool - python-dotenv, a package which handles all of the complicated bits....

December 2, 2022 · 1 min · 152 words

November 29, 2022 - PyPI Doesn't Allow Git Repo Dependencies

So, we have a package, VDTK which we’re planning to release in a new major version - there’s only one problem… We depend on several packages which do not publish builds to the PyPi repository. In our pyproject.toml file, they are specified as: dependencies = [ "...", "clip @ git+https://github.com/openai/CLIP.git", "mauve-text @ git+https://github.com/krishnap25/mauve.git", "en_core_web_lg @ https://github.com/explosion/spacy-models/releases/download/en_core_web_lg-3.4.1/en_core_web_lg-3.4.1-py3-none-any.whl", ] Unfortunately, when you upload a package built with dependencies like this, you get the error:...

November 29, 2022 · 2 min · 360 words

November 18, 2022 - Creating the perfect archetype in Hugo

This TIL site is powered by Hugo, but it’s currently a lot of effort to create the title and name for one of these posts… It would be great if we could have a single command line tool which does this! Each post right now has the following header: title: 'November 18, 2022 - Creating the perfect archetype in Hugo' date: 2022-11-18T16:17:02-08:00 showToc: true TocOpen: false draft: false hidemeta: false comments: false disableShare: false disableHLJS: false hideSummary: false searchHidden: true ShowReadingTime: true ShowBreadCrumbs: true ShowPostNavLinks: true ShowWordCount: true ShowRssButtonInSectionTermList: true UseHugoToc: true Most of this information is super easy to deal with - everything after showToc is static, so our template can just write those directly....

November 18, 2022 · 2 min · 404 words

November 17, 2022 - Running Single-Server MySQL on Kubernetes

Getting anything running on Kubernetes is a bit of a challenge, but today I was working on deploying MySQL so I could migrate my Ghost blog from v4.x to v5.x. This means creating a mysql instance, a user (for ghost) and any other data that we need to run the deployment. The first thing that we need to do is add a secret which will define the root user password and the password for ghost user:...

November 17, 2022 · 2 min · 395 words