Pre-build a CodeNavi index in the cloud¶
For users who want to serve CodeNavi on an x86-64 Linux host without a GPU at full retrieval quality (parity with our reference GPU box). The index itself is portable: build it once on a cheap cloud GPU, ship the LanceDB files to the serving host, then run CodeNavi there against them. (An Apple Silicon Mac can run the server itself, see Mac server; or the agent runs on the Mac and connects to a Linux server, see CodeNavi on macOS.)1
TL;DR: spin up a cheap Linux + NVIDIA GPU instance, run
setup.sh && reindex.sh --full,tar czf index.tgz index/,scpthe tarball home, terminate the instance. Plan one to two hours including the install (a 33k-chunk index alone took 24 min on an L4), so roughly $0.20 to $1.50 at the hourly prices below. The instance never sees your local search traffic, it only builds the embedding index.
When to use this¶
- You're on a Windows / Linux laptop without an NVIDIA GPU
- Your dev box has an NVIDIA GPU but you'd rather not block it on a long reindex
- You want to schedule a nightly reindex without leaving a workstation on
If you have a Linux GPU host already, just run reindex there and scp the result, see setup.md. This guide is for everyone else.
What you'll have at the end¶
- The directories
index/andlancedb/, containing the LanceDB tables (typically 100 MB–2 GB depending on codebase size) - Unpack it into the
~/codenavi/install on the serving host, set the codebase, start CodeNavi, and queries serve at full quality
The index is environment-independent. Built on Linux + CUDA, it serves from a CPU-only Linux host.
Provider options at a glance¶
| Provider | Instance | GPU | Hourly | Notes |
|---|---|---|---|---|
| AWS EC2 spot | g4dn.xlarge |
T4 16 GB | ~$0.16–0.20 | Cheapest mainstream cloud; spot can be reclaimed mid-build |
| AWS EC2 on-demand | g4dn.xlarge |
T4 16 GB | ~$0.526 | No reclamation risk |
| AWS EC2 spot | g5.xlarge |
A10G 24 GB | ~$0.30–0.40 | Faster, ~2× T4 throughput |
| GCP spot | n1-standard-4 + T4 |
T4 16 GB | ~$0.35 | |
| AWS on-demand, verified | g6.xlarge |
L4 24 GB | see calculator | Full install measured: reindex 3,243 files in 1420 s, Cloud GPU VM |
| GCP on-demand, verified | g2-standard-4 |
L4 24 GB | see calculator | Same, 1444 s (Docker) / 1453 s (Podman, Rocky 9), Cloud GPU VM |
| Azure spot | Standard_NC4as_T4_v3 |
T4 16 GB | ~$0.20–0.30 | |
| Hetzner dedicated | GEX44 |
RTX 4000 16 GB | ~€0.50/hr (no spot) | EU; no spot pricing but no setup tax either |
| Lambda Labs on-demand | gpu_1x_a10 |
A10 24 GB | ~$0.50–0.75 | Simplest UX of the bunch |
| Vast.ai, verified datacenter | varies | A100, L40S, A6000, 4090, RTX PRO Blackwell | ~$0.20–0.60 | Supported for a full CodeNavi deployment under EULA Addendum A, see rented-gpu.md. Turing→Blackwell OK; avoid pre-Turing (Volta/Pascal). |
| Vast.ai: community / spot | varies | 3090 / 4090 etc. | ~$0.10–0.30 | Cheapest, but unverified hosts, not suited for proprietary code; out of scope for Addendum A |
Recommendation: start with AWS g4dn.xlarge spot if you already have an AWS account. For everything else equal, Lambda Labs has the simplest setup. On Vast.ai, use only verified-datacenter offers, these are now a supported CodeNavi deployment tier under EULA Addendum A (see rented-gpu.md); avoid community/spot hosts for proprietary code, as they run on hardware you don't control with unclear data-handling guarantees.
Walkthrough: AWS g4dn.xlarge spot¶
Assumes you have AWS CLI configured and an SSH key pair in your target region.
1. Launch the instance¶
# Pick a Deep Learning AMI (Ubuntu 22.04 + NVIDIA driver + Docker pre-installed)
AMI=$(aws ec2 describe-images \
--owners amazon \
--filters "Name=name,Values=Deep Learning Base OSS Nvidia Driver GPU AMI (Ubuntu 22.04)*" \
--query 'Images | sort_by(@, &CreationDate) | [-1].ImageId' --output text)
# Request a spot instance
aws ec2 request-spot-instances \
--instance-count 1 \
--type one-time \
--launch-specification "{
\"ImageId\": \"$AMI\",
\"InstanceType\": \"g4dn.xlarge\",
\"KeyName\": \"YOUR_KEY\",
\"SecurityGroupIds\": [\"YOUR_SG\"],
\"BlockDeviceMappings\": [{
\"DeviceName\": \"/dev/sda1\",
\"Ebs\": {\"VolumeSize\": 100, \"VolumeType\": \"gp3\"}
}]
}"
100 GB of EBS gp3 covers Docker images (the 1.2 GB baked Buric-E0.6B embedder included) + your codebase + LanceDB output. Cheap (~$0.012/hr while the instance lives).
2. SSH in and install CodeNavi¶
ssh -i ~/.ssh/YOUR_KEY ubuntu@<instance-public-ip>
# Copy your CodeNavi install bundle up from your machine (there is no public
# git distribution — you received a signed release package)
rsync -a ~/codenavi/ ubuntu@<instance-public-ip>:~/codenavi/ # run from your laptop, or scp the release tarball and unpack it
cd ~/codenavi
# Run setup — auto-detects NVIDIA, picks GPU compose path
./setup.sh
# Verify Docker can see the GPU
docker run --rm --gpus all nvidia/cuda:12.4.1-base-ubuntu22.04 nvidia-smi
3. Upload your codebase¶
# From your laptop
rsync -az --exclude=node_modules --exclude=vendor --exclude=.git \
~/myapp/ ubuntu@<instance>:/home/ubuntu/codebase/
# Or have the instance clone it directly if it's a git repo
ssh ubuntu@<instance> 'git clone --depth 1 https://your-git/myapp /home/ubuntu/codebase'
Excluding node_modules, vendor, and other generated directories is critical, they bloat the index without adding signal. CodeNavi's default EXCLUDE_DIRS already filters most, but keeping the upload tight saves time.
4. Configure and reindex¶
ssh ubuntu@<instance>
cd ~/codenavi
# Point CODEBASE_PATH at the codebase you uploaded
sed -i 's|^CODEBASE_PATH=.*|CODEBASE_PATH=/home/ubuntu/codebase|' ~/codenavi/.env
# First run starts the container — the Buric-E0.6B embedder is baked in; only the ~80 MB reranker downloads
TRANSFORMERS_OFFLINE=0 docker compose up -d
docker logs -f codenavi # wait for "Reranker warmed up"
# Trigger the full reindex
./reindex.sh --full
# Wait until "Reindex complete" (33k chunks took 24 min on an L4; a T4 is slower)
docker logs -f codenavi
5. Download the index and tear down¶
# On the instance
cd ~/codenavi && docker compose down
tar czf ~/index.tgz index lancedb $(ls data/aliases_*.json 2>/dev/null)
ls -lh ~/index.tgz # typically 100 MB – 2 GB
# From your laptop
scp ubuntu@<instance>:~/index.tgz ~/Downloads/
# Terminate the spot instance (saves money)
aws ec2 terminate-instances --instance-ids <i-xxxxxxxxxxxx>
Other providers: short notes¶
GCP: verified image families and host steps are on Cloud GPU VM, note the Deep Learning VM image ships no Docker. Use a recent Deep Learning VM Image with NVIDIA driver ≥ 570.65, the cu128 GA image's floor; the older common-cu124-debian-12 ships a ~550 driver and fails CUDA init. Spot/preemptible VM, attach a T4 or newer. Same workflow as AWS; replace aws ec2 with gcloud compute instances create.
Azure: pick the NCasT4_v3 or NC_T4_v3 family. Azure's "Spot" is now called "Spot VM" in the portal. Use the Ubuntu Data Science VM image to skip CUDA install.
Hetzner: provision a GEX44 (RTX 4000) dedicated server from https://hetzner.com/dedicated-rootserver. No spot pricing but no per-hour setup either, flat €0.50/hr. EU jurisdiction may matter for GDPR-conscious shops.
Lambda Labs: easiest path of all, sign up at lambdalabs.com, click "Launch instance", pick gpu_1x_a10. They give you ssh ubuntu@… immediately and the OS is preloaded with NVIDIA drivers + Docker. Same setup.sh && reindex.sh --full workflow.
Then: drop the index on the serving host¶
# On the host where CodeNavi will run (installed, with the same codebase name as on the GPU machine)
cd ~/codenavi && docker compose down
tar xzf ~/Downloads/index.tgz -C ~/codenavi
ls lancedb # should show *_chunks.lance directories per codebase
# Point it at this host's copy of the code
sed -i 's|^CODEBASE_PATH=.*|CODEBASE_PATH=/path/to/your/myapp|' ~/codenavi/.env
# Start CodeNavi
docker compose up -d
curl -s http://localhost:8765/health | python3 -m json.tool
# Expected: tables show non-zero chunks, status=ok
Privacy notes¶
Code chunks do leave your network during the cloud reindex, they're processed on the cloud GPU host. Mitigations:
- Use your own cloud account, the instance, the storage, and the snapshot all live in your VPC. Customer-managed cloud is not third-party processing for most legal frameworks.
- Use spot/ephemeral instances: terminate immediately after the index downloads. There's no persistent state on the cloud side.
- On marketplace GPUs, verified-datacenter only. Vast.ai / RunPod verified-datacenter offers are a supported CodeNavi tier under EULA Addendum A (rented-gpu.md); their community / peer-to-peer offers run on hardware you don't control, avoid those for proprietary code.
- Skip secrets in your codebase, CodeNavi's security scanner (53 rules, security model) masks secrets and PII in the text agents receive, but the index keeps the original and the rsync to the cloud instance happens before the scanner runs. Consider running
git secrets --scanfirst if you don't already gate that in your repo.
For shops where code cannot leave the network at all: the option is a local NVIDIA or AMD GPU box (also the cheapest path long-term).
Reindexing on a schedule¶
If your codebase changes frequently and you want the index fresh, two patterns:
-
Periodic full reindex: cron job on the cloud instance that pulls latest, reindexes, uploads to S3, and the serving host downloads + reloads on a hook. Cost: the hourly price × the run time × frequency.
-
Incremental reindex: keep the cloud instance running (about $115–145 a month for a spot T4 at the price above). When code changes, rsync the diff, run
./reindex.sh(incremental; a few seconds on a small index, longer on a large one), download just the updated*.lancefiles. Cheaper if you reindex multiple times per day.
Most prospects start with option 1, once a week is plenty for stable codebases.
Reporting issues¶
Cloud-specific install issues should include: provider, instance type, GPU model (nvidia-smi -L), docker compose logs codenavi 2>&1 | tail -50, and the output of ./reindex.sh --full from the failing run.
-
Vendor change reference CN-896. ↩