The use case is a rake task that needs to run on a schedule.
Our apps are Rails running in Docker, each has a development and production web service that are tied to the same repo, with branches for each. Deployment is via a Github workflow that detects what branch was pushed to, and runs the respective Render deploy hook.
How would i define a cronjob independent to each service? That is - one that uses the most recently built container for the service.
Also wanted to confirm since we’re in Docker here, the job is going to boot the container via it’s CMD, and then we’d define the cron command to something like bundle exec rake ...
It sounds like you’ve got a good handle on this. You are correct that to run a cron job via docker you’d just include something like
CMD bundle exec rake...
at the end of your Dockerfile. The entire Docker file is used for the initial build of your cron job, then each run will just execute that CMD.
Can you clarify what you’re asking here:
How would i define a cronjob independent to each service? That is - one that uses the most recently built container for the service.
The cron job will be completely independent of your web services. If your cronjob is in the same repo as your web service and you want to it to be deployed independently from your other services, you might be interested in leveraging some of our Monorepo functionality. Let me know if I’ve misunderstood this aspect of your question.
Ah - i should have looked at the actual service setup in the dashboard, and not the blueprint specs (i don’t see a branch option there for cron jobs). I see that you can specify a branch for the cron job, so i think that answers my question there - how would we stage changes to the cronjob to a development environment - and this seems to be it.