Quantum CLI Reference

quantum-cli #

A cli tool for Planetary Quantum

Usage #

quantum-cli [GLOBAL OPTIONS] command [COMMAND OPTIONS] [ARGUMENTS...]

Global Options #

  • –host: The quantum console (default “https://console.planetary-quantum.com”) [$QUANTUM_HOST, $PORTAINER_HOST]
  • –user, -u: The quantum user [$QUANTUM_USER, $PORTAINER_USER]
  • –password, -p: The quantum password [$QUANTUM_PASSWORD, $PORTAINER_PASSWORD]
  • –help, -h: show help
  • –version, -v: print the version

Files #

  • ~/.config/quantum/env: optional file to set default env vars, e.g.:

      QUANTUM_USER=someone
      QUANTUM_PASSWORD=somepassword
    
  • ~/.cache/quantum/jwt.json: login token cache

  • .quantum: YAML config file for stack update/create, inside the project directory. Full syntax described in quantum-cli validate --help

Commands #

validate #

Validate .quantum and Docker compose files

  • –project: Location of the project (default: current directory)

The .quantum file that’s validated here is in effect during ‘stack create’ and ‘stack update’.It’s a YAML file that in its most basic form can be used to specify the stack/compose file:

---
version: "1.0"
compose: a-different-stack-file.yml

It’s also possible to specify different “environments” (see the –environment flag in stack create/update):

 ---
 version: "1.0"
 compose: default-stack-file.yml
 environments:
   - name: staging
     compose: staging-stack-file.yml
   - name: production
     compose: production-stack-file.yml

Additionally, it can be used to trigger image build and publishing steps before deploying the stack:

 ---
 version: "1.0"
 build: docker build -t myregistry.example.com/my-image:latest .
 publish: docker push myregistry.example.com/my-image:latest
 compose: default-stack-file.yml

The ‘publish’ and ‘build’ steps can also optionally get overridden per environment:

 ---
 version: "1.0"
 compose: default-stack-file.yml
 build: make build-image
 environments:
    # implicitly, this also has the "build" step defined above
    - name: local
      compose: local-stack-file.yml
    # this uses its own build step
    - name: staging
      build: make build-staging-image
      publish: make push-staging-image
      compose: staging-stack-file.yml
    - name: prod
      publish: make push-prod-image
      compose: prod-stack-file.yml

endpoints #

Look up endpoints

Aliases: endpoint, e, ep

endpoints list, ls #

List endpoints

stacks #

Commands about stacks

Aliases: stack, s

stacks create, deploy #

Create a new stack. See also stack update --create.

  • –endpoint: The endpoint/cluster to use [$QUANTUM_ENDPOINT, $PORTAINER_ENDPOINT]
  • –stack: The name of the stack [$QUANTUM_STACK]
  • –project: Location of the project (default: current directory)
  • –environment: The environment to be used from your .quantum file
  • –wait: Wait until the stack is successfully deployed
  • –no-validate: Don’t run validate before deploying (not recommended)
  • –no-pre-pull: Don’t try to pull images before deploying (not recommended)

Uses the .quantum file, if it exists. See quantum-cli validate --help for details.

stacks list, ls #

List stacks

  • –endpoint: The endpoint/cluster to use [$QUANTUM_ENDPOINT, $PORTAINER_ENDPOINT]

stacks update #

Update a stack

  • –endpoint: The endpoint/cluster to use [$QUANTUM_ENDPOINT, $PORTAINER_ENDPOINT]
  • –stack: The name of the stack [$QUANTUM_STACK]
  • –project: Location of the project (default: current directory)
  • –environment: The environment to be used from your .quantum file
  • –create: Create the stack if it doesn’t exist, instead of reporting an error
  • –wait: Wait until the stack is successfully deployed
  • –no-validate: Don’t run validate before deploying (not recommended)
  • –no-pre-pull: Don’t try to pull images before deploying (not recommended)

Uses the .quantum file, if it exists. See quantum-cli validate --help for details.

stacks remove, rm #

Remove a stack

  • –endpoint: The endpoint/cluster to use [$QUANTUM_ENDPOINT, $PORTAINER_ENDPOINT]
  • –stack: The name of the stack [$QUANTUM_STACK]
  • –force: Don’t ask for confirmation

exec, shell, ssh #

Open a shell on a container, or run other commands

  • –endpoint: The endpoint/cluster to use [$QUANTUM_ENDPOINT, $PORTAINER_ENDPOINT]
  • –stack: The name of the stack [$QUANTUM_STACK]
  • –service: The name of the service [$QUANTUM_SERVICE]
  • –slot: Slot when using –stack/–service to select the container (default “-1”)
  • –container: ID of the container
  • –command, -c: The command to run (default “sh”)
  • –command-user: The user to run the command as

Basic usage: quantum-cli exec –endpoint my-node –stack my-stack –service my-service See also: quantum-cli ps

ps #

List tasks of an endpoint or stack or service

  • –endpoint: The endpoint/cluster to use [$QUANTUM_ENDPOINT, $PORTAINER_ENDPOINT]
  • –stack: The name of the stack [$QUANTUM_STACK]
  • –service: The name of the service [$QUANTUM_SERVICE]
  • –all: Show all tasks, including non-running ones

selfupdate, self-update #

Update quantum-cli to the latest version

migration, migrate #

Migrate a stack including volumes + configs from one endpoint to another

  • –source-endpoint: The source endpoint to migrate from [$QUANTUM_MIGRATION_ENDPOINT_SOURCE]
  • –stack: The name of the stack [$QUANTUM_STACK]
  • –target-endpoint: The endpoint to migrate to [$QUANTUM_MIGRATION_ENDPOINT_TARGET]
  • –target-stack: The full name of the target stack to clone/migrate to [$QUANTUM_MIGRATION_TARGET_STACK]
  • –node: For multi-node endpoints, please supply a node [$QUANTUM_MIGRATION_NODE]
  • –up: Start the target stack when deploying, the default is to copy everything scaled down
  • –force: Don’t ask for confirmation

help, h #

Shows a list of commands or help for one command