How to Manage Workers in App Platform
Validated on 24 Feb 2024 • Last edited on 5 Mar 2026
App Platform is a fully managed Platform-as-a-Service (PaaS) that deploys applications from Git repositories or container images. It automatically builds, deploys, and scales components while handling all underlying infrastructure.
Background workers can consist of any application code you like. As far as App Platform is concerned, they are the same as services, except they are not routable, meaning they are not accessible via an external URL.
Add a Worker to an App Using Automation
You can add a worker to an app using the CLI’s app update command or the API’s app update endpoint. To add a worker, update the app’s spec with the worker’s specifications and submit the spec using the following command or endpoint.
Add a Worker Using the Control Panel
Go to the Apps page of the DigitalOcean Control Panel and select your app. Click Add components, then choose Create resources from source code to add a worker.
On the Add resources screen:
- Select your deployment source, either a Git repository or a container image. If you have not previously created an app on App Platform, the repository service may prompt you to provide DigitalOcean with read permissions to your account.
- If using a Git repository, choose a branch to deploy from. By default, App Platform builds from the repository's root. If your code lives in a subdirectory (for example, in a monorepo), set the source directory to match.
- Clear the Autodeploy checkbox if you want to stop automatic redeploys when the repository changes.
- Click Next.
App Platform retrieves your code, analyzes your repository, and automatically selects the appropriate runtime (such as Node or Ruby). If you need to override this behavior, upload a Dockerfile to your branch and restart the creation process.
Configure Resource Settings
The Resource settings table displays the configuration settings, some of which the detection system auto-fills.
You can configure the following settings:
-
Name: A unique name for the component.
-
Resource type: The type of component to deploy (web service, static site, worker, or job).
-
Branch: The branch to deploy from. You can enable automatic redeploys when changes are made to this branch.
-
Instance size: The amount of memory (RAM), CPUs, and bandwidth allocated to the component. You can choose 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: The component's scaling settings. The instance size you select determines the scaling options available. For more details, see How to Scale Apps in App Platform.
-
Build command: 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: A custom run command for the application to run after deployment. If no run command is specified, the default run command for your app's language is used, such as
npm startfor a Node.js app. For Dockerfile-based builds, entering a run command overrides the Dockerfile's entrypoint. -
Environment variables: Key-value pairs available to your app at runtime that let you keep configuration separate from application code. Use them to provide secrets, API keys, and other external settings, such as connection details for an external database.
Set App-Level Environment Variables
App-level environment variables are available to all components in your app. Use them for shared configuration, secrets, API keys, or other values your app needs at build time or runtime.
To set app-level environment variables:
- Click Edit in the App-level environment variables section.
- Click Add environment variable, type a key and value, then select a scope.
- Select Encrypt to obscure the value in build, deployment, and application logs.
For dynamic, app-specific variables that your app can reference, see Use Bindable Variables.
Review and Deploy
Review the configuration and pricing details in the Summary section, then click Add resources.
App Platform creates the component with the selected settings and deploys it automatically. You can view or update the component's configuration on the Settings page.
Edit Workers
Go to the Apps page, select your app, then click the Settings tab. Select the worker you want to edit.
Click Edit beside a setting you want to change, then click Save.
Destroy Workers
Go to the Apps page, select your app, then click the Settings tab. Select the worker you want to destroy.
At the bottom of the page, click Destroy Component. Enter the worker's name to confirm, then click Destroy.