Solution For Dokku App That Needs Restart


Hey,

I have been facing an issue with a Whatsapp bot I have running in Dokku (more on this in a next article!).

The node app got consistently stuck after every deploy. So I needed to restart the app manually after every deploy.

The app was actually starting, but the actual bot didn’t initialise correctly.

To restart the app I had to ssh into the Dokku server and run:

$ dokku ps:restart <app-name>

It has been months like that (in my defense I don’t do that many deploys there), until now!

A problem of concurrency.

I put myself to work on this and it suddenly struck me ⚡.

image_2023-05-27-11-46-25 Dokku by default keeps for 60 seconds the old container running.

I was always wondering what all those messages really meant. So reading the documentation I could make sense of all those messages.

Apparently the process is like this:

In my scenario, having two bots running (on the same shared session) at the same time was an issue. Issue found! 🎉

Easy Solution

Once identified the problem the easy solution was obvious: Disabling the zero downtime deploys feature.

How? Easy, with this command:

$ dokku checks:disable <app-name>

After this I haven’t faced the issue anymore! 🎉🎉🎉

⚠️ Depending on your situation this might not be an acceptable solution. In my case this is a bot for my personal use and having some seconds of downtime during release is something more than reasonable to me. Please, take into account that this will add downtime to your release process. Read the Zero Downtime Deploys documentation from Dokku and understand the consequences.

Did you find this interesting? Let me know with a big like below 👍.