-
Django DB Migration Job with ArgoCD
A Job in Kubernetes is a one-off and immutable task to be carried out during deployment. But what if a job needs to run for each deployment? A new job with the same name can’t be deployed on top of the existing one, given it in completed or failed state. Since Kubernetes 1.23, A TTL(Time…
-
Caching in Python with Redis + @Decorator
TL;DR: Here’s a simple Python decorator I wrote which can cache function results with Redis. Prerequisites The Python Decorator What’s a decorator in Python? Here’s a very easy-to-understand explanation just for the question. Below is my code of the decorator with notes: Done 🙂
-
How to Query in MongoDB and Group by Date
TL;DR: Here’s a quick example to query MongoDB documents created this year(2023) and group them by date, ie. how many my_doc were created today, yesterday, the day before yesterday, etc. The following statement works in a MongoDB client such as mongosh. Then here’s an equivalent example to do it with MongoEngine in Python: Since I…
-
New Recipes Learned!
Some after thoughts: 🙂
-
Cloud SQL MySQL: Best Password is No Password
Security for web applications has come a long way. In the case of database passwords, there is a lot of approaches to keep them safe: But isn’t it the best if there’s no need for a password at all? With IAM authentication for Cloud SQL, the password can be avoided after all. Here’s how to…
-
How to Self-Host a Mastodon Instance in Kubernetes
TL;DR: Instead of the official installation including setting up Ruby, nginx, systemd service, etc., I found it more comfortable to install and run a Mastodon instance using some YAML files. Just in case, what is Mastodon anyway? I used kustomize to manage and generate Kubernetes manifests for a fully functional Mastodon instance. Please see my…