Humbling moments

I have the ActuallyBot up and running again. It was down for a few months for two reasons: 1) it was crashing and I didn’t have time to fix it, and 2) I had the always-on ActuallyBot script running on my kid’s old laptop, and he wanted it back.

So I spent €100 on a little HP mini desktop, and that’s where the ActuallyBot lives now.

I made a few improvements based on things I’ve learned about deployment over the last few months. First, rather than using input() in my Python to manually input credentials for the Mastodon API instance after spinning up the Docker container, I just put the necessary secrets and tokens in an .env file and passed it to the container.1

Second, I know more about Docker, so I added a restart: unless-stopped setting to the docker-compose.yaml file. Now, even if my Python code hits a snag and the container stops, it will restart and continue to post out replies.

However, while I’ve learned quite a bit over the last six months, I’m still capable of doing very stupid things.

For example, I had a very frustrating ~3hrs on Friday trying to get the ActuallyBot to actually work. I kept tweaking the code, reloading the Docker image, and… same problem. Tweak the code again, reload the Docker image, etc.

It turns out, I was skipping the step of building the image, then saving it, then sending it to the remote machine, rebuilding/relaunching, etc. So I spent three hours deploying the same Docker image with the bad code and wondering why it didn’t work.

This actually turned out to be quite productive, for two reasons. First, the troubleshooting process of ruling everything else out first forced me to really understand all the settings of the Ollama container and how Ollama’s API endpoints work. I can now send queries to the Ollama server from anywhere on my LAN and get an LLM response. Neat! I might do something with this later.

Second, it was a painful but necessary lesson that any series of commands that you are running repeatedly and that has to be run in a certain order should be run as a bash script. It’s faster, easier, and you won’t miss any. This is probably DevOps 101, but it’s a lesson I had to learn personally, which is the whole reason I’m doing this nonsense. Humbling, but important!

  1. Yes, I know I should use Docker Secrets, and I plan to figure that out soon. This is for a machine that lives behind my home firewall and is not exposed to the public internet. ↩︎

2 responses to “Humbling moments”

  1. @pjk I run my bash scripts via Cron. The biggest hassle? Making sure the calls are made with valid (absolute) file paths.

    1. @peterrenshaw @pjk i am still pretty uncomfortable with file paths for that reason. always use absolute rather than relative even though it makes them unnecessarily long…

Leave a Reply

Your email address will not be published. Required fields are marked *