Kafdrop: I can see you, Protobuf

  Kafdrop is a web UI built on top of Spring Boot. It's free and has a good dark theme. (Well, the dark theme is the only theme it provides, actually.) Speaking of kafka web UI, there is another web UI like the  Kafka UI  - which also has the capability of browsing message, but at the time I write this blog post Kafdrop is the only one that supports viewing protobuf message. Since I've been dealing a lot with kafka protobuf messages lately, I needed to know how to use Kafdrop with protobuf support. Because you know, it's such a pain in the eye viewing protobuf using kafkacat and protoc : kafkacat -b kafka:9092 -C -t -o beginning -e | protoc --decode_raw Luckily after few days of fooling around, I found that making kafdrop to work with protobuf is not a hard thing to do. The Kafdrop Readme says that I need to put the protobuf descriptor file ( .desc ) to a directory, and pass the directory path as a parameter to Kafdrop. Creating a descriptor file from a .prot

Using Value Object as an ActiveRecord Attribute

Two weeks ago, I was working on a simple task, to add a query param for embed url. This embed url is actually url of content page from the main service, which I also contribute to. So I am very familiar with its url's pattern and the way it works. While my task was just to add a query param, I found a that I had to add it to 2 different classes. The good engineer part of me believed that it is an unnecessary redundancy, and something, somewhere should get the touch of refactoring. Dived deeper i saw that the problem was in attempt to validate the url. These 2 classes uses almost similar but slightly different logic. One of them only needs to validate a livestreaming url, and the other needs to validate  both livestreaming and vod urls. In my first few attempts, I wrote a couple of validator classes, and I even tried to use ActiveSupport::Concern to wrap the validators. But something keep telling me, "Hey, this doesn't feel right, but that one doesn't either." &q

Setting up a Green Branch

Lately, I've been working on short chores. Most of them can be finished in an hour or less. To keep my productivity high, while waiting for the CI test for said chore, I would start another chore. At the time I finished the second chore and the first chore's tests were all green, I need to submit a merge request and wait for the approvals. That is another waiting time, which means that I can start the third chore while waiting for the second chore's tests to finish. Working with git means that every chore will start on its own branch. Usually, my workflow when starting a new branch was like this: Checked out the master branch, Pulled the latest commits from remote repository, Looked for the latest green tag (which is a commit in master that has passed the latest test), Copy that tag name, Check out the tag, And finally check out a new branch from that tag. Those are the 6 steps to do for just a chore. Imagine that for like 5 chores a day, I can have 30 steps to repeat eve

How to Upgrade PostgreSQL 10 Cluster to 12 in Ubuntu 20.04

W hen I upgraded my Ubuntu 18.04 to 20.04, the PostgreSQL package also got upgraded from version 10 to 12. The upgrade said in order to remove the v10 I have to migrate the clusters first. This is how I migrate the v10 cluster to v12 cluster. To begin with, Postgre has this pg_upgrade command. Here is the link to the documentation. The syntax is as follows: pg_upgrade -b oldbindir -B newbindir -d oldconfigdir -D newconfigdir [ option ...] It is in /usr/lib/postgresql/<version>/bin/ directory . But when I ran this command in my user context, I got Permission Denied. It also forbids running as sudo either. The only way that makes sense now is running this command in postgres user context. Please note that I use the --check flag below to avoid running the real migration. And don't forget to stop the postgresql service before. chris@focal : ~ $ sudo systemctl stop postgresql chris@focal : ~ $ sudo su - postgres postgres@focal : ~ $ /usr/lib/postgresql/12/bin/pg_upgra

Monkey Patching Vagrant LXC Issue in Ubuntu 20.04

Ubuntu 20.04 Focal Fossa was officially launched just a couple of weeks ago. And I thought it was the best time to say goodbye to my Ubuntu 18.04. Looking back then, I was so determined entering the world of Ubuntu 20.04. But little that I knew, I will be losing sleep figuring out why my vagrant lxcs won't "vagrant up".   It started with my attempt to upgrade the operating system. I opened up the Software Updater, but there was no upgrade offer anywhere in the prompt. I checked the settings in Software & Updates app. Looked into the "Updates" tab, the "Notify me of a new Ubuntu version:" option said: "For long term support version". Well, 20.04 is an LTS, isn't it. It should be there, but why it isn't? Changing the option to "For any new version", prompted me with 19.10 upgrade but no thanks, 19.10 is so yesterday.What have I missed? Googled it and I found that Software Updater won't give you the prompt, until the