App Platform is a Platform-as-a-Service (PaaS) offering that allows developers to publish code directly to DigitalOcean servers without worrying about the underlying infrastructure.
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.
You can add a job to an app using the CLI’s app update command or the API’s app update endpoint. To add a job, update the app’s spec with the job’s specifications and submit the spec using the following command or endpoint.
On the Choose a deployment source screen, select the code repository service your app resides on. If you have not previously created an app on App Platform, the repository service prompts you to provide DigitalOcean with read permissions to your account.
Select the app’s repo from the Repository drop-down and then select the branch to deploy from in the Branch drop-down menu.
/.do/app.yaml
, App Platform uses its configuration values. If your repo is meant to be cloned and then deployed on App Platform, you can also define an app spec in /.do/deploy.template.yaml
. For examples of /.do/app.yaml
and /.do/deploy.template.yaml
, see the repo for the sample Node.js app for App Platform.The Source Directory is the directory inside the repo from which to build the app from. The default is the repo’s root directory. If you’re deploying from a monorepo or a container image registry, see Deploy from a Monorepo or How to Deploy from Container Images for more information on how to deploy app’s using these options.
You can choose to opt out of auto-deploying code changes. Uncheck the Autodeploy box to disable App Platform from redeploying the app when it detects changes in the app’s repo.
Once you have selected the app’s repo and branch, click Next. App Platform retrieves your app’s code.
App Platform inspects the code and app resources, and selects an appropriate runtime environment (such as Node, or Ruby). If you need to override this, upload a Dockerfile to your branch and restart the app creation process.
To change to a different resource type, in the Info section, click Edit. Use the Resource type drop-down menu to choose another option. Additionally, for jobs, in the When to Run drop-down list, you can specify when the job should run. For example, after every failed deployment.
In the settings page, you can also change the resource’s name, view the resource’s buildpacks, edit its build and run commands, edit the HTTP port and the request route, and more.
App Platform also displays the settings for the component, several of which may be auto-filled by App Platform’s detection system. You can configure the following settings for your app:
Name: A unique name for the component.
Resource Type: - The type of app to be deployed, either a web service, static site, or worker service. This field determines which additional configuration options are available for your app on this screen.
Instance Size - The amount of memory (RAM), number of CPUs, and bandwidth allocated to the component. You can select a size that uses either shared or dedicated CPUs. Shared CPUs share their processing power with other DigitalOcean users. Dedicated CPUs are dedicated solely to your app. We recommend dedicated CPUs for more resource-intensive applications that require consistent high performance and autoscaling.
Containers – You can also configure your app’s scaling settings in this section. Depending on what instance size you select determines the scaling options available to the component. For more information about scaling, see How to Scale Apps in App Platform.
Build Strategy - Add a custom build command to run before the app is deployed. This is useful for compiling assets, installing dependencies, or running tests before deployment.
Run Command - For web and worker services only. You can specify custom run commands for the application to run after deployment. If no run commands are specified, the default run command for your app’s language is used, such as npm start
for a Node.js app. For Dockerfile-based builds, entering a run command overrides the Dockerfile’s entrypoint.
Public HTTP Port - For web services only. The port that the app receives HTTP requests on. The default port is 8080
.
Internal Ports - For web services only. The port that the app receives internal requests on.
HTTP Request Routes - For web services and static sites only. The URL path where the app can be accessed, such as your-app-v3cl4.ondigitalocean.app/api
. If not specified, the app is accessible from the provided hostname’s root.
Output Directory - For static sites only. An optional path to where the build assets are located, relative to the build context. If not set, App Platform automatically scans for these directory names: _static
, dist
, public
, build
.
App Platform uses cloud-native buildpacks to build your app and uses the buildpack’s default build and run commands. Refer to the cloud-native buildpack reference for more information about specific buildpacks.
If your app requires environment variables, such as the app’s URL or database connection strings, you can define them in this section. These can be runtime and build time environment variables. We also provide several app-specific dynamic environment variables that the app can reference. App-level variables can be accessed by all resources in your app.
In the App-level environment variables box, click the corresponding Edit link to specify app-level or component-level environment variables. Click the Encrypt checkbox to obscure the variable’s values from all build, deployment, and application logs.
Once you configure the environment variables, click Add resources.
In the Apps section of the DigitalOcean Control Panel, select your app and click the Settings 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.
In the Apps section of the DigitalOcean Control Panel, select your app and click the Settings tab. Click 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.