Skip to main content

Environment Variables

These variables are read by the Catchment process, and passed on to its Ducks where relevant. Most have an equivalent CLI option on catchment init, which takes precedence when given. AWS credentials use the standard AWS_* variables, or AWS_* entries in the secret store. Azure credentials use Azure's own variables (such as AZURE_TENANT_ID, AZURE_CLIENT_ID and AZURE_CLIENT_SECRET) or AZURE_* secrets, and Google credentials use GOOGLE_APPLICATION_CREDENTIALS or a service-account key stored as the GOOGLE_CREDENTIALS secret. A Google Cloud Storage or Azure data root also reads variables such as AZURE_STORAGE_ACCOUNT_NAME; see Data root URIs.

Catchment​

VariableDefaultDescription
DUCKSTRING_STATE_ROOT./.duckstringThe state directory, for a Catchment started through the ASGI entry point (duckstring.catchment.asgi). Must be a local path. DUCKSTRING_ROOT is an alias.
DUCKSTRING_DATA_ROOTunder the state directoryWhere published tables are stored. See Data root URIs.
DUCKSTRING_STATE_BACKUP_URInoneWhere state checkpoints are copied, so a Catchment on disposable storage can recover. A Catchment starting with an empty state directory restores from it.
DUCKSTRING_CHECKPOINT_INTERVAL60sHow often the state database is copied to the backup.
DUCKSTRING_API_KEYnoneA single full-access API key. Leave unset when a hosting platform authenticates requests.
DUCKSTRING_CATCHMENT_NAMEnoneA display name recorded for the Catchment.
DUCKSTRING_CATCHMENT_URLthe bind addressThe address local Ducks use to reach the Catchment. Normally unnecessary: when unset, the Catchment learns its address from the first request it serves.
DUCKSTRING_CATCHMENT_PUBLIC_URLnoneThe address remote Ducks use to reach the Catchment. Needed when cloud Ducks can't reach the bind address and the automatic relay isn't used.
DUCKSTRING_CATCHMENT_AUDIENCEnoneFor a private Catchment on Cloud Run behind a custom domain: the service's run.app URL, which Ducks use as the audience of the Google identity token they send. Without it, Ducks send a token only when the Catchment's address is itself a run.app URL.
DUCKSTRING_FORCE_TAKEOVERoff1 lets a Catchment start on a data root that another live Catchment has claimed. Only for recovering from a Catchment that is known to be gone.
DUCKSTRING_MIN_FREE_BYTES1073741824 (1 GiB)When free disk space falls below this, the working databases of idle Ponds are removed, least recently used first, and rebuilt when next needed. 0 disables this.

Run only one Catchment process against a state directory, and only one Catchment against a data root.

Data plane​

VariableDefaultDescription
DUCKSTRING_COMPACT_THRESHOLD268435456 (256 MiB)The size a merge Trickle's change log must reach before it's folded into the table's base. Can be set per table with merge_table(compact_threshold=...).
DUCKSTRING_TIER_FILES64How many consecutive small files of a Trickle table are combined into one. Each Run that changes a Trickle table publishes a file, and combining them keeps the file count from growing with the number of Runs. Combined files are capped at the table's compaction threshold. Below 2, files are never combined.
DUCKSTRING_S3_ENDPOINTnoneAn S3-compatible endpoint, such as MinIO, for the data root. Equivalent to ?endpoint= on the URI.
DUCKSTRING_VOLUMESautoHow a /Volumes/... data root or state backup is reached: mount uses it as a local path, api goes through the Databricks Files API. auto uses the Files API where /Volumes isn't mounted, as in a Databricks App.

Databricks​

These are read wherever Duckstring reaches a Databricks workspace: a /Volumes/... data root or state backup, a databricks:// Spout, and Ripple code reading with duckstring.databricks, which runs in a Duck. Ducks on the Catchment's machine inherit the Catchment's environment. A Databricks App sets the host and its own service principal's credentials.

