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 2.7 or 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 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.
addon¶
Validate and upload addons packages to the Divio cloud.
divio addon [OPTIONS] COMMAND [ARGS]...
Options
-
-p
,
--path
<path>
¶ Addon directory
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]
boilerplate¶
Validate and upload boilerplate packages to the Divio cloud.
divio boilerplate [OPTIONS] COMMAND [ARGS]...
Options
-
-p
,
--path
<path>
¶ Boilerplate directory
upload¶
Upload boilerplate to the Divio Control Panel.
divio boilerplate upload [OPTIONS]
Options
-
--noinput
¶
Don’t ask for confirmation.
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
¶
-
-c
,
--checks
<checks>
¶
login¶
Authorise your machine with the Divio Control Panel.
divio login [OPTIONS] [TOKEN]
Options
-
--check
¶
Check for current login status.
Arguments
-
TOKEN
¶
Optional argument
project¶
Manage your projects.
divio project [OPTIONS] COMMAND [ARGS]...
configure¶
Associate a local project with a Divio cloud project.
divio project configure [OPTIONS]
dashboard¶
Open the project dashboard on the Divio Control Panel.
divio project dashboard [OPTIONS]
Options
-
--remote-id
<remote_id>
¶ Remote Project ID to use for project commands. Defaults to the project in the current directory using the configuration file.
deploy¶
Deploy project.
divio project deploy [OPTIONS] [STAGE]
Options
-
--remote-id
<remote_id>
¶ Remote Project ID to use for project commands. Defaults to the project in the current directory using the configuration file.
Arguments
-
STAGE
¶
Optional argument
deploy-log¶
View last deployment log.
divio project deploy-log [OPTIONS] [STAGE]
Options
-
--remote-id
<remote_id>
¶ Remote Project ID to use for project commands. Defaults to the project in the current directory using the configuration file.
Arguments
-
STAGE
¶
Optional argument
develop¶
Add a package ‘package’ to your local project environment.
divio project develop [OPTIONS] PACKAGE
Options
-
--no-rebuild
¶
Do not rebuild docker container automatically.
Arguments
-
PACKAGE
¶
Required argument
env-vars¶
Get and set environment vars.
WARNING: This command is experimental and may change in a future release.
divio project env-vars [OPTIONS]
Options
-
-s
,
--stage
<stage>
¶ Manage the cloud project’s environment variables.
-
--all
,
--custom
¶
–all shows automatically applied environment variables as well as user-specified variables.
-
--json
¶
-
--get
<get_vars>
¶ Get a specific environment variable.
-
--set
<set_vars>
¶ Set a specific custom environment variable
example: divio project env-vars set DEBUG False
-
--unset
<unset_vars>
¶ Remove an environment variable.
-
--remote-id
<remote_id>
¶ Remote Project ID to use for project commands. Defaults to the project in the current directory using the configuration file.
export¶
Export local database dump.
divio project export [OPTIONS] COMMAND [ARGS]...
db¶
Export a dump of your local database
divio project export db [OPTIONS] [PREFIX]
Arguments
-
PREFIX
¶
Optional argument
import¶
Import local database dump.
divio project import [OPTIONS] COMMAND [ARGS]...
db¶
Load a database dump into your local database.
divio project import db [OPTIONS] [PREFIX] [DUMP_PATH]
Arguments
-
PREFIX
¶
Optional argument
-
DUMP_PATH
¶
Optional argument
list¶
List all your projects.
divio project list [OPTIONS]
Options
-
-g
,
--grouped
¶
Group by organisation.
-
--json
¶
logs¶
View logs.
divio project logs [OPTIONS] [STAGE]
Options
-
--tail
¶
Tail the output.
-
--utc
¶
Show times in UTC/
-
--remote-id
<remote_id>
¶ Remote Project ID to use for project commands. Defaults to the project in the current directory using the configuration file.
Arguments
-
STAGE
¶
Optional argument
open¶
Open local or cloud projects in a browser.
divio project open [OPTIONS] [STAGE]
Options
-
--remote-id
<remote_id>
¶ Remote Project ID to use for project commands. Defaults to the project in the current directory using the configuration file.
Arguments
-
STAGE
¶
Optional argument
pull¶
Pull db or files from the Divio cloud environment.
divio project pull [OPTIONS] COMMAND [ARGS]...
db¶
Pull database the Divio cloud environment.
divio project pull db [OPTIONS] [STAGE] [PREFIX]
Options
-
--remote-id
<remote_id>
¶ Remote Project ID to use for project commands. Defaults to the project in the current directory using the configuration file.
Arguments
-
STAGE
¶
Optional argument
-
PREFIX
¶
Optional argument
media¶
Pull media files from the Divio cloud environment.
divio project pull media [OPTIONS] [STAGE]
Options
-
--remote-id
<remote_id>
¶ Remote Project ID to use for project commands. Defaults to the project in the current directory using the configuration file.
Arguments
-
STAGE
¶
Optional argument
push¶
Push db or media files to the Divio cloud environment.
divio project push [OPTIONS] COMMAND [ARGS]...
db¶
Push database to the Divio cloud environment..
divio project push db [OPTIONS] [STAGE] [PREFIX]
Options
-
-d
,
--dumpfile
<dumpfile>
¶ Specify a dumped database file to upload.
-
--noinput
¶
Don’t ask for confirmation.
-
--remote-id
<remote_id>
¶ Remote Project ID to use for project commands. Defaults to the project in the current directory using the configuration file.
Arguments
-
STAGE
¶
Optional argument
-
PREFIX
¶
Optional argument
media¶
Push database to the Divio cloud environment..
divio project push media [OPTIONS] [STAGE] [PREFIX]
Options
-
--noinput
¶
Don’t ask for confirmation.
-
--remote-id
<remote_id>
¶ Remote Project ID to use for project commands. Defaults to the project in the current directory using the configuration file.
Arguments
-
STAGE
¶
Optional argument
-
PREFIX
¶
Optional argument
setup¶
Set up a development environment for a Divio project.
divio project setup [OPTIONS] SLUG
Options
-
-s
,
--stage
<stage>
¶ Specify environment from which media and content data will be pulled.
-
-p
,
--path
<path>
¶ Install project in path.
-
--overwrite
¶
Overwrite the project directory if it already exists.
-
--skip-doctor
¶
Skip system test before setting up the project.
Arguments
-
SLUG
¶
Required argument
ssh¶
Establish SSH connection.
divio project ssh [OPTIONS] [STAGE]
Options
-
--remote-id
<remote_id>
¶ Remote Project ID to use for project commands. Defaults to the project in the current directory using the configuration file.
Arguments
-
STAGE
¶
Optional argument
status¶
Show local project status.
divio project status [OPTIONS]
stop¶
Stop the local project.
divio project stop [OPTIONS]
up¶
Start the local project (equivalent to: docker-compose up).
divio project up [OPTIONS]
update¶
Update the local project with new code changes, then build it.
Runs:
git pull docker-compose pull docker-compose build docker-compose run web start migrate
divio project update [OPTIONS]
Options
-
--strict
¶
A strict update will fail on a warning.
version¶
Show version info.
divio version [OPTIONS]
Options
-
-s
,
--skip-check
¶
Don’t check PyPI for newer version.
-
-m
,
--machine-readable
¶