Skip to main content

The Vallic CLI

Installing the command line, and forty commands for the things people do every week — deploying, shells, files, databases, backups, variables and domains.

The vallic command does from a terminal what the console does in a browser, and a few things only a terminal can: a shell in a container, a database streamed in or out, a local port onto a service.

Installing it

curl -fsSL https://raw.githubusercontent.com/Vallic/vallic-cli/main/installer.sh | bash
vallic login

vallic login opens a browser to sign you in. In CI, where there is no browser, sign in with a token from your account instead: vallic login --token. A token deploys and follows deploys and nothing else — see What a token can do. Shell and file commands also need an SSH key on your account — see Shell access.

vallic self-update replaces the binary with the version the platform publishes.

Which project and environment

Inside a checkout of your project, the CLI works out the project from the git remote and the environment from the branch, so most commands need neither. Elsewhere, name the environment and add --project with the project's machine name:

vallic ssh staging --project acme-site

A branch that matches no environment is refused rather than sent to production.

Examples

Getting set up

# Who the stored credential belongs to
vallic whoami

# Record which project this checkout is, once, outside a clone of its repository
vallic link acme-site

# What this checkout points at: project, environment, branch, last deploy
vallic status

# Check vallic.yaml before committing it
vallic validate --against production

Environments

# Every environment of the project, and one in full
vallic env list
vallic env info staging

# A development environment from a branch, deployed on every push
vallic env create feature/checkout --type development --auto-deploy

# Point staging at another branch
vallic env source staging --branch release/2.0

# Its address, or open it in the browser
vallic url staging --open

Deploying

# Deploy what staging's branch points at, and wait for the result
vallic deploy staging --wait

# Build and deploy in one go
vallic build staging --deploy

# The last five builds, and deploy an earlier one
vallic release list production --limit 5
vallic deploy production --release 41 --wait

# Deploy what is already live again, or put the previous release back
vallic redeploy production --wait
vallic rollback production --wait

What the platform has been doing

# Recent deploys and builds, and one task's output as it runs
vallic activity list production --type deploy,build
vallic activity log 1234 --follow

A shell and commands

# A shell in the site's container
vallic ssh staging

# One command, then back
vallic ssh staging -- ls -la /mnt/files/public

# drush, in a Drupal project
vallic drush staging -- cr
vallic drush production -- updb -y

An environment on several machines is reached through its front, which carries the login on to the machine you name; without --machine it goes where the site runs. --container opens a worker's container instead of the site's:

vallic ssh production --machine web-2
vallic ssh production --container worker-queue-1 -- php artisan queue:failed

Files

# Public files up, and back down
vallic mount upload staging ./files
vallic mount download production ./files-from-production

# Private files, and a mount vallic.yaml declares
vallic mount upload staging ./private --area private
vallic mount upload staging ./exports --area mounts/exports

# Every area an environment has, by the name --area takes
vallic mount list staging

Databases

# A copy of production's database, then onto staging
vallic db export production > production.sql
vallic db import staging < production.sql

# An interactive prompt
vallic sql staging

# A local port onto the database, for a desktop client
vallic tunnel staging db --port 3307

Backups

# The database backups production has, and take one now
vallic backup list production --kind database
vallic backup create production --kind database

# A copy of one to keep, and put the newest back over the environment
vallic backup download 42 production --wait
vallic backup restore latest staging --kind database

backup restore overwrites the environment with its own backup, and only that environment's: a backup goes back where it was taken and nowhere else. On a protected environment an owner has to confirm it in a browser.

Variables

# What is in effect for staging, including the project's
vallic var list staging

# Set a secret, read a value, and restart the site so it takes effect
vallic var set PAYMENT_KEY sk_live_example production --secret
vallic var get API_URL staging
vallic var apply production

Domains

# Claim a hostname, then check the DNS records it printed
vallic domain add shop.example.com production
vallic domain verify shop.example.com production

Every command has --help, with more examples than these.

Next

  • Shell access — keys, plain SSH, and what the shell can reach
  • Variables — scopes, secrets and when they take effect