VariableDefaultDescription
DATABRICKS_HOSTnoneThe workspace URL.
DATABRICKS_TOKENnoneA personal access token. Used first when set.
DATABRICKS_CLIENT_ID, DATABRICKS_CLIENT_SECRETnoneA Databricks service principal's OAuth credentials, used when there's no token. On Azure Databricks without either, a Microsoft Entra token from the process's Azure identity is used.
DUCKSTRING_DATABRICKS_WAREHOUSEnoneThe SQL warehouse id databricks.table reads through when a table can't be read from its storage.
DATABRICKS_WAREHOUSE_IDnoneUsed when DUCKSTRING_DATABRICKS_WAREHOUSE is unset, and as a databricks:// Spout's warehouse when its destination doesn't name one.
DUCKSTRING_INPUT_CACHEthe system's temporary directoryWhere duckstring.databricks keeps the files it fetches through the Files API and the results it downloads from a warehouse, under duckstring-inputs/. Holds about one copy of each input a Pond reads this way.

Ducks​

VariableDefaultDescription
DUCKSTRING_MEMORY_LIMITDuckDB's defaultMemory limit for each Duck's DuckDB, such as 12GB. Also sets the size at which the Flock takes over a computation. Set it to about 80% of the Duck's memory. On the Catchment's own machine, the memory slots below set each Duck's limit instead.
DUCKSTRING_RUN_SLOTS4How many Ducks run at once on the Catchment's own machine. Each gets an equal share of the memory budget as its DuckDB limit; a Pond that would run beyond them waits, in the order it became ready, and shows as waiting for memory. A Duck running alone may take the spare slots, keeping one for another Pond. A Run that runs out of memory is retried once with every slot, without counting against its failure budget. Each running App instance sets its [pond] memory aside from the budget first, as does the Catchment's own PostgreSQL for Records, and the slots share the rest. 0 turns this off, leaving each Duck to size itself.
DUCKSTRING_MEMORY_BUDGET80% of the machine's memory (or the container's limit, when lower), less 2 GBThe memory the slots divide, such as 100GB, less what running Apps set aside.
DUCKSTRING_IDLE_MEMORY256MBThe DuckDB limit a Duck drops to when it has nothing running, which releases what it was caching.
DUCKSTRING_DUCK_LAUNCHERbuilt inmodule:Class of a custom launcher that replaces how Ducks are started.
DUCKSTRING_DUCK_ORPHAN_MINUTES60How long an idle Duck goes without contact from its Catchment before it exits, so a Duck whose Catchment is gone for good doesn't run indefinitely. A Duck mid-run finishes first. 0 keeps Ducks waiting forever. Set it on the Catchment, which passes it to every Duck, including cloud ones. Pool machines aren't affected.
DUCKSTRING_DISABLE_DUCKSoffStart no Ducks at all. For testing the Catchment on its own.
DUCKSTRING_DISCOVER_TIMEOUT300Seconds a deploy waits for the Pond's code to load while its Ripples are discovered.

Apps​

VariableDefaultDescription
DUCKSTRING_APP_START_TIMEOUT60Seconds a request that starts an App waits for the App to be ready. Past that, the request gets a 503, and the start counts as a failed one.
DUCKSTRING_APP_REMOTE_START_TIMEOUT900Seconds an instance on other compute has to become ready, since its machine boots and builds the App's environment first. See Scaling Apps.
DUCKSTRING_APP_SCALERbuilt inmodule:Class of a scaler that replaces how the Catchment decides an App's number of instances. See Scaling Apps.
DUCKSTRING_PG_BINfoundThe bin directory of the PostgreSQL server the Catchment runs for Records. Without it, the server duckstring install recorded is used, else one in the usual places for Homebrew, Postgres.app and the PostgreSQL packages, else one on PATH.
DUCKSTRING_RECORDS_TLS_CERT, DUCKSTRING_RECORDS_TLS_KEYnoneA certificate and key for the Catchment's own PostgreSQL to serve TLS with, when catchment records --tls-cert isn't set.

The variables an App's own process receives, such as PORT and DUCKSTRING_APP_PATH, are listed under [app].

Serving​

VariableDefaultDescription
DUCKSTRING_SERVE_PG_PORTnoneServe the catalog over the Postgres wire protocol on this port.
DUCKSTRING_SERVE_PG_TLS_CERTnoneA PEM certificate (or chain) for the Postgres wire. With it, the server accepts only encrypted connections.
DUCKSTRING_SERVE_PG_TLS_KEYthe certificate fileThe PEM private key for DUCKSTRING_SERVE_PG_TLS_CERT, when it's in a file of its own.
DUCKSTRING_SERVE_FLIGHT_PORTnoneServe the catalog over Arrow Flight on this port, with the SQL as the ticket. Needs pyarrow with Flight support.
DUCKSTRING_SERVE_HOST127.0.0.1Address both servers bind to. When exposing them, restrict network access, give the Postgres wire a certificate, and put TLS in front of Flight.

