Validated on 20 Nov 2024 • Last edited on 20 Nov 2024
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.
App Platform provides two options for managing your app’s container: restarting the container or forcing a rebuild. Both options are useful in different situations:
Restart your app’s container: Redeploys an exact copy of your app’s container without fetching updates from your source code repository. This is useful if your app is stuck in a connection loop or a deadlock. However, restarting your app does not fix issues caused by code or configuration errors.
Restarting your app performs a rolling restart of its service and worker components; it does not restart the app’s jobs or databases. You can also restart individual services or workers.
Force a rebuild of your app’s container: Redeploys the app with the latest changes from your source code repository. This is useful if you have made changes to your app’s container image and want to ensure that the changes are reflected in your app.
Restart Your App Using the API or CLI
You can restart all of your app’s components by providing your app’s ID to the restart command or API endpoint. You can also restart individual components by setting the --components flag in the command, or the components field in the API, and then provide a list of component names as arguments.
import os
from pydo import Client
client = Client(token=os.environ.get("DIGITALOCEAN_TOKEN"))
create_resp = client.apps.restart(app_id="b6bdf840", body={"components": ["component1", "component2"]})
Restart Your App Using the Control Panel
To restart your app’s container from the control panel, click on the app you want to restart and then click on the Actions button. In the Actions menu, click Restart.
In the Restart or Deploy modal, select whether to restart all services and workers, or restart individual components. Once you’ve selected which components to restart, click Restart. The app redeploys without importing any changes from your source code repository.
Force Rebuild Your App Using the API or CLI
You can force a rebuild of your app’s container by creating a new deployment for the app and setting the force-rebuild flag in the CLI, or the force_rebuild parameter in the API, to true. This forces the app to redeploy with the latest changes from your source code repository.
How to Force Rebuild an App Using the DigitalOcean CLI
The following example creates a deployment for an app with the ID f81d4fae-7dec-11d0-a765-00a0c91e6bf6. Additionally, the command returns the app’s ID and status:
import os
from pydo import Client
client = Client(token=os.environ.get("DIGITALOCEAN_TOKEN"))
create_resp = client.apps.create_deployment(app_id="b6bdf840", body={"force_build": True})
Force a Rebuild of Your App Using the Control Panel
To force a rebuild of your app’s container from the control panel, click on the app you want to rebuild and then click on the Actions button. In the Actions menu, click Force Rebuild and Deploy.
In the Restart or Deploy modal, choose whether to clear the build cache, then click Force Rebuild and Deploy. The app redeploys after fetching changes from your source code repository.