Pre-deploy jobs

Dear Koyeb team,

Apparently it’s not possible to execute a single task before deploying a new version of a service. A common use-case of this pre-deploy task is to execute database schema migrations. Do you confirm that this feature is not implemented? In that case would you have a recommendation or a trick to share in order to support such need?


Hi @Simon_Brandhof,

We have a feature request for this. You can vote for it and track its progress there!

In the meantime, you can achieve more or less the same result crafting an ad hoc docker ENTRYPOINT that runs a task before launching the application. Of course, if the service you are deploying is replicated, the execution of this one-shot task is repeated as many replicas you have.
Regarding the specific case of database migrations, many frameworks (1, 2, 3) make them safe to run multiple times, if you follow the framework guidelines, because they either run the migration in transaction or take some form of lock (therefore ensuring that only one of the migration tasks runs successfully).