Dodo's personal blog

A very engineering christmas


A Christmas side story - coding on a Raspberry Pi 4

Take an engineer, a Christmas week at my parents, and a missing MacBook charger for a short Christmas story with a happy end.

Hardship makes the devil creative, they say. During the Christmas holidays, I visit my parents together with my dogs. This time it was special. Not only was it the first Christmas for our new dog Nacho but I almost wasn’t able to code for an entire week, due to me forgetting my MacBook charger. The expression on my face must have been priceless. Me not coding for a whole week, that’s unheard of.

Visiting my parent include lots of playtime with the dogs in the garden, talking with family, drinking coffee, reading books, and doing tons of coding. Not this time around. There was no computer in sight except my Raspberry Pi 4. I’ve allocated the time to other activities, training and playing in the snow together with Nacho and Mochi. They enjoy all the extra training and attention, but there comes a time where even a corgi requires its nap. Both girls sleeping on their pillows, I brew myself another cup of coffee and sigh at the thought of not being able to drink it while coding. What to do now? Let’s grab the old “Gang of Four” and read while lying in bed. After an hour or two I was too fatigued to read further. There was still the Raspberry Pi 4 on my desk. Positioned next to my MacBook.

Imgur

I code with nvim using the coc-nvim plugin to run language servers for IntelliSense and tmux for terminal management. I was sure that the Pi 4 would be capable of installing and running both without any issues. My workflow for RewoHub requires running a Kubernetes cluster with seven pods and ingress for local development. That would certainly be way too much for a tiny Raspberry Pi 4 with 4 GB of RAM. Or would it? I don’t even have a monitor available. My parent’s TV has an HDMI input also I have a micro-HDMI cable available but not a suitable power source. I brought my Switch with me. The charger could work. The Raspberry Pi 4 uses an ARMv7 Architecture. Are any of my dependencies x86 only? Hmm, only one way to find out. TV + Switch charger + Pi 4 plus a few moments later, I’m booted into Raspien.

Installing node, nvim + coc-nvim, tmux was a walk in the park. I store all my configs in a git repository so I was up and running in under 5 minutes there. Minikube wasn’t too though either. Even docker had an ARM version available, nice! Next step creating a new ssh token and cloning the repository, done. Starting Minikube and creating a cluster took around 8 minutes to initialize. Not a good sign. Installing ingress was a pain but I got it running. RewoHub uses a fully asynchronous Micro Service architecture, so I prebuild all docker containers. That took me over 20 minutes. Now the big moment, starting the cluster. Errors during every micro-service startup, damn. Checking the logs I’ve found that ARMv7 isn’t supported by the newest MongoDB version 5.x.x. Am I using any 5.x.x related features? Hmm, let’s try to downgrade to the latest 4.x.x. Let’s deploy again. Waiting.. waiting.. waiting.. wait could it be?

Imgur

Oh my, I even can open the local website and test the client. That is amazing. Sure it doesn’t have the performance of a new MacBook but I could work. Even TDD style using Jest’s filter option. With one exception, after 45 minutes the CPU got so hot, that it simply froze up. Not a big deal for me since I usually work in 25-minute intervals. The next day I’ve found a cylinder-shaped pencil sharpener made out of metal. Could that work as a heat sink? Scraping off the bottom price sticker and cleaning the bottom with alcohole, I placed it on top of the CPU. No more freezes and a constant performance boost! I adore the construction.

Imgur

Doesn’t it look nice? Yes, that’s some CBD on top of it to hold it down better. Are you not in awe of this hacky solution? I sure am and I had a blast coding this way. How says that Christmas miracles only happen in movies?

Thank you so much for reading. If you are interested in what RewoHub is and its progress you can find more about it on my profile. Bonus Image of Nacho in her Igloo.

Imgur