Holly's Briars

There are 2 entries to read containing the #homelab tag, with the newest being first. Have fun!


Click on a #tag to jump to that post category, or go here to visit the archive.


broot and Docker

  • 2023-08-25
  • 14:22

A while back, I found a neat little tool called broot which is a TUI file manager written in Rust. It claims to be a better way to navigate directories, and I find that claim to be quite the understatement.

When I had the data loss scenario, I copied everything that I could to a directory on the host drive. What I didn't do was copy everything to the data volumes, as I suspended my use of several services. I sort of left the directory intact and forgot about it until Pi-Hole started complaining about insufficient space for log files. On my desktop, I use Disk Usage Analyzer, however that is a GUI application. There is the du for terminal use, and that is just... No.

Since I had started to learn Rust, I figured I could write something. I searched for "rust sort directory by size" and my life changed forever when broot came across my radar. After poking around a bit, I found a launch argument and so...

broot --sort-by-size ~/recovery

...gave me everything I wanted. I went up and down the tree, pressing space bar to enter verb mode, and then rm to remove directories I had already copied. After a few minutes, I recovered over 450 GB of drive space.

I probably could have done that with ranger, but c'mon its 2023. It's haute-coture to use Rust for everything. What does that have to do with Docker you may ask? Well, I just mentioned a "verb". A verb is, aptly put, a command. broot lets me add custom verbs.

Since that server is only used as a Docker host, and I'm constantly messing around with the containers, I decided to do a bit of automation in regards to Docker and the containers. My frequent tasks are:

  • Updating containers
  • (Re)starting and stopping containers
  • Testing new containers

I came up with a few commands to speed up the process, so that I can browse up and down the tree in broot, not having to worry about entering directories, getting paths right, and all of that.

{
    name: Bring up Docker container
    invocation: compose
    execution: "docker compose -f {file} up -d"
    apply_to: file
    leave_broot: false
}
{
    name: Test Docker container
    invocation: test
    execution: "docker compose -f {file} up"
    apply_to: file
    leave_broot: false
}
{
    name: Start Docker container
    invocation: start
    execution: "docker compose -f {file} start"
    apply_to: file
    leave_broot: false
}
{
    name: Stop Docker container
    invocation: stop
    execution: "docker compose -f {file} stop"
    apply_to: file
    leave_broot: false
}
{
    name: Restart Docker container
    invocation: restart
    execution: "docker compose -f {file} restart"
    apply_to: file
    leave_broot: false
}

You will notice that a verb for docker compose -f {file} down is not present, nor is there a verb to update the container images. I simply don't trust myself. I prefer to remove the containers, volumes, images, and networks manually, with their respective commands. As for the updating containers? if you use :latest, FOR SHAME.


Whoops

  • 2023-03-24
  • 21:38

It's been... a while, hasn't it? I didn't die or anything. I've been pretty busy with the move and not really being able to catch my breath and put down my feelings. On one hand, I feel a lot better mentally now that we're starting to get settled in and I'm not being viciously attacked by one pile of mess after another from the very moment I step foot into my home... On the other, I haven't had a chance to truly relax, you know? Like, at the moment I'm sitting in my little computer corner with a box of stuff that needs to be put away and my LED curtain on the floor for some sort of ambient light.

Back to the mental health thing. Things haven't exactly been going to plan as of late, and I've kind of sort of gone with the flow without too much trouble, and that is a feat. I forgot my keyboard, so I'm using a terrible Logitech membrane, the LAN server decided to give me the middle finger (more on that later), I forgot one of my monitor power supplies, and also forgot the power cable to the server, it was a bunch of bumps. That sentence went on for a long time. Whatever. You figure it out.

SOOOOooo... The LAN server kind of bit the dust thanks to NVIDIA fucking up their Linux drivers again. To make a long story short, the kernel was unsupported, I couldn't even upgrade the kernel without uninstalling NVIDIA, and all of that resulted in a server not being able to boot. I decided it was time to grow up and stop using Arch based distros for a server. Back to good ol' Debian that hasn't fucked me in any way other than having a docker-compose package that couldn't do compose v3 files. I liked Manjaro, and daily drive Garuda on my desktop, but JFC having to stay on top of updates like it is my religion is extremely tedious.

It's taken me about a week to get the server back up and running again, and I couldn't have done it without Storj DCS. I wrote a little bit about my server backup system in this post and I'm happy to say that in spite of some hiccups, the restore was largely successful. I identified some flaws in my backup system, and will be fixing them going forward. I'll be talking about those in this post.

One of the major flaws was that I needed to use Duplicati to restore the server configs because I used Duplicati to backup the server configs. Stack overflow yet? It was a bit of an annoyance to download the config archives manually from the bucket using a web browser, and then use a temporary Duplicati instance to extract the backup. From there I was able to restore They're now hosted on a private GitLab repo. It isn't ideal, but it is the best solution I have at the moment. If I had a job, I'd be paying for a VPS. A VPS also wouldn't have gone to sleep in the middle of the restore process. I had to do the whole thing twice to make sure I got everything.

Another one of the major flaws was that Duplicati did not save dotfiles. I was unable to bring back the Minecraft server and the File Browser instance. I kept the Minecraft world files, and may be able to repair them by opening them in single player. I will have to test that theory. As for the File Browser instance, I replaced it with Pure-ftpd which allowed me to mount individual data directories so that I can upload directly rather than upload to File Browser, and then copy the files from within via SSH.

...I'm aware I have a lot of manual stuff going on here. I really don't care. I'm very particular about how I do things, and this is how I'm doing it, so theeeeere. Mwah.

The good news is, my data directories and my host OS are on completely separate drives, so any OS issues going forward will not affect me in any way.

In the non-tech sphere, I've been playing a lot of bit of Disney Dreamlight Valley and just absolutely love it. I love it so much that I've commissioned a profile picture from my dear friend Maru that just... looks like me and I'm in freaking love with it and can't wait to use it on every platform that I'm actually active on.

Anyway, I'm going to cut this short and this sentence serves as a note to myself to continue the post in the morning. 💖