Skip to main content

Reference

To access a comprehensive list of all available commands and explore the extensive functionalities provided by the Divio CLI, simply execute the following command:

divio --help
Usage: divio [OPTIONS] COMMAND [ARGS]...

Options:
-d, --debug / --no-debug Drop into the debugger if command execution raises
an exception. [default: no-debug]
-z, --zone TEXT Specify the Divio zone. Defaults to divio.com.
-v, --verbose Verbosity level [default: 0]
-h, --help Show this message and exit.

Commands:
addon Validate and upload addons packages to the Divio cloud.
app (project) Manage your application
app-template
doctor Check that your system meets the development requirements.
login Authorise your machine with the Divio Control Panel.
logout Log off from Divio Control Panel
organisations Manage your organisations.
regions Manage regions.
services Manage services.
version Show version info.

For additional assistance and detailed explanations of each command, append --help to any command you're interested in:

divio app --help
Usage: divio app [OPTIONS] COMMAND [ARGS]...

Manage your application

Options:
-h, --help Show this message and exit.

Commands:
configure Associate a local application with a Divio cloud...
create Create a new application.
dashboard Open the application dashboard on the Divio...
deploy Deploy application.
deploy-log View last deployment log.
deployments Retrieve deployments.
develop Add a package 'package' to your local...
down (stop) Stop the local application.
environment-variables (env-vars)
Retrieve environment variables.
export Export local database dump.
import Import local database dump.
list List all your applications.
logs View logs.
open Open local or cloud applications in a browser.
pull Pull db or files from the Divio cloud environment.
push Push db or media files to the Divio cloud...
service-instances Commands for service instances like a database...
setup Set up a development environment for a Divio...
ssh Establish SSH connection.
status Show local application status.
up (start) Start the local application (equivalent to:...
update Update the local application with new code...

Here is a curated selection of practical examples to demonstrate common uses and helpful scenarios:

Set up an application

This command is conveniently pre-populated for you in the environments dashboard, located under "Dev tools" > "Setup":

divio app setup {SLUG}

The term "slug" refers to a unique identifier for different environments, such as test, live, or any other custom environments you have established.

Deploy to the cloud server

You can initiate a deployment from your local directory by executing the following command:

divio app deploy

Alternatively, you can specify a different environment, such as live, to target it specifically:

divio app deploy live

This approach is also advantageous for continuous integration (CI) processes, by specifying a --remote-id that represents the application's UUID:

divio login {TOKEN}
divio app deploy test --remote-id {WEBSITE_UUID} --build-mode FORCE

In this example, we deploy to the test environment and explicitly force a rebuild of the image.

Build local image

This is particularly useful after updating your application's requirements or modifying the Dockerfile.

divio app build

Alternatively, you can achieve the same result by using its docker composer counterpart:

docker compose build

Push/pull code

We adhere to standard Git procedures for managing code changes and synchronizations with the repository. This involves typical Git commands that are integral to version control practices like:

git pull
git add .
git commit -m "my new changes"
git push

Push/pull media or database

Utilizing the Divio CLI, you can seamlessly transfer media assets or database content with simple commands:

divio app pull media
divio app push media
divio app pull db
divio app push db

Alternatively, specify a different environment, such as live, to direct the operation towards a specific environment.

divio app pull media live

List custom environment variables

Divio Cloud supplements your defined environment variables with several custom ones for enhanced functionality. You can list all these variables using the following command:

divio app environment-variables list

Or by specifying any other environment such as live or even all environments using the --all-envs flag.

divio app environment-variables list -e live
divio app environment-variables list --all-envs

You can also get a specific custom environment variable through:

divio app environment-variables get {ENVIRONMENT_VARIABLE_NAME}

Or by specifying any other environment such as live or even all occurrences of this environment variable across all environments using the --all-envs flag.

divio app environment-variables get {ENVIRONMENT_VARIABLE_NAME} -e live
divio app environment-variables get {ENVIRONMENT_VARIABLE_NAME} --all-envs

List deployments

You can view all ongoing deployments by executing the following command:

divio app deployments list

Or by specifying any other environment such as live or even all environments using the --all-envs flag.

divio app deployments list -e live
divio app deployments list --all-envs

You can get a specific deployment by running:

divio app deployments get {DEPLOYMENT_UUID}

You can get an environment variable registered for a specific deployment through:

divio app deployments get-var {DEPLOYMENT_UUID} {ENVIRONMENT_VARIABLE_NAME}

Running the local server

Start an application:

divio app up

You can also use equivalent docker commands such as:

docker compose up
docker compose run --rm --service-ports web

Stop an application:

divio app down

Working inside the containerised environment

Run a specific command inside the web container:

docker compose run --rm web {COMMAND}

For example,

docker compose run --rm web python manage.py shell

Run a specific command inside the web container, exposing the ports listed in the Dockerfile:

docker compose run --rm --service-ports web {COMMAND}

Docker management

List running containers:

docker ps

List all containers:

docker ps -a

List images:

docker image ls

Remove all stopped containers:

docker container prune

Remove all unused containers and images:

docker system prune