Per-jail Package Repository Selection

I run several applications in my homelab using FreeBSD jails. This provides an extra measure of isolation, since the services are connected to the internet. I use AppJail to keep the setup declarative and introduce a reasonable measure of reproducibility. It's not NixOS, but it's good enough for me. This short post is because I hit an interesting split between 2 jailed services' needs.

One application (continuwuity) is not yet in the ports tree, but there are great packages available from the community. The package, which isn't part of the ports CI, needs to make a decision about a library it depends on. They chose the quarterly ports tree for simplicity (this is the default on new FreeBSD installations).

Another package I use (marmite) is the static site generator I use for this blog. That is in the ports tree, but I want to always use the bleeding edge release. Most recently because I submitted a patch switching to Arborium for build-time syntax highlighting. I could build it from source, but that means I'd need to take a few minutes to rebuild the jail from scratch. Using packages takes a few seconds.

AppJail releases will use Quarterly by default. The default AppJail release process uses a standard base system, and thus points at the quarterly branch. Changing any specific jail to use the latest is pretty easy! You can basically copy from handbook.

# Use the latest ports branch to get updates faster
CMD mkdir -p /usr/local/etc/pkg/repos
CMD echo 'FreeBSD-ports: { url: "pkg+https://pkg.FreeBSD.org/${ABI}/latest" }' > /usr/local/etc/pkg/repos/FreeBSD.conf

# Update package database
PKG --update

You can put this directly in your Makejail file, or extract it into a separate include file for reusability. And that's it; just make sure this comes before your first PKG instruction. Now any future PKG instructions will use the bleeding edge.

Posts from blogs I follow

Why fsyncing a File Isn't Safe Enough

Recently I learnt something interesting about writing files to disk. Something that connects my first ever low-level database PR with the reason you can’t pull a USB disk out of your laptop without ejecting it first. As you may know, when y...

via Kris Jenkins' Blog

Four levels of in-place initialization

IntroductionThe goal of in-place initialization is to enable the construction of types directly into a memory location without any additional moves or copies. When working with big types this can be more efficient and even prevent stack ove...

via Yosh Wuyts — Blog

Generated by openring-rs from my blogroll.