These optional scripts prepare dependencies and build Optio images without
internet access. See the optional Zarf package and Rancher form below for deployment.
The scripts need bash 4 or newer (macOS ships 3.2: brew install bash).
Normal builds download dependencies and use the complete agent toolchain;
none of the steps below runs automatically.
Mirror each image you enable, then set its chart value. For example:
api:
image: { repository: registry.example.com/optio/api, tag: "1.0.0" }
web:
image: { repository: registry.example.com/optio/web, tag: "1.0.0" }
agent:
image:
repository: registry.example.com/optio/agent-base
prefix: registry.example.com/optio/agent-
tag: "1.0.0"
imagePullPolicy: IfNotPresent
postgresql:
image: { repository: registry.example.com/base/postgres, tag: "16.15" }
redis:
image: { repository: registry.example.com/base/redis, tag: "7.4.11-alpine" }Also mirror agent.envoyProxy.image when using the secret proxy and
any custom repository images. Configure
imagePullSecrets for private image pulls and the container runtime's registry trust:
image pulls happen before a pod can mount a CA.
Runtime connections, package installs and repository setup commands also need reachable services or mirrored dependencies.
By default the API asks ghcr.io for newer Optio releases, the Overview shows
an update banner, and a deployment admin can roll the API to the new tag from
it. That update pulls ghcr.io images and patches the Deployment directly,
outside Helm or Zarf. Turn all of it off with:
updates:
check: false # OPTIO_UPDATE_CHECK=falseThe API then makes no registry request, the banner is hidden for everyone and
POST /api/cluster/update answers 409. Upgrade by installing the new chart or
package. The Zarf package and the Rancher form set it off.
The CLIs in the agent images send telemetry, check for and install updates, and fetch model lists by default. Offline these calls fail or wait for a timeout, and through a proxy they leave the network. Turn them off in every agent pod with:
agent:
offline: true # OPTIO_AGENT_OFFLINE=trueEach repository, workflow and persistent agent pod then starts with these variables (a value set for the repository or run takes precedence):
| CLI | Variables |
|---|---|
| Claude Code | CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC=1, DISABLE_TELEMETRY=1, DISABLE_ERROR_REPORTING=1, DISABLE_AUTOUPDATER=1 |
| OpenCode | OPENCODE_DISABLE_AUTOUPDATE, OPENCODE_DISABLE_MODELS_FETCH (uses its bundled model list), OPENCODE_DISABLE_SHARE, OPENCODE_DISABLE_LSP_DOWNLOAD, all true |
| Copilot CLI | COPILOT_AUTO_UPDATE=false |
| pi | PI_OFFLINE=1, PI_TELEMETRY=0, PI_SKIP_VERSION_CHECK=1 |
| Gemini CLI | GEMINI_TELEMETRY_ENABLED=false |
| gh | GH_NO_UPDATE_NOTIFIER=1, GH_NO_EXTENSION_UPDATE_NOTIFIER=1, GH_TELEMETRY=false |
| glab | GLAB_CHECK_UPDATE=false, GLAB_SEND_TELEMETRY=false |
| npm, pnpm | npm_config_update_notifier=false |
| several | DO_NOT_TRACK=1 |
Not covered here: Codex, Cursor's CLI, and Gemini CLI's usage statistics and
auto-update, which are set in each CLI's own configuration file.
With CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC, Claude Code's built-in GitHub
API helper is also off; agents keep using the gh CLI. The Zarf package and the
Rancher form turn this on.
On a connected Linux amd64 host with Docker BuildKit, curl, git, gzip, sha256sum and tar:
scripts/offline/make-kit.sh 1.0.0 --out /media/kit-1.0.0
# Optional smaller toolchain, with preinstalled MCP servers:
# --agent-clis claude-code,opencode --opencode-install-method npm --preinstall-mcp-serversThe bundle contains digest-pinned base and toolchain images, a Linux x64 glibc
pnpm store matching pnpm-lock.yaml, a Corepack pnpm archive, Helm, kubectl,
crane, BuildKit's client, Node, an optional runner chart, image SBOMs and Trivy
reports/database. KIT.md records the source revision, tool choices and
contents. The source checkout is transferred separately, for example with
git bundle create optio.bundle --all. Keep it at the revision in KIT.md.
A dependency or toolchain change requires a new bundle.
The scanner checks scripts/offline/known-bad.txt; a listed package or digest
fails bundle creation. Vulnerabilities are reported for review in
offline/scan/SUMMARY.md. --skip-scan is available for trial bundles and is
recorded in KIT.md. Verify and optionally sign the bundle using your normal
artifact process before transferring it.
On a host that reaches the destination registry:
(cd /media/kit-1.0.0/offline && sha256sum -c SHA256SUMS)
export OPTIO_KIT_DIR=/media/kit-1.0.0
export OPTIO_REGISTRY=registry.example.com/optio
scripts/offline/load-kit.sh --dry-run
scripts/offline/load-kit.sh --ca-file /path/to/registry-ca.pem
# For a login: --username USER --password-stdin (provide the password on stdin).
scripts/offline/build-images.sh 1.0.0 --offline --presets --pushLoading uses crane by default and needs no Docker daemon. It publishes the
images plus build/pnpm-offline:1.0.0 and build/ci-node:1.0.0, made from the
bundle's files. Building supports Docker buildx or --buildkit-host with
buildctl. --toolchain-version lets an application rebuild reuse a compatible
bundle. The built images use optio-api, optio-web, and optio-agent-* names;
set the chart repositories accordingly. Read each script's --help for
individual image selection, alternate prefixes and manifest output.
Run scripts/offline/check-offline-build.sh /media/kit-1.0.0 on a disposable
build host to prove that every build step works on a Docker internal network.
It creates a temporary registry and BuildKit daemon, then cleans them up.
Re-scan after transfer without internet access:
scripts/offline/kit-scan.sh /media/kit-1.0.0 --offline
# Or provide a newer transferred database with --db /media/trivy-db.tgz.| Argument | Default | Purpose |
|---|---|---|
AGENT_CLIS |
all |
Complete toolchain, or a comma list: claude-code,codex,pi,copilot,cursor,gemini,openclaw,opencode. API and compatibility images install the listed runtimes they support. GitHub, GitLab and AWS utilities remain available. |
CLAUDE_CODE_VERSION |
2.1.310 |
Override Claude Code's Bun compatibility pin (the compatibility image keeps its unpinned default). Later releases need testing with your nodes' kernels, especially Linux 7 or newer. |
PREINSTALL_MCP_SERVERS |
0 |
On the base agent image, 1 installs the pinned Filesystem MCP server and marks the image with OPTIO_MCP_PREINSTALLED=1. Configure server commands explicitly; automatic connection selection follows separately. |
OPENCODE_INSTALL_METHOD |
script |
Base agent image: npm installs the pinned OpenCode npm package, useful with a package mirror. |
OPTIO_OFFLINE_FONTS |
0 |
Web build: 1 uses vendored OFL fonts. Otherwise next/font/google downloads the usual Google fonts. Also works as an environment variable for pnpm --filter @optio/web build. |
NODE_SLIM_IMAGE |
upstream's pinned Node 26 slim | Override the Node base with a mirrored or digest-pinned reference. |
NODE_IMAGE |
empty | API dependency stage: optionally use a full Node image; empty retains the slim base. |
UBUNTU_IMAGE |
upstream's pinned Ubuntu 24.04 | Agent base and compatibility image: mirrored or digest-pinned base. |
PNPM_OFFLINE |
0 |
1 installs from the named pnpm-offline context containing store/ and pnpm.tgz. |
API_TOOLCHAIN_IMAGE / AGENT_TOOLCHAIN_IMAGE / DIND_TOOLCHAIN_IMAGE |
empty | Reuse the matching prebuilt third-party stage; the normal path builds it from apt/npm/downloads. |
For an individual web build with a transferred store:
mkdir -p /tmp/optio-pnpm
tar xzf /media/kit-1.0.0/offline/pnpm-offline-1.0.0.tgz -C /tmp/optio-pnpm
docker buildx build -f Dockerfile.web --network none \
--build-arg PNPM_OFFLINE=1 --build-arg OPTIO_OFFLINE_FONTS=1 \
--build-arg NODE_SLIM_IMAGE=registry.example.com/optio/base/node:26-slim-1.0.0 \
--build-context pnpm-offline=/tmp/optio-pnpm -t optio-web:1.0.0 .Custom MCP servers can be baked into an image, vendored in a repository, or
installed from a mirror. Agent environment variables include
NPM_CONFIG_REGISTRY, PIP_INDEX_URL and UV_DEFAULT_INDEX (uv does not use
PIP_INDEX_URL). Pin packages and select a preset containing the needed
interpreter. The REST and controller MCP bridges are bundled independently of
PREINSTALL_MCP_SERVERS.
With Linux dependencies installed and node-pty compiled, run
scripts/build-cli-tarball.sh /tmp/optio-cli.tgz to create a standalone CLI
archive. This is a manual artifact; the API image and routes do not publish it.
On a network whose browsers reach only internal services, set the chart's
web.offline: true (OPTIO_OFFLINE_UI=true on the web container). The Zarf
package and the Rancher form turn it on; the chart default is off, which
changes nothing. With it on, the UI:
- loads no image from a host outside the deployment. A sign-in avatar is
shown only when its URL is on the page's own origin or the API's
(
PUBLIC_API_URL); others (Gravatar, which a self-managed GitLab often hands out, or avatars.githubusercontent.com) show the usual placeholder, so no browser asks an outside host for them, and Gravatar never sees a hash of anyone's email address. Avatars are not proxied through the API: that would make the API fetch URLs on a browser's behalf. - leaves out links to pages outside the deployment, and the sentences that
point at them: the GitHub token pages (setup and the invalid-token banner),
the GitLab one while the host is still gitlab.com, the Anthropic, OpenAI,
Google AI Studio and Cursor key consoles, the release changelog, the
metrics-server install URL, and outside links in the in-app guide
(
/help), which stay as text.
Images in agent output, chat and the guide are never rendered, with the setting or without it. Links inside content people or agents wrote (a PR link in a log) stay links. The release check and its update banner are not part of this setting.
deploy/zarf contains a separate, optional package with chart
values and manifests. Its version and all optio.local/* tags must match the
images you build. The checked-in example uses 0.1.0; change those tags
together when packaging another version.
scripts/offline/build-images.sh 0.1.0 --presets
zarf package create deploy/zarf --confirm --flavor presets
# Transfer the package, a suitable Zarf executable and the cluster's init package.
zarf init --confirm
zarf package deploy zarf-package-optio-amd64-0.1.0.tar.zst --confirm \
--set-variables PUBLIC_URL=https://optio.example.com \
--values deploy/zarf/example-values.yamlThe package declares
all variables and sensitive fields in zarf.yaml. chart: in the example
values is merged over the package's chart values. Preserve the encryption key
and PostgreSQL password across upgrades: the package reads existing Secrets
before generating values on a first install. Its optional presets and
metrics-server components can be omitted. Zarf creates the namespace and
rewrites image references through its registry. Install metrics-server only
when your cluster needs it.
The Zarf package and the Rancher form turn on networkPolicy.enabled; the
plain chart leaves it off. With it on, every agent pod (repo, Job, persistent
agent and assistant pods, all labeled managed-by: optio) may reach only:
- DNS: CoreDNS in
kube-system(podsk8s-app: kube-dns), port 53. - The Optio API pods on
api.port. - Public addresses on 443 and 80, which an air-gapped network doesn't route.
- The internal services in
networkPolicy.internalEgress, plus any raw rules innetworkPolicy.extraEgress.
Every private range is blocked unless listed, PostgreSQL and Redis included. The policy selects agent pods only: the API and web pod, PostgreSQL and Redis are not affected by it.
The chart refuses what can't be an internal service: host names (the policy
matches addresses), ranges wider than /8 (/0, /1, …), loopback
(127.0.0.0/8, ::1), link-local (169.254.0.0/16, where the cloud
instance metadata endpoint lives, and fe80::/10), and Optio's own
namespace.
List the services agents use, usually the git server, the image registry, the model gateway and package mirrors:
networkPolicy:
enabled: true
internalEgress:
cidrs: ["10.20.0.0/24", "10.30.4.15/32"] # services outside the cluster
namespaces: # services in this cluster
- gitlab
- { namespace: ingress-nginx, podLabels: { app.kubernetes.io/name: ingress-nginx } }
ports: [443, 80, 22] # [] allows every portIn the Zarf package the same lists are comma-separated variables:
zarf package deploy zarf-package-optio-amd64-0.1.0.tar.zst --confirm \
--set-variables PUBLIC_URL=https://optio.example.com \
--set-variables AGENT_EGRESS_CIDRS=10.20.0.0/24,10.30.4.15/32 \
--set-variables AGENT_EGRESS_NAMESPACES=gitlab \
--set-variables AGENT_EGRESS_PORTS=443,22NETWORK_POLICY=false turns the policy off. With it on and both lists empty,
the deploy prints a warning: agents then reach DNS and the API only.
NetworkPolicy matches addresses, not host names. Resolve each service
(getent hosts gitlab.example.com) and list its address, or the range its
load balancer uses. A name behind an in-cluster ingress resolves to the
ingress controller, so list that namespace. Don't list a range that contains
the cluster's pod or service network (for example all of 10.0.0.0/8 when
pods use 10.42.0.0/16): some network plugins would then let agents reach
every pod, PostgreSQL included. Optio's own namespace is refused in
namespaces. Node-local DNS (an address like 169.254.20.10) needs an
extraEgress rule. The policy needs a network plugin that enforces it, such
as Calico, Canal (RKE2's default) or Cilium.
To check the policy, start a throwaway pod with the agent label (the package
ships busybox:1.36):
kubectl -n optio run netcheck --rm -it --restart=Never \
--labels managed-by=optio --image docker.io/library/busybox:1.36 -- sh -c '
nc -z -w 3 10.30.4.15 443 && echo "gitlab: allowed"
nc -z -w 3 optio-api 4000 && echo "api: allowed"
nc -z -w 3 optio-postgres 5432 || echo "postgres: blocked"
nc -z -w 3 10.99.0.1 443 || echo "unlisted address: blocked"'Each listed service should be allowed and the rest blocked. A service that
times out but answers from a pod without the label is missing from the lists.
helm get notes optio -n optio shows what the release allows.
The chart retains Rancher catalog annotations and helm/optio/questions.yaml.
Publish the packaged chart in a Helm repository, add that repository in
Rancher Apps & Marketplace, then use the form or Edit YAML to configure it.
The form supports the existing GitHub, GitLab, Google and OIDC settings; it does not
choose a registry or provider for you. Keep the Rancher release namespace
consistent with namespace in values. Use createNamespace=false when
Rancher or helm --create-namespace creates it.
Optional GitHub Actions and GitLab CI examples show checking, testing, image builds, manual deployment and smoke checks. No GitLab pipeline is activated by mirroring this repository.
Only chart options already available in this branch are exposed. Additional sign-in controls, backups, monitoring and runtime policy options follow in their respective PRs. Package and model mirrors used by agents must be configured in repository setup and the external services they contact.