How to Add Worker Components on DigitalOcean App Platform
Add workers via Control Panel by selecting Worker type and configuring name/branch/instance size, or update app spec with workers array via CLI/API. Workers handle background tasks with outbound-only access. Common issues like repo errors fixed by verifying Git permissions and specs; deployment takes 10-30 minutes.
Prerequisites
- DigitalOcean account with billing enabled
- Existing App Platform app
- Source code repository (GitHub/GitLab/Bitbucket) with access
- Personal access token for CLI/API (optional)
- doctl CLI installed for automation
Step-by-Step Instructions
Navigate to Apps in Control Panel
cloud.digitalocean.com/apps. Select your existing app from the list, then click the Add components button.Choose Source Code Deployment
Select Worker Type and Configure
Set Environment Variables
Review and Deploy Worker
Install and Authenticate doctl CLI
doctl, create a personal access token, and authenticate with doctl auth init using the token.Update App Spec for Worker
your-app.yaml) adding a workers section: workers:
- name: api
git:
branch: main
repo: your/repo
instance_size_slug: basic-xxsDeploy via CLI Command
doctl apps update <app-id> --spec your-app.yaml, replacing <app-id> with your app ID.Prepare API Token and Endpoint
https://api.digitalocean.com/v2/apps/{id} with Authorization: Bearer $TOKEN and JSON body including workers array.Monitor Deployment and Logs
Common Issues & Troubleshooting
"Invalid repository" or "Repository not found" error
Verify Git OAuth integration or personal access token has repo read permissions. Test by cloning repo manually and check DigitalOcean settings.
Build or deployment failures
Review build logs in app dashboard, validate YAML/JSON spec syntax, ensure compatible instance size, and check environment variables.
Worker cannot receive incoming requests
Workers are non-routable for background tasks only; they initiate outbound HTTP. Use internal component networking via http://component-name.
Spec update not applying via CLI/API
Confirm app ID is correct, token has write access, and spec file path is accurate. Use --format flag to verify output.
Scaling or performance issues
Switch to dedicated CPUs for intensive workloads and adjust autoscaling in instance settings.