Hi, I will need to add some features to my application.
I need to run consumers that handle async message in queue like SQS / RabbitMQ
I need to run some workers at specific time like cronjob
What is the best way to do it ? For consumer I assume that I can run a docker file that consume message and use K8S supervision to re launch in case of docker container failure. But what about for cronjob ? I saw that it’s not supported right now what is the best alternative ?
Sorry for the delay. Qovery does not support cronjob yet, but we have already started to work on it! Unfortunately, due to the amount of work it requires on our end, it won’t be ready soon (in the coming days but weeks/months).
In the meantime, I have several options to propose to you waiting for it:
You can create a Cron image to run periodically what you need. I didn’t test it, but in theory, it should work (https://www.baeldung.com/ops/docker-cron-job). Pros: integrated into Qovery, you’ll get logs, see it as an application, it works like any other application Cons: Requires some effort to set up the first image (link above). To switch to the cronjob feature we’ll release, you will have to create a new dedicated image for it (the same as the second option). Finally, it is an always-running application, not a real cronjob.
You have access to your Kubernetes cluster. So basically, you can create your image, push it to a registry and use directly Kubernetes Cron job. Pros: You’ll be familiar with what we’ll propose, the image you will build will remain the same once the cronjob feature is released, and the switch to it will be a walk in a park for you. Cons: You have to spend some time reading the doc to connect and deploy a cronjob work on Kubernetes (not that complex). It will not be integrated into the Qovery UI, so you’ll have to use kubectl to get logs output, status, etc…
Inside your code (current or new application), use a scheduler lib to run tasks at a specific time Pros: you’re familiar with the code and codebase and may be super quick to do it for you with fewer efforts possible Cons: it will remain as something in your app or a dedicated application, running all the time, not a real cron
Hope it’s clear, and you’ll find an option suitable to your needs.