Divio CLI¶

divio-cli is a Python-based command line application, and can be installedvia pip:

  1. pip install divio cli

The divio-cli source code is availableon GitHub.

It’s also available:

  • in the Divio Shell
  • at the bash prompt in Divio Cloud web containers

Important

When using the divio-cli other than in a Divio Shell or web container, you will need toinstall the aldryn-client as well to allow the divio-cli to perform certain operationsrelated to addons. To install:

  1. pip install aldryn-client

divio-cli command reference¶

The divio-cli is invoked with the command divio.

Its syntax is:

  1. divio [OPTIONS] COMMAND [ARGS] ...

Options¶

Options are:

|-d, —debug|Drop into the debugger if the command execution raises an exception.
|—help|Show a help message (most commands also include help messages of their own)

Commands¶

addon¶

The addon command is used when in the directory of a local addon.

It take one of three commands as an argument:

register
Registers an addon with the Divio Cloud addons system
upload
Uploads an addon to the Divio Cloud
validate
Validates basic aspects of an addon’s configuration

backup¶

The backup command manages project backups.

It take one command as an argument:

decrypt

Decrypts an encrypted backup file.

decrypt takes three arguments: KEY BACKUP DESTINATION.

Example:



  1. divio backup decrypt key backup destination



boilerplate¶

The boilerplate command is used when in the directory of a localboilerplate.

It take one of two commands as an argument:

upload
Uploads a boilerplate to the Divio Cloud
validate
Validates basic aspects of an boilerplates’s configuration

doctor¶

The doctor command checks that your environment is correctly configured.

  1. divio-cloud-projects divio doctor
  2. Verifying your system setup
  3. Login
  4. Git
  5. Docker Client
  6. Docker Compose
  7. Docker Engine Connectivity
  8. Docker Engine Internet Connectivity
  9. Docker Engine DNS Connectivity

login¶

Authorise your machine with the Divio Cloud. divio login opens your browserat https://control.divio.com/account/desktop-app/access-token/, where you cancopy an access token to paste into the prompt.

project¶

The project command helps manage projects locally and on the Cloud.

Its general syntax is divio project [OPTIONS] COMMAND [ARGS]…

Except where specifically indicated below, the project command is specificto a particular project and must be executed within an existing projectdirectory.

cheatsheet
Opens the project’s cheatsheet page in the Control Panel.
dashboard
Opens the project’s Dashboard in the Control Panel.
deploy

Deploys the project’s Test or Live servers.

deploy takes test or live as an argument, for example:



  1. divio project deploy test




Options:

|—backup|Take a backup before deploying

deploy-log

Returns the latest deployment log for the project’s Test or Live servers.

deploy-log takes test or live as an argument, for example:



  1. divio project deploy-log test



develop

Adds a package in development to the project.

Usage: divio project develop [OPTIONS] PACKAGE, where PACKAGE isthe name of the addon package.

Options:

|—no-rebuild|Don’t rebuild the Docker container



Note

What divio project develop <addon> actually does is:

- checks addons-dev for the named addon
- puts the addon on the Python path
- adds the addon to requirements.in, as -e
/app/addons-dev/tutorial-django-debug-toolbar
- adds any dependencies
- runs docker-compose build web.
env-vars

Get and set environment variables. Bydefault, these operations work on the Test server (e.g. divio project
env-vars —set SOMEKEY somevalue
will be applied to the Test server,and will appear there).

Note that this command applies only to the Live and Test servers, not the local server. See Localenvironment variables.

Usage: divio project env-vars [OPTIONS]

Options:

|-s, —stage TEXT
| |Get data from sever (test or live)
|—all, —custom
| |Show all or only custom (the default) variables
|—json|Use JSON output
|—get|Get a specific environment variable (get VARIABLE)
|—set|Set a specific custom environment variable (set VARIABLE VALUE)
|—unset|Unset an environment variable (unset VARIABLE)
|—help|Show a help message

export

Exports the local database to localdb.sql.

Usage: divio project export db
import

Imports a database dump file into the local database.

Usage: divio project import db [path]

If the path argument is not supplied, it will expect a filelocal_db.sql.
list

Lists your Divio Cloud projects.

_Not specific to a particular project.

live
Opens the project’s Live site in the browser.
open
Open the local project’s site in the browser.
pull

Pulls the database or media files from the Divio Cloud.

Takes a required argument, db or media, followed optionally bytest or live (if not specified, defaults to test), and by—remote-id <project id> to pull from another project.
push

Pushes the database or media files to the Divio Cloud.

Takes a required argument, db or media, followed optionally bytest or live (if not specified, defaults to test), and by—remote-id <project id> to push to another project.
setup

Replicates and builds a Divio Cloud project locally.

Takes a single argument, the slug of the project.

Can be run outside a project folder.
status
Shows the status of the local project, shutting down its containers.
stop
Stops the local project (if it is running).
test
Opens the project’s Test site in the browser.
up
Starts up the local project.
update

Updates the local project with new code changes from the Cloud, then builds it. Runs:



  1. git pull
    docker-compose pull
    docker-compose build
    docker-compose run web start migrate



version¶

Returns version information about the divio-cli.

原文: http://docs.divio.com/en/latest/reference/divio-cli.html