Skip to main content
These commands belong to the environment workflow of the reactor CLI. Turn it on in each terminal with export REACTOR_PROJECTS_ENABLED=1.
An environment holds two kinds of variables:
  • A plain variable has a value that reactor environment show and the revision history show.
  • A secret has a value that the Reactor API and the CLI never show after you send it.
Your model reads both from os.environ. Use a secret for a credential, such as an API key or a token. Never put a credential in a plain variable.

Before you start

  • Install the CLI and log in. See Install the CLI and Authentication.
  • Have an environment that already runs an image. The examples use staging. reactor environment list -p your-org/your-model lists the environments of a project.
  • Know your project name, such as your-org/your-model. The CLI takes the project from -p, else from REACTOR_PROJECT, else from the nearest reactor.yaml. The examples name the project with -p, so a REACTOR_PROJECT in your shell cannot send them to another project.
  • Build your image with reactor-runtime 3.11.6 or later. The build.runtime_version key in reactor.yaml sets it. An older runtime does not put secrets in the environment of your model.

Set your first secret

Type the value at the prompt and press Enter. The prompt does not show what you type. The output names the change and never shows the value:
A later value of the same secret shows (secret, new version). A plain variable that becomes a secret shows (plain -> secret, new). Your model reads the value from the environment:
Do not print or log the value.

What a write does

A write creates the next revision of the environment at once. Then the rollout replaces the running instances, and the new instances get the new values. The instances of the earlier revision keep their values until they stop. A changed plain value, a new secret value, or an unset replaces the running instances. A write that changes nothing creates no revision. The command waits until the rollout is ready, for at most 10 minutes. Set --timeout to change that limit, or --no-wait to return as soon as Reactor accepts the write. When the wait ends before the rollout is ready, the command exits with code 8. The write stays. To wait for the rollout later, run:

Set a plain variable

--var NAME= sets an empty value. A variable that the command does not name keeps its value. reactor deploy takes the same --var, --secret, and --unset flags, and applies them in the same revision as the image that it builds.
Do not use --var on a name that holds a secret. The secret becomes a plain variable, and reactor environment show and the history then show its value. The output shows (secret -> plain). Change a secret only with --secret.

Other ways to give a secret value

The value never goes on the command line. Besides the hidden prompt, the CLI reads it from standard input or from a file:
  • For the standard input example, set the shell variable API_KEY to the value first. A CI job also needs REACTOR_PROJECTS_ENABLED=1 and REACTOR_API_KEY in its environment. See Authentication.
  • set +x turns off shell tracing in the subshell while the shell expands the value. With tracing on, the shell writes the value to the job log.
  • Only one --secret can read standard input. To set several secrets in one write, read the others from files: repeat --secret NAME=@path.
  • The @- and @path forms remove exactly one line ending (LF or CRLF) from the end of the value. To keep a line ending at the end of a value, put the value in a file that ends with two.
  • The standard input example ends the value with CRLF. The CLI removes that whole line ending, so a value that ends with a carriage return stays as it is.
  • The hidden prompt needs a terminal. Without one, the command exits with code 1 before it reads any value, and names the @- and @path forms.
  • The CLI refuses a value on the command line and sends nothing. The value can still be in your shell history, so rotate it at the service that issued it:

Remove a variable or a secret

--unset removes a plain variable or a secret:
The default output includes these lines:
The note goes to standard error. It shows when the environment has instances before and after the write. An unset of a name that the environment does not have removes nothing. When the write changes other settings, the output adds the line OLD_FLAG was not set, so it was not removed. A write that only unsets such names creates no revision and exits with code 0, so a CI job can run it again. It prints Nothing to change: staging (your-org/your-model) already has no OLD_FLAG.

After a lost response

When the connection drops before the Reactor API answers, the write can still apply. The CLI does not send the write again. It prints:
Compare the environment with the write before you send it again:
Each secret entry carries a version_id, and each new value gets a new one. Note the version_id of each secret before a write. After a lost response, a new version_id in a new revision means that a write applied. Check that no other write, such as one from a CI job, ran in the meantime. A second send stores another version, creates another revision, and replaces the instances again.

Read variables and history

  • show prints each plain variable with its value, and each secret by its name, such as API_KEY (secret API_KEY). --revision prints an earlier revision.
  • show -o json gives each secret as {"secret": "API_KEY", "version_id": "<UUID>"}.
  • history lists the revisions, newest first, with who made each one and when. Its CHANGES column names each changed variable as var.<name>, and adds (secret) for a secret. It shows at most three variables for each revision, then and N more.
  • history -o json gives every change, with its value before and after. For a plain variable, that is the value. For a secret, it is the name and the version_id. The history never holds a secret value.

