How to Manage Jobs in App Platform

Jobs can consist of any application code you would like to run at a specific time. 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.

Like workers, jobs are not “routable,” meaning they run in the background and cannot accept HTTP/S requests.

Create Jobs

  1. Go to https://cloud.digitalocean.com/apps, click on your app, and click on the Components tab. Add a Job component by clicking the Create Component button and choosing the Job option.
Component screen
  1. Select the source code for the Job on GitHub. If connecting for the first time, you will see an empty repository list and will need to click the link labeled Configure your GitHub permissions, then refresh this page.

  2. Next, give the Job a name and select which branch of the source repo you'd like to use as the source of the Job. Click Next.

  3. App Platform will inspect the code and select an appropriate runtime environment (such as Node, Ruby, etc). If you need to override this, you can see if there is a better options in the drop-down labeled Type as well. If nothing suitable appears there, upload a Dockerfile to your branch and restart the app creation process.

  4. App Platform will also display any appropriate build and run commands that it detected, which you can now customize as needed.

  5. If the use of environment variables is required, click Edit and supply them. Click the Encrypt checkbox to ensure a variable's value is obscured in all build, deploy, and application logs.

  6. Select a plan, and click Launch Job.

Edit Jobs

Go to https://cloud.digitalocean.com/apps, click on your app, and click on the Components tab. Click the Job you'd like to edit.

You can use the configuration settings you see here to change the Job's scaling behavior, modify environment variables, edit commands, and more.

You can also change when your job runs by modifying the Job Trigger value.

Job trigger drop-down

Destroy Jobs

Go to https://cloud.digitalocean.com/apps, click on your app, and click on the Components tab. Click on the Job you'd like to destroy.

You can destroy the Job by clicking the Destroy Component button on the bottom of the page and entering its name to confirm your selection.