-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeploy_gce.sh
More file actions
executable file
·43 lines (37 loc) · 1.79 KB
/
Copy pathdeploy_gce.sh
File metadata and controls
executable file
·43 lines (37 loc) · 1.79 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/usr/bin/env bash
# Deploy the LangCache demo to the GCE VM behind langcache.platformengineer.io.
# Run from the repo root on your laptop. Requires gcloud auth.
#
# Topology (since 2026-07): the demo runs ON the gabs-demos VM (the wildcard
# Caddy host, static IP gabs-demos-ip) as a plain docker container named
# langcache-demo, env in /root/langcache.env, Caddy proxying 127.0.0.1:7860.
#
# Usage: ./deploy_gce.sh [image-tag] (default: v4.0.0-en)
set -euo pipefail
TAG="${1:-v4.0.0-en}"
IMAGE="langcache-demo:${TAG}"
VM="gabs-demos"
ZONE="us-central1-a"
PROJECT="central-beach-194106"
TARBALL="$(mktemp -d)/langcache-src.tgz"
echo ">> Packing source (no .env, no venv, no heavy artifacts)"
tar czf "$TARBALL" \
--exclude='.git' --exclude='.venv' --exclude='.env' --exclude='.idea' \
--exclude='__pycache__' --exclude='harness*' --exclude='*.pdf' --exclude='*.tar.gz' .
echo ">> Copying to VM"
gcloud compute scp --zone "$ZONE" --project "$PROJECT" "$TARBALL" "$VM:/tmp/langcache-src.tgz"
echo ">> Building ${IMAGE} and recreating the container (env stays in /root/langcache.env)"
gcloud compute ssh --zone "$ZONE" "$VM" --project "$PROJECT" --command "sudo sh -c '
set -e
test -s /root/langcache.env || { echo \"ERROR: /root/langcache.env missing on the VM\"; exit 1; }
rm -rf /root/langcache-src && mkdir -p /root/langcache-src
tar xzf /tmp/langcache-src.tgz -C /root/langcache-src
cd /root/langcache-src
docker build -t ${IMAGE} -t langcache-demo:latest .
docker rm -f langcache-demo >/dev/null 2>&1 || true
docker run -d --name langcache-demo --restart unless-stopped \
-p 127.0.0.1:7860:7860 --env-file /root/langcache.env ${IMAGE}
'"
echo ">> Validating"
sleep 8
curl -fsS https://langcache.platformengineer.io/healthz && echo && echo "Deploy OK: https://langcache.platformengineer.io"