Small API to manage packages

Posted on 2021-07-10 in Blog • Tagged with Rust, Clojure, Haskell

At last, here is my follow up to small TODO apps where I created a small CLI TODO app in Rust, Clojure and Haskell to test functional (or functional like) programming languages. Like I said in my previous article, I also wanted to see how these languages behave for the …

Continue reading

Manage deployment transitions for static application

Posted on 2021-04-25 in Trucs et astuces • Tagged with Docker, Kubernetes

When you deploy a frontend app, most of the time the name of your assets contains their hash so you can easily cache the files. So instead of just having main.js you will have something like main.1234.js. The problem is that your HTML will reference main.1234 …

Continue reading

Build a sequence that is reset everyday

Posted on 2021-04-08 in Programmation • Tagged with Django, Python, PostgreSQL

How to create a database sequence that will be reset everyday? That is a sequence that will get one the first time of each day? It sounds easy but it's not that much.


This article will focus on PostgreSQL since it's the database I use. A similar solution may …

Continue reading

Using DateTimeRangeField in Django

Posted on 2021-04-06 in Trucs et astuces

:tags:Django, Python, PostgreSQL :lang: en

The basics

If you need to store a datetime range in Django (for instance from which day to which day a listing is valid), instead of relying on two fields like valid_from and valid_to, you can use a single field validity_range of type DateRangeField …

Continue reading

Deploy a React app in kuberentes

Posted on 2021-04-01 in Trucs et astuces • Tagged with devops, k8s, kubernetes, Django, Python

I recently deployed a React app in kubernetes. It was initially deployed directly in a public bucket: I have an API that is already hosted on kubernetes, but the app itself is made only of static files, so it made sense. However, requirements for my app changed and I required …

Continue reading

Manage static files for Django when deployed on kubernetes

Posted on 2021-03-31 in Trucs et astuces • Tagged with devops, k8s, kubernetes, Django, Python

This will be a continuation of my article Some tips to deploy Django in kubernetes. In this previous article, I talked about generic tips you should apply to deploy Django into kuberentes. Here, I'll focus on static files.

If you don't already know that, gunicorn (or any other app server …

Continue reading

Some tips to deploy Django in kubernetes

Posted on 2021-03-29 in Trucs et astuces • Tagged with devops, k8s, kubernetes, Django, Python

I am not going to go into details in this article about how you can deploy Django in kubernetes. I am just going to highlight the main points you should pay attention to when deploying a Django app. I expect you to have prior knowledge about how to deploy an …

Continue reading

Enable basic authentication to all pages of a NextJS site

Posted on 2021-03-28 in Trucs et astuces • Tagged with devops

It's not as obvious at it seems. You can protect your API routes or some pages by following the documentation, but nothing to protect everything in one go with basic authentication (to protect your pre-production site from normal user for instance). Despite NexJS having a server component, I didn't find …

Continue reading

Extra kubectl configmap/secret to .env file

Posted on 2021-03-21 in Trucs et astuces • Tagged with devops, k8s, kubernetes

You can extract data from your kubernetes config maps into a .env file with the commands below (requires you to have jq installed):

# Get the data in JSON.
kubectl get configmap my-map --output json |
    # Extract the data section.
    jq '.data' |
    # Replace each "key": "value" pair with "key=value"
    jq -r …

Continue reading

Use a dedicated user to run your database migrations on PostgreSQL

Posted on 2021-03-10 in Blog • Tagged with Django, PostgreSQL

I'll detail here how to use one user to apply your migrations and one to run you site. This method can be applied to any framework and environment as long as your database is PostgreSQL. It's of course possible to do with other databases, but the SQL syntax to achieve …

Continue reading