Report this

What is the reason for this report?

App Platform Cron...

Posted on May 12, 2025

I have a Rails app deployed trough App Platform, now I want to add scheduled cron to run a command every 30 minutes. I’ve followed the following tutorial…

github.com/DO-Solutions/app-platform-cron

I understand I have to add:

workers:
- dockerfile_path: Dockerfile
  github:
    branch: main
    deploy_on_push: true
    repo: <your-github-username>/app-platform-cron
  instance_count: 1
  instance_size_slug: apps-s-1vcpu-0.5gb
  name: docker-cron
  source_dir: /

To the appspec.yaml and then update it… which I did and it worked fine… but when/where do I put the command I want to run and the frequency?



This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Heya,

Currently, App Platform only supports scheduling code to run at pre-deploy time or after deploy time. If scheduling your job to run after deploy time, you can further select whether to run a job after a successful deployment or whether the job should be run if the app fails to deploy.

A workaround would be to use this:

https://docs.digitalocean.com/products/functions/how-to/schedule-functions/

Hi there,

I’ve answered a similar question here: https://www.digitalocean.com/community/questions/scheduled-tasks-or-cronjobs-with-app-platform-worker

The cronjob repo example that you are referring is going to be useful if you want to setup an HTTP endpoint that you can hit with that service on a specific schedule. However if you are looking to setup a CLI command instead, you would need to modify that example repo so that you actually deploy your code as well rather than just the cron and curl commands.

What you could do indeed is just fork that repository and extend it so that you could also include your app in there and use the cron service as well.

Let me know if this helps!

- Bobby

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.