Tilt Local Development
Tilt provides fast, iterative local development by watching source files and automatically syncing changes into your Kind cluster. This is the recommended development workflow for Knodex.
Prerequisites
| Tool | Version | Install |
|---|---|---|
| Tilt | latest | brew install tilt |
| Kind | 0.20+ | brew install kind |
| kubectl | 1.28+ | brew install kubectl |
| Docker | 24+ | docker.com |
Quick Start
# 1. Create a Kind cluster with KRO and CRDs
make cluster-up
# 2. Start Tilt
make tilt-up
# 3. Open the Tilt UI to monitor services
open http://localhost:10350
Architecture
┌──────────────────────────────────────────────────────┐
│ Your Machine │
│ │
│ ┌────────────┐ watches ┌───────────────────┐ │
│ │ Source │───────────────▶│ Tilt │ │
│ │ .go / .tsx │ │ (orchestrator) │ │
│ └────────────┘ └────────┬──────────┘ │
│ │ │
│ ┌────────────────────┐ ┌──────────▼──────────┐ │
│ │ Vite Dev Server │ │ Kind Cluster │ │
│ │ :3000 (HMR) │ │ │ │
│ │ │ │ ┌────────────────┐ │ │
│ │ Proxies API ──────────▶│ │ knodex-server │ │ │
│ │ to :8080 │ │ │ :8080 │ │ │
│ │ │ │ └───────┬────────┘ │ │
│ └────────────────────┘ │ │ │ │
│ │ ┌───────▼────────┐ │ │
│ │ │ Redis │ │ │
│ │ │ :6379 │ │ │
│ │ └────────────────┘ │ │
│ └──────────────────────┘ │
└──────────────────────────────────────────────────────┘
Live Update Flow
Server (Go)
- Edit a
.gofile - Tilt detects the change
- Source files are synced into the container
- Air (hot-reload tool) rebuilds the binary
- Server restarts automatically
Typical turnaround: ~10-15 seconds
Web (React/TypeScript)
- Edit a
.tsxor.tsfile - Vite HMR picks up the change instantly
- Browser updates without a full page reload
Typical turnaround: ~1-2 seconds
Usage
Starting Tilt
# Foreground (logs stream to terminal)
make tilt-up
# Background (detached)
tilt up -d
Stopping Tilt
# If running in foreground
# Press Ctrl+C
# Cleanup resources
make tilt-down
Tilt UI
The Tilt UI at http://localhost:10350 provides:
- Resource status: See which services are running, building, or errored
- Log streaming: View logs from each service in real time
- Trigger buttons: Manually trigger rebuilds
- Keyboard shortcuts: Press
?in the UI to see all shortcuts
Port Forwarding
Tilt automatically sets up port forwarding for all services:
| Service | Port | URL |
|---|---|---|
| Knodex Server | 8080 | http://localhost:8080 |
| Vite Dev Server | 3000 | http://localhost:3000 |
| Redis | 6379 | localhost:6379 |
| Tilt UI | 10350 | http://localhost:10350 |
Access the app through http://localhost:3000 during development. The Vite dev server proxies API requests to the server on :8080 and provides HMR for instant frontend updates.
Development Workflow
Typical Session
- Start your cluster and Tilt:
make cluster-up # Only needed oncemake tilt-up
- Open
http://localhost:3000in your browser - Open the Tilt UI at
http://localhost:10350in another tab - Edit code -- changes appear automatically
- Check the Tilt UI if something looks wrong
- When done, press
Ctrl+Cand optionally runmake tilt-down
Forcing a Rebuild
If Tilt does not pick up a change, trigger a rebuild manually:
# From the CLI
tilt trigger knodex-server
# Or click the trigger button in the Tilt UI
Viewing Logs
# Stream all logs
tilt logs
# Stream logs for a specific resource
tilt logs knodex-server
# Or use the Tilt UI log panel
Configuration
Tiltfile Options
Pass flags through make tilt-up or directly to tilt up:
# Use a custom namespace
tilt up -- --namespace=my-namespace
# Enable enterprise features
tilt up -- --enterprise
Environment Variables
Environment variables for the server can be set in the Tiltfile or via Kubernetes ConfigMaps. Common overrides:
| Variable | Purpose |
|---|---|
LOG_LEVEL | Set to debug for verbose output |
SWAGGER_UI_ENABLED | Automatically set to true in Tilt |
REDIS_ADDRESS | Override Redis connection |
Troubleshooting
Cluster Not Found
Error: no kind cluster found
Run make cluster-up to create the Kind cluster before starting Tilt.
Port Already in Use
Error: listen tcp :3000: bind: address already in use
Kill the process using the port:
lsof -ti :3000 | xargs kill -9
Pod in CrashLoopBackOff
Check the logs in the Tilt UI or via CLI:
tilt logs knodex-server
kubectl logs -f deployment/knodex-server -n knodex
Common causes:
- Redis not ready yet (wait a few seconds for the init container)
- Missing environment variables
- CRDs not applied (
make cluster-uphandles this)
Files Not Syncing
If live update seems stuck:
- Check the Tilt UI for sync errors
- Try
tilt trigger <resource>to force a sync - Restart Tilt:
Ctrl+C, thenmake tilt-up
Slow Rebuilds
- Ensure Docker has adequate resources (at least 4 GB RAM, 2 CPUs)
- Close other Docker-heavy workloads
- Check that your Go module cache is warm (
go mod download)
Full Reset
If things are in a bad state, tear everything down and start fresh:
make tilt-down
kind delete cluster --name knodex
make cluster-up
make tilt-up
Comparison: Development Modes
make dev | make qa | make tilt-up | |
|---|---|---|---|
| First deploy | ~5s (native) | ~2-3 min (full deploy) | ~1-2 min (build + deploy) |
| Code change | Instant (native) | Redeploy required | ~1-2s (web), ~10-15s (server) |
| Kubernetes | No (runs locally) | Yes (full cluster) | Yes (Kind cluster) |
| Redis | External required | Deployed automatically | Deployed automatically |
| Best for | Quick iteration without K8s | Full integration testing | Realistic K8s development |