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 running git --version.

  • docker-client checks that the Docker client is available by running docker --version.

  • docker-compose - checks that Docker Compose is available by running docker-compose --version.

  • docker-server - checks that a command can be executed in a container by running docker 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.

-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

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 to use for project commands. Defaults to the project in the current directory using the configuration file.

deploy#

Deploy application.

divio app 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 app 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 application environment.

divio app 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 app env-vars [OPTIONS]

Options

-s, --stage <stage>#

Manage the cloud application’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 app 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 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.

--json#
logs#

View logs.

divio app 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 applications in a browser.

divio app 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 app pull [OPTIONS] COMMAND [ARGS]...
db#

Pull database the Divio cloud environment.

divio app pull db [OPTIONS] [STAGE] [PREFIX]

Options

--keep-tempfile#

Keep the temporary file with the data.

--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 app 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 app push [OPTIONS] COMMAND [ARGS]...
db#

Push database to the Divio cloud environment..

divio app 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 app 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 application.

divio app setup [OPTIONS] SLUG

Options

-s, --stage <stage>#

Specify environment from which media and content data will be pulled.

-p, --path <path>#

Install application in path.

--overwrite#

Overwrite the application directory if it already exists.

--skip-doctor#

Skip system test before setting up the application.

Arguments

SLUG#

Required argument

ssh#

Establish SSH connection.

divio app 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 application status.

divio app status [OPTIONS]
stop#

Stop the local application.

divio app stop [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.

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

version#

Show version info.

divio version [OPTIONS]

Options

-s, --skip-check#

Don’t check PyPI for newer version.

-m, --machine-readable#