Question

App Platform Cron...

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?


Submit an answer


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!

Sign In or Sign Up to Answer

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.

KFSys
Site Moderator
Site Moderator badge
May 12, 2025

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/

Bobby Iliev
Site Moderator
Site Moderator badge
May 12, 2025

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

Become a contributor for community

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

DigitalOcean Documentation

Full documentation for every DigitalOcean product.

Resources for startups and SMBs

The Wave has everything you need to know about building a business, from raising funding to marketing your product.

Get our newsletter

Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.

New accounts only. By submitting your email you agree to our Privacy Policy

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.