Flock​

Set these on the Catchment. It sends them to each Duck with every run, together with any credentials the engine needs, so Ducks in the cloud need no Flock settings of their own. See Offloading Large Recomputes.

VariableDefaultDescription
DUCKSTRING_FLOCK_MODEoffCatchment default for [flock] mode.
DUCKSTRING_FLOCK_ENGINEthe first configuredCatchment default engine: motherduck, motherduck/<profile>, starrocks, databricks, bigquery, athena, or module:Class. Unset, the first of motherduck, starrocks, databricks, bigquery and athena that is configured. An engine that can't be loaded turns the Flock off.
DUCKSTRING_FLOCK_OOM_POLICYfail_upCatchment default for [flock] oom_policy.
DUCKSTRING_FLOCK_ACCEPTCatchment default for [flock] accept, comma-separated.
DUCKSTRING_FLOCK_MIN_ROWSfrom DUCKSTRING_MEMORY_LIMITThe row count above which upgrade mode sends a computation to the Flock up front.
DUCKSTRING_FLOCK_VERIFY_KEYS1000How many keys of a StarRocks, Databricks, BigQuery or Athena result are recomputed in the Duck and compared before it's used. 0 turns verification off.
DUCKSTRING_FLOCK_MOTHERDUCK_DATABASEduckstring_flockThe MotherDuck database that sources are uploaded to for a job.
DUCKSTRING_FLOCK_STARROCKS_HOSTStarRocks frontend host.
DUCKSTRING_FLOCK_STARROCKS_PORT9030StarRocks MySQL-protocol port.
DUCKSTRING_FLOCK_STARROCKS_USERStarRocks user. The password is the secret STARROCKS_PASSWORD.
DUCKSTRING_FLOCK_STARROCKS_WAREHOUSEWarehouse to run in.
DUCKSTRING_FLOCK_STARROCKS_SCRATCHS3 prefix for staged sources and results.
DUCKSTRING_FLOCK_STARROCKS_REGIONRegion of the scratch bucket.
DUCKSTRING_FLOCK_STARROCKS_S3_ENDPOINTThe scratch bucket's endpoint as StarRocks sees it, for an S3-compatible store.
DUCKSTRING_FLOCK_STARROCKS_TIMEOUT900Seconds a job may run on StarRocks, including a suspended warehouse resuming.
DUCKSTRING_FLOCK_DATABRICKS_HOSTDATABRICKS_HOSTDatabricks workspace URL.
DUCKSTRING_FLOCK_DATABRICKS_WAREHOUSESQL warehouse id.
DUCKSTRING_FLOCK_DATABRICKS_VOLUMEUnity Catalog Volume path for staged sources, /Volumes/<catalog>/<schema>/<volume>, optionally with a directory.
DUCKSTRING_FLOCK_DATABRICKS_TIMEOUT900Seconds a job may run on Databricks, including the warehouse starting.
DUCKSTRING_FLOCK_BIGQUERY_DATASETBigQuery dataset for temporary tables, in the scratch bucket's location.
DUCKSTRING_FLOCK_BIGQUERY_SCRATCHgs:// prefix for staged sources and results.
DUCKSTRING_FLOCK_BIGQUERY_PROJECTthe credentials' projectProject jobs run in.
DUCKSTRING_FLOCK_BIGQUERY_LOCATIONThe dataset's location.
DUCKSTRING_FLOCK_BIGQUERY_TIMEOUT900Seconds a job may run on BigQuery.
DUCKSTRING_FLOCK_ATHENA_WORKGROUPAthena workgroup.
DUCKSTRING_FLOCK_ATHENA_DATABASEAthena database.
DUCKSTRING_FLOCK_ATHENA_SCRATCHS3 location for staged sources and Athena results.
DUCKSTRING_FLOCK_ATHENA_REGIONAthena region.

