Skip to content

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.

Notifications You must be signed in to change notification settings

DO-Solutions/app-platform-cron

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.


Logo

DigitalOcean | App Platform Cron Worker

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»

Introduction

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.

Architecture diagram

architecture

Prerequisites

  1. A DigitalOcean account (Log in)
  2. doctl CLI(tutorial)

Deploy to App Platform

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.

Deploy to DigitalOcean

Steps

  1. Fork this repo

  2. Use doctl to retrieve your existing apps App Spec.

    doctl apps list
    doctl apps spec get b6af73dc-8aba-4237-8dc9-b632ad379bd5 > appspec.yaml
  3. 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: /
  1. Update your app to deploy Docker-cron Worker

    doctl apps update b6af73dc-8aba-4237-8dc9-b632ad379bd5 --spec appspec.yaml

Verify worker functionality

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

Contact

Jack Pearce, Solutions Engineer - [email protected]

(back to top)

About

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.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •