As an alternative DigitalOcean Functions natively supports scheduling functions.
For more information, please refer to the How to Schedule Functions guide. To schedule DigitalOcean Functions, you can create a function trigger and configure a schedule using standard cron syntax.
App Platform allows you to Build, deploy, and scale apps quickly using a simple, fully-managed infrastructure solution.
This tutorial shows you how to run scheduled jobs on App Platform using a Cron Worker.
Explore more App Platform tutorials in the DigitalOcean Developer Center»
Quick App Platform tour»
In this tutorial, we'll guide you through the process of setting up a job scheduler in App Platform using a docker container that runs cron as an App Platform Worker.
Click the following button to deploy the app to App Platform. If you are not currently logged in with your DigitalOcean account, this button prompts you to to log in.
-
Fork this repo
-
Use
doctl
to retrieve your existing apps App Spec.doctl apps list doctl apps spec get b6af73dc-8aba-4237-8dc9-b632ad379bd5 > appspec.yaml
-
Add the Docker-cron worker, note the
workers:
key
alerts:
- rule: DEPLOYMENT_FAILED
- rule: DOMAIN_FAILED
name: walrus-app
region: nyc
services:
- environment_slug: node-js
git:
branch: main
repo_clone_url: https://github.com/digitalocean/sample-nodejs.git
http_port: 8080
instance_count: 1
instance_size_slug: apps-s-1vcpu-0.5gb
name: sample-nodejs
routes:
- path: /
run_command: yarn start
source_dir: /
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: /
-
Update your app to deploy Docker-cron Worker
doctl apps update b6af73dc-8aba-4237-8dc9-b632ad379bd5 --spec appspec.yaml
We can use doctl
to retrieve our runtime logs and verify our cron is running, by default it will output to console
doctl apps logs b6af73dc-8aba-4237-8dc9-b632ad379bd5 --type=run
Jack Pearce, Solutions Engineer - [email protected]