The engines' credentials are secrets (duckstring secret set), sent with each run only while the Pond's Flock is on: MOTHERDUCK_TOKEN (or MOTHERDUCK_TOKEN_<PROFILE> for motherduck/<profile>), STARROCKS_PASSWORD, STARROCKS_S3_ACCESS_KEY and STARROCKS_S3_SECRET_KEY, and DATABRICKS_TOKEN, or DATABRICKS_CLIENT_ID and DATABRICKS_CLIENT_SECRET (on Azure Databricks, without them, a Microsoft Entra token from the Duck's identity). BigQuery uses Google credentials (credentials= on the scratch URI, else the Duck's own), and Athena the Duck's IAM role.

Cloud Ducks on Fargate​

VariableDefaultDescription
DUCKSTRING_FARGATE_IMAGEContainer image for Ducks. Required unless DUCKSTRING_FARGATE_TASK_DEF is set.
DUCKSTRING_FARGATE_TASK_DEFAn existing task definition to run instead of registering one.
DUCKSTRING_FARGATE_CLUSTERdefaultECS cluster.
DUCKSTRING_FARGATE_SUBNETSSubnets for Duck tasks. Required.
DUCKSTRING_FARGATE_SECURITY_GROUPSSecurity groups for Duck tasks. Ducks only make outbound connections, so no inbound rules are needed.
DUCKSTRING_FARGATE_EXECUTION_ROLETask execution role. Required.
DUCKSTRING_FARGATE_TASK_ROLERole the Duck runs as, which needs access to the data root. Required.
DUCKSTRING_FARGATE_ASSIGN_PUBLIC_IPENABLEDWhether tasks get a public IP.
DUCKSTRING_FARGATE_CPU_ARCHX86_64X86_64 or ARM64.
DUCKSTRING_FARGATE_CPU1024CPU units for tasks not using a pool's size.
DUCKSTRING_FARGATE_MEMORY4096Memory in MiB for tasks not using a pool's size.

Cloud Ducks on EC2​

VariableDefaultDescription
DUCKSTRING_EC2_AMIMachine image for Ducks. Its default python3 must be 3.10 or newer, with a matching pip3. Required.
DUCKSTRING_EC2_INSTANCE_PROFILEInstance profile the Duck runs as. Required.
DUCKSTRING_EC2_INSTANCE_TYPEm6i.largeInstance type when a pool doesn't set one.
DUCKSTRING_EC2_PIP_SPECWhat to pip install on boot, when the image doesn't already include Duckstring.
DUCKSTRING_EC2_SUBNETSubnet for Duck instances.
DUCKSTRING_EC2_SECURITY_GROUPSSecurity groups for Duck instances. Without them, instances use the VPC's default group and usually can't reach the Catchment.
DUCKSTRING_EC2_ASSIGN_PUBLIC_IPWhether instances get a public IP.

Cloud Ducks on Container Apps​

Azure's default backend. See Cloud Compute on Azure.

VariableDefaultDescription
DUCKSTRING_CONTAINERAPPS_ENVIRONMENTResource id of the Container Apps environment Ducks run in. The subscription, resource group, location and log workspace come from it. Required.
DUCKSTRING_CONTAINERAPPS_IDENTITYResource id of the user-assigned managed identity Ducks run as, which needs access to the data root. Required.
DUCKSTRING_CONTAINERAPPS_IMAGEghcr.io/duckstring-dev/duckstring:<version>-azureContainer image for Ducks.
DUCKSTRING_CONTAINERAPPS_WORKLOAD_PROFILEConsumptionThe environment's workload profile to run Ducks on.
DUCKSTRING_CONTAINERAPPS_JOBA job name of your own. Without it, the Catchment creates and names its jobs, and deletes ones left on an old image.
DUCKSTRING_CONTAINERAPPS_CPU1024CPU units for Ducks not using a pool's size.
DUCKSTRING_CONTAINERAPPS_MEMORY2048Memory in MiB for Ducks not using a pool's size.

Cloud Ducks on Azure VMs​

VariableDefaultDescription
DUCKSTRING_AZUREVM_SUBNETResource id of the subnet for Duck VMs. Required.
DUCKSTRING_AZUREVM_IDENTITYResource id of the user-assigned managed identity Ducks run as. Required.
DUCKSTRING_AZUREVM_LOCATIONAzure region for Duck VMs. Required.
DUCKSTRING_AZUREVM_RESOURCE_GROUPthe subnet'sResource group the VMs are created in.
DUCKSTRING_AZUREVM_IMAGEUbuntu 24.04A marketplace URN or an image resource id.
DUCKSTRING_AZUREVM_ASSIGN_PUBLIC_IPtrueWhether VMs get a public IP. New Azure subnets have no default outbound access, and a VM needs it to install Duckstring.
DUCKSTRING_AZUREVM_PIP_SPECduckstring[azure]==<version>What the VM installs on boot.
DUCKSTRING_AZUREVM_DISK_GBthe image'sOS disk size.

