CosmicAC Logo

Task deployment commands

Reference for the task commands that deploy and operate the CosmicAC stack.

The CosmicAC deployment repository uses Task to deploy and operate the Docker Compose stack. You run each command from the deployment directory. task with no command lists every command.

Syntax

task <command> [VARIABLE=value ...] [-- <script-arguments>]
  • VARIABLE=value: a variable for this run. A value on the command line overrides the same variable in .env.
  • -- <script-arguments>: arguments for the underlying script. They take effect only after the -- separator.

Variables

Commands read the following variables from the command line or from .env. For every .env variable, see Deployment configuration.

VariableDescription
TAGThe release image tag. A value on the command line also overrides the per-service tags in .env, such as APPNODE_TAG, and CosmicAC doesn't save it to .env.
SERVICESSpace-separated Compose service names, such as "cosmicac-app-node cosmicac-ui". Limits the command to those services.

Deploy

CommandDescriptionVariables
task bootstrapDeploys the whole stack from scratch. Runs config-init, applies the .env configuration overrides, starts the services, and runs wire, wire-monitor, autobase-connect, register-rack, and migrate-pricing. Generates the service secrets, and copies the apiKeySecret of cosmicac-app-node to cosmicac-proxy-inference.TAG
task config-initWrites the configuration files of each service under services/<service>/config/ from the examples in its image. Generates the cosmicac-app-node secrets and the proxy HRPC key pair.None
task pullPulls the images at the resolved tag.TAG, SERVICES
task upCreates and starts the stack.TAG, SERVICES

Lifecycle

CommandDescriptionVariables
task startStarts the containers that task stop stopped.SERVICES
task stopStops the containers without removing them.SERVICES
task restartRecreates the containers, even if they're unchanged.TAG, SERVICES
task downStops and removes the containers and the network. Keeps the configuration and state directories.None
task updateUpgrades to a new image tag. Pulls the images, adds new configuration files and keys, applies the .env configuration overrides, and recreates the services. Then runs wire and wire-monitor for the services in scope. Updating cosmicac-app-node also recreates cosmicac-ui and caddy.TAG, SERVICES
task recreate-uiRebuilds the web interface assets and recreates Caddy.None

Status and debugging

CommandDescriptionVariables
taskLists the available commands.None
task psShows the container status. task status is an alias.None
task logsFollows the container logs.SERVICES
task configRenders the effective Docker Compose configuration.None
task config-diffShows how the configuration of each service differs from the example in its image, with secrets redacted. Compares the live file plus its .env overrides, and writes nothing. Requires jq and diff.SERVICES

Registry login

CommandDescriptionVariables
task loginLogs in to GitHub Container Registry (GHCR). Uses GITHUB_PAT and GITHUB_USER, or prompts for them.None
task ensure-loginLogs in to GHCR only if Docker has no stored credentials for it. You can't run it on its own. task register-rack runs it first.None

Keys and wiring

CommandDescriptionVariables
task wireDerives the runtime keys from the service status files, and updates the Docker Compose configuration and .env. Links the shared keys of the services, including the apiKeySecret of cosmicac-proxy-inference, and applies the K8S_ configuration overrides.None
task wire-monitorAdds the RPC client key of cosmicac-app-node to the list of allowed keys of cosmicac-wrk-monitor, and writes the RPC public key of the monitor to cosmicac-app-node.None
task ork-keyPrints the RPC public key of cosmicac-wrk-ork.None
task app-node-keyPrints the Autobase bootstrap key of cosmicac-app-node.None
task autobase-connectRegisters the Autobase writer key of every worker in cosmicac-app-node.None
task register-rackRegisters the Kubernetes rack with cosmicac-wrk-ork, using K8S_RACK_ID and K8S_RACK_LOCATION.None
task migrate-pricingApplies K8S_GPU_PRICE to the GPU types on the registered racks.None
task seed-adminCreates or updates an administrator account from the BOOTSTRAP_ADMIN_* variables. No other command runs it.None

Configuration

Five services keep their configuration under DATA_ROOT, which defaults to services/. The settings of each service are in services/<service>/config/common.json, with more files under config/facs/. cosmicac-ui serves a static site and has no configuration directory.

task config-init copies the *.example file for each configuration file from the image of each service. If a live file is missing, the command creates it from the example. If the live file exists, the command adds each key that the example has and the live file lacks, and leaves the existing keys unchanged.

Each apply command reads the .env variables that carry its prefix, and writes their values to the config/common.json and config/facs/*.json files of one service. A variable replaces the value at the path that it names. The command starts no containers.

CommandService.env prefix
task apply-app-node-common-configcosmicac-app-nodeAPPNODE_
task apply-proxy-inference-common-configcosmicac-proxy-inferencePROXY_
task apply-wrk-ork-common-configcosmicac-wrk-orkWRKORK_
task apply-wrk-server-k8s-nvidia-common-configcosmicac-wrk-server-k8s-nvidiaK8S_
task apply-wrk-monitor-common-configcosmicac-wrk-monitorMONITOR_

For the override variable forms and how a file key resolves to a filename, see Config overrides. A variable that carries the prefix but matches none of those forms produces a warning, and the command applies nothing from it.

The apply commands accept the following script argument.

ArgumentDescription
--dry-runPrints the files that the command would write, and writes nothing. --show-config is an alias.

task bootstrap and task update also run all five apply commands.

task wire rewrites the values that link the services to each other, including the RPC allowlist in the net.config.json file of each service. task bootstrap and task update run it after the apply commands, so it replaces any of those values that an apply command wrote. The .env variable stays, and the apply command writes the value again. K8S_ overrides are the exception, because task wire applies them after its own writes.

Backup

CommandDescriptionVariables
task backupCopies the configuration and state directories of each service to ./backups/<timestamp>.None

Destructive commands

Neither command takes a backup first, and no command restores what they delete.

CommandDescriptionAsks firstVariables
task clean-stateDeletes the status and store directories of the worker services in SERVICES. They refill on the next task up. The command needs SERVICES, and deletes nothing without it.YesSERVICES
task cleanDeletes the containers, the Docker Compose volumes, the generated data of every service under DATA_ROOT, and the locally built images.NoNone

On this page