Roll back

A rollback deploys the model image and the weights of revision 3 in a new revision. It keeps the current variables and secrets, the GPU, and the instance count. A rollback to a revision without weights clears the weights. When the environment already runs that image and those weights, the rollback prints Nothing to change and creates no revision. To restore an earlier secret value, set it again with --secret. Some older revisions pin weights without a set digest, such as an hf:// reference. When the environment runs other weights, the CLI refuses a rollback to such a revision before it sends anything. To run that image again, set it with reactor environment update --image, with weights that have a set digest. A rollback to a revision that pins weights can fail with 409 failed_precondition and one of two reasons: Until Reactor makes that move, a rollback of production can also fail with release_required. In that state, a rollback of production that clears the weights keeps the instances on the weights of the deployed release.

Names and limits

The CLI refuses a name or a secret value that breaks a rule before it sends the write. It does not check a plain value, and it replaces an invalid UTF-8 byte in --var with the character U+FFFD. So give each --var value as valid UTF-8. A write over a total size or the account count fails with 409 failed_precondition and a reason: plain_variables_too_large, resolved_environment_too_large, secret_manifest_too_large, or secrets_quota_exceeded. One write with more than 300 secret changes fails with too_many_secret_changes. Writes over the per-minute rate fail with 429 quota_exceeded and a Retry-After header.
Every name that starts with REACTOR_ or KUBERNETES_, and CLOUD_ID, COORDINATOR_URL, DEPLOYMENT, EXIT_TIMEOUT_SECONDS, GRPC_PORT, HOST, HOSTNAME, ICE_TRANSPORT_POLICY, JAX_COMPILATION_CACHE_DIR, LD_LIBRARY_PATH, MALLOC_ARENA_MAX, MAX_SESSION_DURATION_SECONDS, MODEL_NAME, NCCL_CROSS_NIC, NCCL_DEBUG, NCCL_IB_DISABLE, NODE_NAME, NVIDIA_VISIBLE_DEVICES, ORPHAN_TIMEOUT_SECONDS, OTEL_EXPORTER_OTLP_TRACES_ENDPOINT, OTLP_ENDPOINT, PATH, POD_IP, POD_NAME, POD_NAMESPACE, POD_UID, PORT, PYTHONHOME, PYTHONPATH, PYTHONUNBUFFERED, REGION_ID, SIGTERM_GRACE_PERIOD, STUN_SERVERS, TURN_SERVERS, VIRTUAL_ENV, WEBRTC_BWE_INITIAL_KBPS, WEBRTC_BWE_MAX_KBPS, WEBRTC_BWE_MIN_KBPS, WEBRTC_CLIENT_PING_TIMEOUT_SECONDS, WEBRTC_PORT_RANGE, WEBRTC_SENDER_MAX_KBPS, WEBRTC_SENDER_MIN_KBPS, and WEBRTC_VIDEO_CODECS.

How your model reads them

  • Plain variables and secrets are in os.environ when your model module imports, and in load().
  • The runtime sets the secrets in the environment before it imports your model module. See the changelog.
  • A secret cannot take a name that the runtime reads for its own configuration. The runtime then stops before it starts your model, and names the key.
  • A variable or a secret of the environment replaces a value of the same name that the image sets, such as one from build.runtime_env. After you unset it, new instances see the value of the image again. To remove a credential that is in the image, build a new image.
When an instance cannot mount its secrets, it does not start. reactor status staging shows the region as failed when no other instance of the revision serves, starts, or is degraded there. production shows these states only after Reactor moves it to revision-based deploys. reactor environment instances staging shows the slots of the instance as failed, with the reason mount_failed. The message is A volume of the model's pod cannot be mounted.

What an unset does

An unset removes a secret from the new revision at once. It is more like a scheduled deletion of the secret. Reactor can fully delete a secret only when no instance uses it any more. The instances of the earlier revision keep the secret until they stop in every Reactor Region.

An unset does not revoke the credential at the service that issued it.

Retention. Reactor cannot fully remove a secret value until no current revision of an existing environment refers to that version of the secret. So Reactor does not promise a date for the deletion. Who can read a secret. The environment and revision APIs and the CLI never return a secret value, to you or to Reactor staff. When your model writes a value to its logs, reactor logs shows it.

Next

Data security

How Reactor protects your weights, images, and credentials.

Runtime changelog

The runtime release that reads secrets.