duckstring catchment
Commands for creating, registering, starting and maintaining Catchments. Registrations are stored in ~/.duckstring/config.toml.
-c / --catchment selects a registered Catchment; see Choosing a Catchment.
Registering and starting
init
duckstring catchment init --name NAME [options]
Creates a Catchment on this machine, registers it under NAME, offers to make it the default, and starts the server in the foreground. Running it again with an existing name updates the registration.
| Option | Default | Description |
|---|---|---|
--name, -n | prompted | Name to register the Catchment under. |
--host | 127.0.0.1 | Address to bind. |
--port, -p | 7474 | Port to listen on. The web UI is served at the same address. |
--root | ~/.duckstring/{name} | Directory for the Catchment's state (its database, run ledgers and working databases). Must be a local path. |
--data-root | under --root | Where published tables are stored: a local path or an object-store URI (s3://, gs://, az://, abfss://, /Volumes/...). Credentials go in the URI query as ${env:NAME}. See Formats. |
--state-backup | none | An object-store URI or path to copy state checkpoints to, so a Catchment on a disposable machine can recover its state. |
--checkpoint-every | 60s | How often the state database is copied to --state-backup. |
--key | none | A single full-access API key the server requires. The registration stores it so the CLI sends it. |
--generate-key | off | Generate three API keys (read, demand, full), print them once, and store the full key in the registration. Can't be combined with --key. |
--header | none | A header sent with every request to this Catchment, as 'Name: value'. Repeatable. |
--yes, -y | off | Make it the default Catchment without asking. |
--no-start | off | Register (and generate keys) without starting the server, for when a process supervisor will run catchment start. |
Without --key or --generate-key, the Catchment requires no authentication.
start
duckstring catchment start NAME
Starts the server for a Catchment registered on this machine, with the settings it was registered with.
connect
duckstring catchment connect --name NAME --path URL [--key KEY] [--header 'Name: value']
[--header-command 'Name: command'] [--yes]
Registers a Catchment running elsewhere.
| Option | Description |
|---|---|
--name, -n | Name to register it under. |
--path | The Catchment's URL. |
--key | An API key to send with every request. |
--header | A header to send with every request, as 'Name: value'. Repeatable. Use it when a hosting platform authenticates requests, for example 'Authorization: Bearer ...'. |
--header-command | A header whose value a shell command prints, as 'Name: command'. Repeatable. For a platform whose tokens expire, such as a Databricks App or a private Cloud Run service. JSON with an access_token (as databricks auth token prints) is sent as Bearer <token>, and so is a bare token for an Authorization header. The value is kept until shortly before the token expires (read from a JWT's exp or the JSON's expiry), then the command runs again; a token the Catchment refuses is fetched again once. Without a known expiry the command runs for every request. A Duct stores only the value at the time it was made. |
--yes, -y | Make it the default without asking. |
list
duckstring catchment list
Lists registered Catchments and marks the default.
set-default
duckstring catchment set-default NAME
Makes NAME the Catchment used when -c is omitted.
disconnect
duckstring catchment disconnect NAME [--purge]
Removes a registration. For a Catchment on this machine, asks whether to delete its data directory; --purge deletes it without asking.
Configuration
settings
duckstring catchment settings [-c NAME] [--data-root URI]
Shows the Catchment's cloud configuration, including whether cloud compute is enabled. With --data-root, sets where published tables are stored (s3://, gs://, az://, abfss:// or a shared path). The data root can only be changed before any Pond has published data. The data root's scheme picks the Catchment's cloud (s3:// AWS, az:// or abfss:// Azure, gs:// Google Cloud), and cloud compute is enabled once that cloud's credentials are available to the Catchment. The output's compute line says whether it is, and why not.
rotate-keys
duckstring catchment rotate-keys [-c NAME] [--level LEVEL]... [--yes]
Replaces the Catchment's API keys and prints the new ones once. The old key for each replaced level stops working. Running Ducks are unaffected, since they use a separate internal token. Needs a full-access key in the registration, which is updated with the new full key.
| Option | Description |
|---|---|
--level | read, demand or full. Repeatable. Defaults to all three. |
--yes, -y | Skip the confirmation. |
Records and Media
Where Apps' Records and Media live. Both settings can only change while no App line holds data there; after that, move copies everything to a new place. Showing the settings needs read access, and changing them or moving needs full access.
records
duckstring catchment records [-c NAME] [--use TARGET] [--memory SIZE] [--listen ADDRESS] [--host NAME]
[--tls-cert PATH --tls-key PATH] [--reader-url]
Shows where Records live and, for the Catchment's own PostgreSQL, whether it's running, its PostgreSQL version, memory, listen address and TLS certificate. With options, changes them.
| Option | Description |
|---|---|
--use | managed, a PostgreSQL the Catchment runs (the default, started the first time an App needs it; install it with duckstring install postgres), or a postgres:// URI whose user has CREATEROLE and CREATEDB. Credentials as ${secret:NAME} or ${env:NAME}. |
--memory | The managed PostgreSQL's memory, such as 1GB, set aside from the memory Pond Runs share. Default 512 MB. |
--listen | The managed PostgreSQL's listen address. Default 127.0.0.1. Connections from beyond the Catchment's machine must use TLS. |
--host | The address other machines reach it at, used in their connection URLs and the self-signed certificate. |
--tls-cert, --tls-key | A certificate and key to serve TLS with, as paths on the Catchment's machine. Without them, a self-signed certificate is made, whose SHA-256 fingerprint the command shows. |
--reader-url | Print a read-only connection URL for a client on another machine, such as a BI tool. Needs full access. |
records move
duckstring catchment records move TARGET [-c NAME] [--postgres-version N] [--yes]
Moves every App line's Records to TARGET, managed or a postgres:// URI. Apps with Records answer 503, and Spouts into Records wait, while the database is copied with pg_dump and restored. Row counts are compared, the Catchment switches, and the old store is deleted. A failure before the switch leaves the old store as it was. With --postgres-version, moves the managed PostgreSQL to that major version, installed first with duckstring install postgres --postgres-version N. Asks for confirmation unless --yes is given, and prints progress until it finishes.
media
duckstring catchment media [-c NAME] [--use TARGET]
Shows where Media lives. --use sets it: local, the Catchment's own state directory (the default), or an object-store prefix (s3://, gs://, az:// or abfss://), with credentials as for a data root.
media move
duckstring catchment media move TARGET [-c NAME] [--yes]
Moves every App line's Media to TARGET. Files are copied while Apps run; then Apps with Media stop while what changed is copied, the listings are compared, the Catchment switches, and the old files are deleted. Asks for confirmation unless --yes is given.
State
download
duckstring catchment download [-c NAME] [--path DIR] [--yes]
Downloads the Catchment's state directory: its database, deployed code, run ledgers and working databases. Use it to back up a Catchment, or to carry its state across a platform redeploy. Shows the size and asks for confirmation first. Secrets are never included, nor are Pond environments, which are rebuilt when needed. When the Catchment has an external data root, the published tables are not included, since they're already stored there. An App's state is included only as its download command writes it, and its logs aren't included. Records are included as a pg_dump, which a new Catchment's own PostgreSQL restores when it first starts, and Media is included as files.
Download while nothing is running: the working databases are copied as they are.
| Option | Default | Description |
|---|---|---|
--path | ./.duckstring | Where to write the state. The default is the path a platform-hosted Catchment reads on start, so the download can go straight into a deploy bundle. |
--yes, -y | off | Skip the size confirmation. |
restore
duckstring catchment restore --from URI [--path DIR] [--yes]
Restores state from a --state-backup location into a local directory, to seed a new machine by hand. A Catchment started with a state backup configured does this automatically when its state directory is empty.
| Option | Default | Description |
|---|---|---|
--from | The backup location. | |
--path | ./.duckstring | The state directory to restore into. |
--yes, -y | off | Skip the overwrite confirmation. |
reset
duckstring catchment reset [-c NAME] [--clear-history] [--yes]
Returns every Pond to its freshly deployed state: deletes all published data and working databases and resets freshness. Keeps deployed code, Refreshes, windows, Spouts, alerts, secrets and keys. Every Duck restarts.
| Option | Description |
|---|---|
--clear-history | Also delete all run history. |
--yes, -y | Skip the confirmation. |
Ducts
A duct lets a Catchment consume Ponds from another Catchment. Each consumed Pond appears locally as a Pond Draw, which copies its data across when it changes and passes demand back upstream. Ducts are configured on the consuming Catchment, and the upstream Catchment must be registered with the CLI.
A duct holds the upstream Catchment's credentials, so only connect Catchments that trust each other fully.
duct create
duckstring catchment duct create UPSTREAM [-c NAME] [--sync]
Creates a duct from the registered Catchment UPSTREAM into the consuming Catchment. --sync also draws every Pond the upstream exposes.
duct add
duckstring catchment duct add UPSTREAM POND [-c NAME] [--major N]
Draws one upstream Pond over the duct. --major (default 1) picks its major line.
duct remove
duckstring catchment duct remove UPSTREAM POND [-c NAME] [--major N]
Stops drawing a Pond and removes its Pond Draw.
duct sync
duckstring catchment duct sync UPSTREAM [-c NAME]
Draws every Pond the upstream currently exposes.
duct ls
duckstring catchment duct ls [-c NAME]
Lists ducts and the Ponds each one draws.
duct destroy
duckstring catchment duct destroy UPSTREAM [-c NAME]
Removes a duct and every Pond Draw it created.
duct open and duct close
duckstring catchment duct open POND [-c NAME] [-m N | -v VERSION]
duckstring catchment duct close POND [-c NAME] [-m N | -v VERSION]
Run on the upstream Catchment. open marks a Pond as accepting demand from other Catchments, and close removes the mark.