#Ruby #GoLang #DevOps #Kubernetes

Photo by Michal Balog on Unsplash

After deleting my #Twitter account for good earlier this week, I have decided to move my personal website to a new host, in order to be able to use the #ActivityPub-compatible #WriteFreely app.

I decided to go for the self-hosted setup – just because I can. And because I had a useless VPS waiting to be used at Hetzner Cloud.

Setup was fairly simple. I just had to follow the instuctions given on the WriteFreely website, and I imported all my Jekyll markdown files.

The longest step was re-formatting broken lines and dealing with images. There seems to be no image uploading system for now, so I had to scp them to the server and rewrite the correct url. Good thing I only had a few.

The typing interface is very minimal and all this seems quite nice to use for now.

So, you can subscribe to my posts by following Mo[email protected] on any ActivityPub-compatible network.

Let's see how my website runs on this new federated blogging system !

My developer Mastodon profile on My personal Mastodon profile, more generic French / English stuff

Photo by Michael Dziedzic on Unsplash

Learn to hate, then love error messages.

Stack Overflow overflow

I have lost so much time on Stack Overflow. 

I mean Stack Overflow is great, and software development knowledge would not be so advanced and so widespread without its great influence. What I mean is that I have often found myself repeating the endless pattern of 'Hey, I have an error... Wow, so many words… Let's google this. Stack Overflow has it! Let's see what they say'

I am not talking about the infamous Stack Overflow copy-paste syndrome, nor am I dismissing the great answers produced by the great developers out ther, but rather about the missing step in the example above: making sense of the error message myself before actually looking for a ready-made answer.


Photo by Debby Hudson on Unsplash

We all write bad code. Let's face it. Even if we do our best at writing the most efficient and well-designed code, we all happen to write this dirty method we don't feel so proud of and dread having to debug next month, or next year.

I'm not going to talk about that code, because it's so easy to spot and there is no need to write blog posts about it. What I'm interested in is code which looks fine when you have finished typing, but will bite you in the back someday. It ends up being hard to maintain, extend or even understand. After years of coding, I have come up with a set of warnings that alert me whenever I am heading for a dead end.


/assets/moving-house.jpg Photo by Markus Spiske on Unsplash

Part of the mission I was given when I arrived at my now workplace was the complete migration of our rails hosting from a Heroku service to a kubernetes solution. This was my first experience migrating a production stack, and my first experience with kubernetes as well. And just in case you'd think the task wasn't daunting enough, the previous sole developper decided to leave for another opportunity a few weeks after my arrival. This departure was soon forgotten with the company hiring another developper who had already transitioned an app to kubernetes. So I took a course on udemy, read the kubernetes documentation thouroughly, took notes, and played around with a toy cluster. Then I set out on the transition journey.

Six months later, the Heroku-Kubernetes transition is now over. I have gained a lot of experience. And I feel it's time to share it.


Callback hell

I was playing with dynamic nested forms with Stimulus today and I stumbled upon a void left by Rails' ActiveRecord callbacks.

I have this Caregiver model within a nested form and I need to create it along with a User entity in my form, to be able to populate the fields. The problem is that creating an after_initialize callback (even with :new_record? will break the general behaviour of my app, and I don't want to run through all the specs and fix FactoryBot issues etc.

So I just decided to create a small method in my Caregiver model:

# caregiver.rb

def init_with_user

Then I just need to call it in my view like this:

<%= f.fields_for :caregivers,, child_index: 'TEMPLATE_RECORD' do |cf| %>
  <%= render 'caregiver_fields', cf: cf %>
<% end %>

This makes the code in my view simpler, more explicit, while avoiding the dreaded callback hell.

My developer Mastodon profile on My personal Mastodon profile, more generic French / English stuff

Regexp hell

I recently had to make a semi-complex check on a string to validate it.

Basically, I have this model method which produces a serial number based on the ID of the object. Valid returned values for this method are L00000002, L00000587 or L00014522. In short, they should be constituted of a capital L followed by 8 digits composed of the id of the object padded with zeros.

So I had to find a way to simply created a matcher for this to use in my model spec. I could have built two expectations, one for the length, and one for the composition. But I just decided to believe that regular expressions are powerful enough to do both at the same time. So I headed to rubular and started fiddling and googling around.


Le pas de foi Comme j'en parlais dans un article précedent, je me suis engagé dans une démarche de reconversion professionnelle.

Après deux tentatives infructueuses, je me retrouve désormais embauché comme développeur fullstack dans une boite très sympa de la région de Poitiers. La demande de dispo a été envoyée hier, les collègues sont désormais tous au courant, et je me retrouve face à un nouveau défi sous forme de nouveau départ. Et c'est une situation très déstablisante – pour le moment.

Lire la suite...

Image par Free-Photos de Pixabay

Deuxième épisode des liens du jeudi. Au menu, on Dockerise rails, on covoiture et on rationalise.

Lire la suite...

Image par Antonios Ntoumas de Pixabay

I am about to release a huge rails project I have been working on for quite a while. This project is meant to replace an old app that manages a database of customers with emails. The new rails project uses Devise for authentication.

Before we push the final update to the production server, we need to find a way to import the users without sending confirmation emails, but still keep them unconfirmed until they actually login to the new system and provide a password. New registrations should also still be confirmable.


Je poste régulièrement mes trouvailles sur le net... Voici le premier épisode. Enjoy !

Lire la suite...