2026-05-04 06:45:23 +01:00
|
|
|
# --- OpenStaticFish MicroServices Tiltfile ---
|
|
|
|
|
#
|
|
|
|
|
# Nix-managed dependencies:
|
|
|
|
|
# Run `nix develop` or use `nix run .#tilt -- up` to enter the dev shell
|
|
|
|
|
# with tilt, kubectl, docker, and all other deps available.
|
|
|
|
|
#
|
|
|
|
|
# Quick reference:
|
|
|
|
|
# nix run .#setup-kind - Create/select local Kind cluster
|
|
|
|
|
# tilt up - Start all services (live reload enabled)
|
|
|
|
|
# tilt down - Tear down all deployed resources
|
|
|
|
|
# tilt ui - Open the Tilt web UI (default: http://localhost:10350)
|
|
|
|
|
# tilt logs - Stream aggregated logs
|
|
|
|
|
# tilt status - Show resource status
|
|
|
|
|
|
|
|
|
|
# --- Global Settings ---
|
|
|
|
|
# Nix command wrapper:
|
|
|
|
|
# nix run .#setup-kind
|
|
|
|
|
#
|
|
|
|
|
# This creates/selects the supported local Kind context below.
|
|
|
|
|
allow_k8s_contexts('kind-openstaticfish')
|
|
|
|
|
|
2026-05-04 07:34:44 +01:00
|
|
|
# --- Scraper Service ---
|
2026-05-04 06:45:23 +01:00
|
|
|
# Builds the Docker image and deploys the manifest with live reload
|
2026-05-04 07:34:44 +01:00
|
|
|
docker_build('scraper', './services/scraper')
|
2026-05-04 10:36:34 +01:00
|
|
|
docker_build('site-analyzer', './services/site-analyzer')
|
2026-05-04 06:45:23 +01:00
|
|
|
|
2026-05-04 07:34:44 +01:00
|
|
|
k8s_yaml('./k8s/scraper.yaml')
|
2026-05-04 10:36:34 +01:00
|
|
|
k8s_yaml('./k8s/site-analyzer.yaml')
|
2026-05-04 06:45:23 +01:00
|
|
|
|
2026-05-04 09:42:24 +01:00
|
|
|
local_resource(
|
|
|
|
|
'webshare-secret',
|
|
|
|
|
cmd='set -a; [ ! -f .env ] || . ./.env; set +a; if [ -n "$WEBSHARE_API_KEY" ] && [ -n "$WEBSHARE_PROXY_USERNAME" ] && [ -n "$WEBSHARE_PROXY_PASSWORD" ]; then kubectl create secret generic webshare-api --from-literal=api-key="$WEBSHARE_API_KEY" --from-literal=proxy-username="$WEBSHARE_PROXY_USERNAME" --from-literal=proxy-password="$WEBSHARE_PROXY_PASSWORD" --dry-run=client -o yaml | kubectl apply -f -; else echo "Webshare runtime config missing; country scraping unavailable"; fi',
|
|
|
|
|
labels=['utility'],
|
|
|
|
|
)
|
|
|
|
|
|
2026-05-04 06:45:23 +01:00
|
|
|
# Watch source files for live reload
|
|
|
|
|
k8s_resource(
|
2026-05-04 07:34:44 +01:00
|
|
|
workload='scraper-deployment',
|
2026-05-04 06:45:23 +01:00
|
|
|
port_forwards='8080:8080',
|
2026-05-04 09:42:24 +01:00
|
|
|
resource_deps=['webshare-secret'],
|
2026-05-04 07:34:44 +01:00
|
|
|
labels=['scraper'],
|
2026-05-04 06:45:23 +01:00
|
|
|
)
|
|
|
|
|
|
2026-05-04 10:36:34 +01:00
|
|
|
k8s_resource(
|
|
|
|
|
workload='site-analyzer-deployment',
|
|
|
|
|
port_forwards='8090:8090',
|
|
|
|
|
labels=['site-analyzer'],
|
|
|
|
|
)
|
|
|
|
|
|
2026-05-04 06:45:23 +01:00
|
|
|
# --- Local Resources ---
|
|
|
|
|
# Run a simple health check as a local resource
|
|
|
|
|
local_resource(
|
|
|
|
|
'health-check',
|
|
|
|
|
cmd='curl -sf http://localhost:8080/health || echo "Service not ready"',
|
2026-05-04 07:34:44 +01:00
|
|
|
resource_deps=['scraper-deployment'],
|
2026-05-04 06:45:23 +01:00
|
|
|
labels=['utility'],
|
|
|
|
|
)
|
2026-05-04 10:36:34 +01:00
|
|
|
|
|
|
|
|
local_resource(
|
|
|
|
|
'site-analyzer-health-check',
|
|
|
|
|
cmd='curl -sf http://localhost:8090/health || echo "Site analyzer not ready"',
|
|
|
|
|
resource_deps=['site-analyzer-deployment'],
|
|
|
|
|
labels=['utility'],
|
|
|
|
|
)
|