Divio CLI#
The Divio CLI is a Python-based command line application, and can be installed via pip:
pip install divio-cli
The CLI will run in Python 3.6 to 3.9.
The divio-cli source code is available on GitHub.
Divio CLI configuration#
The behaviour of the Divio CLI is managed via a JSON configuration file.
Location of the file#
The file is created by the CLI and will be found at either:
~/.config/divio/config.json
, or~/.aldryn
(the older location for the file - if this file exists it will take precedence)
File structure#
The file contains a JSON dictionary, for example:
{
"update_check_timestamp": 1501185567,
"skip_doctor_checks": [
"docker-server-dns"
]
}
Using skip_doctor_checks
#
The skip_doctor_checks
are particularly useful, and can be used to disable certain automated
checks run by the Divio app and the divio doctor
command (for example, if you
are working offline, or with network restrictions).
The checks that divio doctor
runs are classes in check_system.py. If a check fails that you think can be
ignored, add it to the skip_doctor_checks
list to disable it, as in the example above. The checks that can be
disabled are:
login
- checks that the CLI can connect to the endpoint on the Divio Control Panel.git
- checks that Git is installed by runninggit --version
.docker-client
checks that the Docker client is available by runningdocker --version
.docker-compose
- checks that Docker Compose is available by runningdocker-compose --version
.docker-server
- checks that a command can be executed in a container by runningdocker run --rm busybox
.docker-server-ping
- checks that a Docker container has connectivity to the Internet by running:docker run --rm busybox sh -c "ping -c 1 -w 5 8.8.8.8"
docker-server-dns
- checks that a Docker container can resolve DNS queries by running:docker run --rm busybox sh -c "timeout 5 nslookup -type=a control.divio.com. || timeout -t 5 nslookup -type=a control.divio.com."
Divio CLI command reference#
This is the full autogenerated command reference documentation for the Divio CLI. See Divio’s local commands cheatsheet for some common usage examples.
divio#
divio [OPTIONS] COMMAND [ARGS]...
Options
- -d, --debug, --no-debug#
Drop into the debugger if command execution raises an exception.
- Default
False
- -z, --zone <zone>#
Specify the Divio zone. Defaults to divio.com.
addon#
Validate and upload addons packages to the Divio cloud.
divio addon [OPTIONS] COMMAND [ARGS]...
Options
- -p, --path <path>#
Addon directory
- Default
.
register#
Register your addon on the Divio Control Panel
Verbose Name: Name of the Addon as it appears in the Marketplace
Package Name: System wide unique Python package name
divio addon register [OPTIONS] VERBOSE_NAME PACKAGE_NAME
Options
- -o, --organisation <organisation>#
Register an addon for an organisation.
Arguments
- VERBOSE_NAME#
Required argument
- PACKAGE_NAME#
Required argument
upload#
Upload addon to the Divio Control Panel.
divio addon upload [OPTIONS]
validate#
Validate addon configuration.
divio addon validate [OPTIONS]
app#
Manage your application
divio app [OPTIONS] COMMAND [ARGS]...
configure#
Associate a local application with a Divio cloud applications.
divio app configure [OPTIONS]
dashboard#
Open the application dashboard on the Divio Control Panel.
divio app dashboard [OPTIONS]
Options
- --remote-id <remote_id>#
Remote Project ID or UUID to use for project commands. Defaults to the project in the current directory using the configuration file.
deploy#
Deploy application.
divio app deploy [OPTIONS] [ENVIRONMENT]
Options
- --remote-id <remote_id>#
Remote Project ID or UUID to use for project commands. Defaults to the project in the current directory using the configuration file.
Arguments
- ENVIRONMENT#
Optional argument
deploy-log#
View last deployment log.
divio app deploy-log [OPTIONS] [ENVIRONMENT]
Options
- --remote-id <remote_id>#
Remote Project ID or UUID to use for project commands. Defaults to the project in the current directory using the configuration file.
Arguments
- ENVIRONMENT#
Optional argument
deployments#
Retrieve deployments.
divio app deployments [OPTIONS] COMMAND [ARGS]...
Options
- -p, --pager, -P, --no-pager#
Choose whether to display content via pager.
- Default
False
- --json#
Choose whether to display content in json format.
- Default
False
- --remote-id <remote_id>#
Remote Project ID or UUID to use for project commands. Defaults to the project in the current directory using the configuration file.
get#
Retrieve a deployment (by uuid).
divio app deployments get [OPTIONS] DEPLOYMENT_UUID
Arguments
- DEPLOYMENT_UUID#
Required argument
get-var#
Retrieve an environment variable (by name) from a deployment (by uuid).
divio app deployments get-var [OPTIONS] DEPLOYMENT_UUID VARIABLE_NAME
Arguments
- DEPLOYMENT_UUID#
Required argument
- VARIABLE_NAME#
Required argument
list#
Retrieve deployments from an environment or deployments across all environments of an application.
divio app deployments list [OPTIONS]
Options
- -s, -e, --stage, --environment <environment>#
Select an environment (by name) from which deployments will be retrieved.
- Default
test
- --all-envs, --all-environments#
Retrieve deployments from all available environments.
- Default
False
- --limit, --limit-results <limit_results>#
The maximum number of results that can be retrieved.
develop#
Add a package ‘package’ to your local application environment.
divio app develop [OPTIONS] PACKAGE
Options
- --no-rebuild#
Do not rebuild docker container automatically.
- Default
False
Arguments
- PACKAGE#
Required argument
down#
Stop the local application.
divio app down [OPTIONS]
environment-variables#
Retrieve environment variables.
divio app environment-variables [OPTIONS] COMMAND [ARGS]...
Options
- -p, --pager, -P, --no-pager#
Choose whether to display content via pager.
- Default
False
- --json#
Choose whether to display content in json format.
- Default
False
- --txt#
Choose whether to display content in a simple txt-like format (names and values only).
- Default
False
- --remote-id <remote_id>#
Remote Project ID or UUID to use for project commands. Defaults to the project in the current directory using the configuration file.
get#
Retrieve an environment variable (by name) from an environment or any occurrence of it across all environments of an application.
divio app environment-variables get [OPTIONS] VARIABLE_NAME
Options
- -s, -e, --stage, --environment <environment>#
Select an environment (by name) from which the environment variable will be retrieved.
- Default
test
- --all-envs, --all-environments#
Retrieve an environment variable across all environments.
- Default
False
- --limit, --limit-results <limit_results>#
The maximum number of results that can be retrieved.
Arguments
- VARIABLE_NAME#
Required argument
list#
Retrieve environment variables from an environment or environment variables across all environments of an application.
divio app environment-variables list [OPTIONS]
Options
- -s, -e, --stage, --environment <environment>#
Select an environment (by name) from which environment variables will be retrieved.
- Default
test
- --all-envs, --all-environments#
Retrieve environment variables from all available environments.
- Default
False
- --limit, --limit-results <limit_results>#
The maximum number of results that can be retrieved.
export#
Export local database dump.
divio app export [OPTIONS] COMMAND [ARGS]...
db#
Export a dump of your local database
divio app export db [OPTIONS] [PREFIX]
Arguments
- PREFIX#
Optional argument
import#
Import local database dump.
divio app import [OPTIONS] COMMAND [ARGS]...
db#
Load a database dump into your local database.
divio app import db [OPTIONS] [PREFIX] [DUMP_PATH]
Arguments
- PREFIX#
Optional argument
- DUMP_PATH#
Optional argument
list#
List all your applications.
divio app list [OPTIONS]
Options
- -g, --grouped#
Group by organisation.
- Default
False
- -p, --pager, -P, --no-pager#
Choose whether to display content via pager.
- Default
False
- --json#
- Default
False
logs#
View logs.
divio app logs [OPTIONS] [ENVIRONMENT]
Options
- --tail#
Tail the output.
- Default
False
- --utc#
Show times in UTC/
- Default
False
- --remote-id <remote_id>#
Remote Project ID or UUID to use for project commands. Defaults to the project in the current directory using the configuration file.
Arguments
- ENVIRONMENT#
Optional argument
open#
Open local or cloud applications in a browser.
divio app open [OPTIONS] [ENVIRONMENT]
Options
- --remote-id <remote_id>#
Remote Project ID or UUID to use for project commands. Defaults to the project in the current directory using the configuration file.
Arguments
- ENVIRONMENT#
Optional argument
pull#
Pull db or files from the Divio cloud environment.
divio app pull [OPTIONS] COMMAND [ARGS]...
db#
Pull database the Divio cloud environment.
divio app pull db [OPTIONS] [ENVIRONMENT] [PREFIX]
Options
- --keep-tempfile#
Keep the temporary file with the data.
- Default
False
- --remote-id <remote_id>#
Remote Project ID or UUID to use for project commands. Defaults to the project in the current directory using the configuration file.
Arguments
- ENVIRONMENT#
Optional argument
- PREFIX#
Optional argument
media#
Pull media files from the Divio cloud environment.
divio app pull media [OPTIONS] [ENVIRONMENT]
Options
- --remote-id <remote_id>#
Remote Project ID or UUID to use for project commands. Defaults to the project in the current directory using the configuration file.
Arguments
- ENVIRONMENT#
Optional argument
push#
Push db or media files to the Divio cloud environment.
divio app push [OPTIONS] COMMAND [ARGS]...
db#
Push database to the Divio cloud environment..
divio app push db [OPTIONS] [ENVIRONMENT] [PREFIX]
Options
- -d, --dumpfile <dumpfile>#
Specify a dumped database file to upload.
- --noinput#
Don’t ask for confirmation.
- Default
False
- --remote-id <remote_id>#
Remote Project ID or UUID to use for project commands. Defaults to the project in the current directory using the configuration file.
Arguments
- ENVIRONMENT#
Optional argument
- PREFIX#
Optional argument
media#
Push database to the Divio cloud environment..
divio app push media [OPTIONS] [ENVIRONMENT] [PREFIX]
Options
- --noinput#
Don’t ask for confirmation.
- Default
False
- --remote-id <remote_id>#
Remote Project ID or UUID to use for project commands. Defaults to the project in the current directory using the configuration file.
Arguments
- ENVIRONMENT#
Optional argument
- PREFIX#
Optional argument
setup#
Set up a development environment for a Divio application.
divio app setup [OPTIONS] SLUG
Options
- -s, -e, --stage, --environment <environment>#
Specify environment from which media and content data will be pulled.
- Default
test
- -p, --path <path>#
Install application in path.
- Default
.
- --overwrite#
Overwrite the application directory if it already exists.
- Default
False
- --skip-doctor#
Skip system test before setting up the application.
- Default
False
Arguments
- SLUG#
Required argument
ssh#
Establish SSH connection.
divio app ssh [OPTIONS] [ENVIRONMENT]
Options
- --remote-id <remote_id>#
Remote Project ID or UUID to use for project commands. Defaults to the project in the current directory using the configuration file.
Arguments
- ENVIRONMENT#
Optional argument
status#
Show local application status.
divio app status [OPTIONS]
up#
Start the local application (equivalent to: docker-compose up).
divio app up [OPTIONS]
update#
Update the local application with new code changes, then build it.
Runs:
git pull docker-compose pull docker-compose build docker-compose run web start migrate
divio app update [OPTIONS]
Options
- --strict#
A strict update will fail on a warning.
- Default
False
boilerplate#
Validate and upload boilerplate packages to the Divio cloud.
divio boilerplate [OPTIONS] COMMAND [ARGS]...
Options
- -p, --path <path>#
Boilerplate directory
- Default
.
upload#
Upload boilerplate to the Divio Control Panel.
divio boilerplate upload [OPTIONS]
Options
- --noinput#
Don’t ask for confirmation.
- Default
False
validate#
Validate boilerplate configuration.
divio boilerplate validate [OPTIONS]
doctor#
Check that your system meets the development requirements.
To disable checks selectively in case of false positives, see https://docs.divio.com/en/latest/reference/divio-cli/#using-skip-doctor-checks
divio doctor [OPTIONS]
Options
- -m, --machine-readable#
- Default
False
- -c, --checks <checks>#
login#
Authorise your machine with the Divio Control Panel.
divio login [OPTIONS] [TOKEN]
Options
- --check#
Check for current login status.
- Default
False
Arguments
- TOKEN#
Optional argument
version#
Show version info.
divio version [OPTIONS]
Options
- -s, --skip-check#
Don’t check PyPI for newer version.
- Default
False
- -m, --machine-readable#
- Default
False