Cloud Ducks on Cloud Run​

Google Cloud's default backend. See Cloud Compute on Google Cloud.

VariableDefaultDescription
DUCKSTRING_CLOUDRUN_REGIONRegion for Duck jobs. Required.
DUCKSTRING_CLOUDRUN_SERVICE_ACCOUNTEmail of the service account Ducks run as, which needs access to the data root. Required.
DUCKSTRING_CLOUDRUN_IMAGEContainer image for Ducks, in Artifact Registry. This or DUCKSTRING_CLOUDRUN_REGISTRY is required.
DUCKSTRING_CLOUDRUN_REGISTRYAn Artifact Registry remote repository that proxies ghcr.io. Ducks then run <registry>/duckstring-dev/duckstring:<version>-gcp.
DUCKSTRING_CLOUDRUN_PROJECTGOOGLE_CLOUD_PROJECT, else the credentials' projectProject for Duck jobs.
DUCKSTRING_CLOUDRUN_JOBA job name of your own. Without it, the Catchment creates and names its jobs, and deletes ones left on an old image.
DUCKSTRING_CLOUDRUN_CPU1024CPU units for Ducks not using a pool's size.
DUCKSTRING_CLOUDRUN_MEMORY2048Memory in MiB for Ducks not using a pool's size.

Cloud Ducks on Compute Engine​

VariableDefaultDescription
DUCKSTRING_GCE_ZONEZone for Duck VMs. Required.
DUCKSTRING_GCE_SERVICE_ACCOUNTEmail of the service account Ducks run as. Required.
DUCKSTRING_GCE_PROJECTGOOGLE_CLOUD_PROJECT, else the credentials' projectProject for Duck VMs.
DUCKSTRING_GCE_IMAGEUbuntu 24.04Boot image.
DUCKSTRING_GCE_NETWORKthe project's default networkVPC network.
DUCKSTRING_GCE_SUBNETWORKA subnetwork of that network.
DUCKSTRING_GCE_ASSIGN_PUBLIC_IPtrueWhether VMs get an external IP. The default network has no Cloud NAT, and a VM needs outbound access to install Duckstring.
DUCKSTRING_GCE_PIP_SPECduckstring[gcp]==<version>What the VM installs on boot.
DUCKSTRING_GCE_DISK_GB20Boot disk size.

Relay​

When a Catchment on a private network (such as a laptop) runs cloud Ducks on AWS, it can start a small EC2 relay that the Ducks connect to, with an SSH tunnel back to the Catchment. Azure and Google Cloud have no relay, so a Catchment there needs DUCKSTRING_CATCHMENT_PUBLIC_URL or an address Ducks can reach.

VariableDefaultDescription
DUCKSTRING_RELAYonoff disables the relay.
DUCKSTRING_RELAY_AMIDUCKSTRING_EC2_AMIMachine image for the relay.
DUCKSTRING_RELAY_INSTANCE_TYPEt4g.nanoRelay instance type.
DUCKSTRING_RELAY_PORTthe Catchment's portPort the relay listens on.
DUCKSTRING_RELAY_TTL_MINUTES30The relay shuts itself down after this long without the tunnel.
DUCKSTRING_RELAY_KEY_NAMEEC2 key pair for the relay.
DUCKSTRING_RELAY_SSH_KEYLocal private key file for the tunnel.
DUCKSTRING_RELAY_SSH_USERec2-userSSH user on the relay.
DUCKSTRING_RELAY_SECURITY_GROUPSecurity group for the relay.

Email alerts​

Defaults for mailto: alert channels. See Notification URIs.

VariableDefaultDescription
DUCKSTRING_SMTP_HOSTSMTP server as host:port.
DUCKSTRING_SMTP_FROMduckstring@localhostSender address.
DUCKSTRING_SMTP_USERSMTP username.
DUCKSTRING_SMTP_PASSWORDSMTP password.
DUCKSTRING_SMTP_TLS10, false or no turns off STARTTLS.