Run operator commands from the repository root. The reference environment is Ubuntu 24.04 on a STACKIT n2.28d.g2 instance in region eu01, with two L40S GPUs, approximately 100 GB RAM and a 256 GB boot volume. An availability-zone catalog entry does not guarantee free GPU capacity.
Install the STACKIT CLI, Python 3.12+, SSH, curl and tar. Keep the service-account JSON in the ignored credentials-kolibri.json with mode 0600, or set STACKIT_SERVICE_ACCOUNT_KEY_PATH to an external path.
python3 -m venv .venv
. .venv/bin/activate
python3 -m pip install -r scripts/operations-requirements.txt
./scripts/install-tofu.shFor an existing deployment, restore .local/deployment.json, Secrets Manager access and operator files using the recovery guide. Do not provision replacement resources merely to obtain access to an existing installation.
infra/foundation/ manages Secrets Manager, the state bucket and a credential group. infra/compute/ manages the application VM and networking. Both use the same private versioned bucket with separate state keys.
For a genuinely new project, the foundation must first be provisioned from a private bootstrap workspace with local state: copy infra/foundation/main.tf and its provider lock file there, authenticate with the project service account and apply that module. Keep the bootstrap state private. Record its outputs in .local/deployment.json using infra/foundation/deployment.example.json as the field template. Activate Object Storage for the project first.
Create technical Secrets Manager access and S3 credentials with scripts/project-secrets.py bootstrap, then enable versioning and encryption with configure-bucket. In that same private bootstrap workspace, add the foundation S3 backend configuration and run the authenticated tofu init -migrate-state to migrate its existing local state. Verify the remote state before archiving the local bootstrap copy. Normal checkouts then use init, without migration.
source scripts/env.sh
kolibri_auth
python3 scripts/project-secrets.py bootstrap
python3 scripts/project-secrets.py configure-bucket
tofu -chdir=infra/foundation initThe tofu shell function defaults to infra/compute/ when invoked from the repository root. An explicit -chdir selects another module. It obtains credentials from Secrets Manager and supplies the private bucket at initialization. State object keys and resource addresses are independent of source-directory names. Distributed locking is disabled for this single-operator setup; do not run concurrent writers from different machines.
./scripts/preflight.sh
# Review infra/compute/environment.auto.tfvars.json.
# Set web_domain to your hostname and select the intended access rules.
./scripts/deploy.sh eu01-3
# Apply only after reviewing the saved plan:
./scripts/deploy.sh eu01-3 --apply
./scripts/status.shPreflight checks quotas, the requested flavor, OS image and the operator's SSH source address. It creates private deployment variables and an SSH key when needed. Allocation is attempted in one AZ at a time; a failed allocation is not a reason to delete an existing working VM.
The compute module renders scripts/install.sh into cloud-init. It installs the GPU runtime, pinned llama.cpp implementation and Kolibri weights. It can resume after reboot. Changing this bootstrap content may produce a VM replacement plan; routine application updates use the separate deployment scripts.
A cold model start can take several minutes while weights are read from disk. The Compose healthcheck allows five minutes for initialization before counting failures.
Both the standalone systemd bootstrap (scripts/install.sh) and the Compose model service allocate 65,536 context tokens for one inference slot. The managed gateway profiles default to 8,192 output tokens; standalone clients should send their desired max_tokens explicitly. Input and output share the context window. See API budgets.
For an existing Compose deployment, update the Compose file and recreate only the kolibri service during an idle period, then apply the matching assistant configuration. A context change restarts the model process; it does not require replacing the VM or rerunning the infrastructure bootstrap. For an existing standalone systemd deployment, update --ctx-size in its unit, run systemctl daemon-reload and restart the service. Re-running the full installer is unnecessary.
Point the public DNS hostname at the VM. Set WEB_DOMAIN in the VM's private /opt/kolibri/.env before the first installation. Wait for initial GPU/model provisioning to complete, then run:
./scripts/configure-features.sh
./scripts/assistant-config.sh statusThe installer transfers deployable sources, builds service images, downloads pinned model weights, starts Compose services and synchronizes managed UI profiles. The initial weights require substantial storage and download time. Run this during a maintenance window: media jobs stop during model updates.
Only HTTP/HTTPS are public application ports. SSH uses the configured operator address. Service APIs remain internal or loopback-bound. Personal WebUI accounts provide chat authentication; public registration is disabled. See operations for account management and updates.
infra/compute/media.tf optionally adds a private n2.14d.g1 worker (one L40S, 50 GB RAM, 512 GB boot disk at storage_premium_perf6 / 200 MB/s). Set media_enabled=true and media_availability_zone in the ignored compute variables. The default is disabled. Plan and review the addition; existing Kolibri resources must remain unchanged. The worker belongs to the existing compute state in S3, not a second local state.
scripts/install-media-host.sh installs Ubuntu GPU drivers, Docker, Compose and NVIDIA Container Toolkit through cloud-init, resuming after reboot. It does not install Kolibri on the media GPU. Wait for /var/lib/kolibri/media-host-ready; inspect /var/log/kolibri-media-install.log through scripts/ssh-media.sh if necessary. The worker has no public IP. It shares the application network and accepts SSH and its private job API only from the application's NIC.
Optionally set media_dns_zone_id to an existing project DNS zone ID. infra/compute/dns.tf then manages an A record named kolibri-media (override with media_dns_label) pointing at the private NIC, with a 300-second TTL. The zone itself remains unmanaged. The media_dns_name output exposes the resulting hostname. Even in a public DNS zone, this private address is reachable only through the project network or jump host; it does not create another public application endpoint.
The access script reads worker outputs from the remote state and records server_id and private_ip in ignored .local/media-deployment.json. Prepare access and deploy:
python3 scripts/configure-media-access.py
bash scripts/configure-media-host.shThis selects deploy/media/compose.yaml and the revision-pinned quality profile. Keep the existing worker serving until generation, editing, analysis and video checks pass on the new host. At cutover, drain and stop both queues, back up their data, migrate the existing kolibri_media_data records/artifacts, and preserve the signing key. Never copy a live SQLite database. After transferring the stopped source snapshot into a staging directory on the destination, merge it with python3 scripts/merge-media-data.py SOURCE_SNAPSHOT DESTINATION_VOLUME. The utility rejects active queues and conflicting records and preserves existing destination jobs. Keep both data copies until signed old links and new jobs have been verified.
On the application host, set these values in its private .env:
MEDIA_API_URL=http://<media-private-ip>:8093
MEDIA_UPSTREAM=<media-private-ip>:8093
MEDIA_LOCAL_REPLICAS=0Redeploy knowledge and gateway after updating those settings. Subsequent configure-features.sh runs skip local model installation when replicas are zero. On the media host use configure-media-host.sh for model/service updates. Runtime configuration is backed up under media-runtime/ in Secrets Manager by scripts/project-secrets.py backup; restore-media-runtime restores it to a private local review directory.
Do not import or delete unrelated networks, security groups, disks or shared SSH key pairs when replacing a pre-existing worker. Explicitly review any resources retained from that earlier server.
Both hosts default to storage_premium_perf6 (200 MB/s, 5,000 IOPS). Change boot_volume_performance_class or media_volume_performance_class in private variables and review the plan. It should replace only the corresponding terraform_data.storage_performance tracking resource, not a VM or disk.
Provider 0.123.0 treats stackit_server.boot_volume.performance_class changes as server replacements and does not refresh that field from the volume API. For this field only, the server resource therefore uses ignore_changes. infra/compute/storage.tf manages the operation through scripts/retype-volume.py and the documented IaaS v2alpha1 retype API. It verifies the current/target class, performs an in-place request when needed and waits for completion. It never detaches a disk or restarts/replaces a server. Service credentials remain in the process environment or memory and are not written into the state by this helper.
The API allows upgrades to faster classes; downgrades are subject to its seven-day limit. This alpha API is an explicit dependency until the provider supports in-place retyping. Provisioners do not continuously detect drift: use the same helper without --apply to verify the current class. A busy volume fails safely instead of issuing a competing operation. Do not remove the field-specific lifecycle rule while using the pinned provider.