April 25 2023
Tue 25 April 2023
Further adventures in pretending homelab is real work!
This week, I've actually been hacking on getting restic running semi-regularly. It turns out (or at least, I've found by experimentation) that the way nomad does scheduled/periodic jobs means that the periodic jobs don't have access to variables the core job does. I may be doing something wrong, but I also wanted to write come code, so there's a hacky threaded restic job runner over here that I still have to tidy up and document a bit.
My main thing I'm working on is replacing consul. I don't have any need for its more advanced nonsense, and all I was using it for was finding jobs. It has a DNS port it listens on that you can point named at (and I do, here). It can be a bit flakey, for reasons I'm not sure about (and that are proably my fault).
So, I've decided to implement just that fuctionality myself, and rip consul out of the homelab. I'm not quite done yet, but I think nothing is talking to consul at this point. This change and some prometheus changes probably did most of it.
The code is at nomad-dns-exporter and, while terrifying, is still solid enough to run my lab on. It's also got some very basic prometheus metrics to scrape (I cannot prometheus my way out of a wet paper bag at this point, but we'll get there).
If you want to follow along at home, try:
virtualenv .venv source .venv/bin/activate pip3 install -r requirements.txt python3 nomad-dns-exporter.py --nomad_server=ip.of.any.nomad.server
Then test with
dig myjob.job.nomad @localhost -p5333 - I shoould probably do smarter things with SRV records or something, but that's it for now. Next up is to grit my teeth and turn down consul to see what happens.