Skip to content

Commit 6e82976

Browse files
Update deployment to us-central1 for Gemini Live Native Audio
- Change region from asia-southeast1 to us-central1 - Update dev.sh to use Vertex AI env vars - Update setup_infra.sh default region
1 parent d596898 commit 6e82976

File tree

4 files changed

+26
-35
lines changed

4 files changed

+26
-35
lines changed

docs/deployment.md

Lines changed: 14 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -2,26 +2,24 @@
22

33
This guide covers deploying Jemmie to Google Cloud Run.
44

5-
---
6-
75
## Prerequisites
86

97
- Google Cloud account with billing enabled
108
- `gcloud` CLI installed and authenticated
119
- Project ID noted
1210

13-
---
14-
1511
## One-Time Infrastructure Setup
1612

17-
Run the setup script to enable APIs, create Artifact Registry, and configure Firestore:
13+
Run the setup script to enable APIs, create Artifact Registry, and configure Firestore.
1814

1915
```bash
2016
export PROJECT_ID="your-project-id"
17+
export REGION=us-central1
2118
./scripts/setup_infra.sh $PROJECT_ID
2219
```
2320

2421
This enables:
22+
2523
- Cloud Run API
2624
- Artifact Registry API
2725
- Cloud Build API
@@ -30,8 +28,6 @@ This enables:
3028

3129
And grants Vertex AI permissions to the Cloud Run service account.
3230

33-
---
34-
3531
## GitHub Actions Setup
3632

3733
### 1. Create Service Account
@@ -65,14 +61,11 @@ rm key.json
6561
### 3. Add GitHub Secrets
6662

6763
Navigate to your repository: **Settings → Secrets and variables → Actions**
68-
6964
| Secret | Value |
7065
|--------|-------|
7166
| `GCP_PROJECT_ID` | Your GCP project ID |
7267
| `GCP_SERVICE_ACCOUNT_KEY` | Base64 output from step 2 |
7368

74-
---
75-
7669
## Deploy
7770

7871
Push to main branch:
@@ -82,45 +75,41 @@ git push origin main
8275
```
8376

8477
The CI pipeline will:
78+
8579
1. Run lint, type check, and tests
8680
2. Build Docker image (production target)
8781
3. Push to Artifact Registry
8882
4. Deploy to Cloud Run
8983

90-
---
91-
9284
## Cloud Run Configuration
9385

94-
| Setting | Value | Purpose |
95-
|---------|-------|---------|
96-
| Session affinity | Enabled | Keeps reconnects on same instance |
97-
| Timeout | 3600s | Long-lived WebSocket connections |
98-
| Min instances | 1 | Prevents cold start |
99-
| Authentication | Unauthenticated | Device-as-identity model |
100-
101-
---
86+
| Setting | Value | Purpose |
87+
|------------------|-----------------|-----------------------------------|
88+
| Session affinity | Enabled | Keeps reconnects on same instance |
89+
| Timeout | 3600s | Long-lived WebSocket connections |
90+
| Min instances | 1 | Prevent cold start |
91+
| Authentication | Unauthenticated | Device-as-identity model |
10292

10393
## Verification
10494

10595
After deployment:
10696

10797
```bash
10898
SERVICE_URL=$(gcloud run services describe jemmie-backend \
109-
--region=asia-southeast1 \
99+
--region=us-central1 \
110100
--format='value(status.url)')
111101

112102
curl $SERVICE_URL/health
113103
```
114104

115105
WebSocket endpoint: `wss://{service-url}/ws/{device_id}`
116106

117-
---
118-
119107
## Troubleshooting
120108

121109
### Deployment fails with permission error
122110

123111
Ensure the service account has all required roles:
112+
124113
```bash
125114
gcloud projects get-iam-policy $PROJECT_ID \
126115
--flatten="bindings[].members" \
@@ -130,6 +119,7 @@ gcloud projects get-iam-policy $PROJECT_ID \
130119
### Cloud Run returns 403 on Vertex AI calls
131120

132121
Grant Vertex AI permissions to the Cloud Run service account:
122+
133123
```bash
134124
PROJECT_NUMBER=$(gcloud projects describe $PROJECT_ID --format='value(projectNumber)')
135125
gcloud projects add-iam-policy-binding $PROJECT_ID \
@@ -140,6 +130,7 @@ gcloud projects add-iam-policy-binding $PROJECT_ID \
140130
### WebSocket connections drop
141131

142132
Check Cloud Run timeout and session affinity settings:
133+
143134
```bash
144135
gcloud run services describe jemmie-backend \
145136
--region=us-central1 \

scripts/dev.sh

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
#!/bin/bash
22
set -e
33

4-
if [ -z "$GOOGLE_API_KEY" ]; then
5-
echo "ERROR: GOOGLE_API_KEY environment variable not set!"
6-
echo ""
7-
echo "Get your API key from: https://aistudio.google.com/apikey"
8-
echo "Then run:"
9-
echo ""
10-
echo " export GOOGLE_API_KEY=your-api-key"
11-
echo " ./scripts/dev.sh"
12-
exit 1
13-
fi
4+
# For local development with Gemini API
5+
# Get your API key from: https://aistudio.google.com/apikey
6+
# Then run:
7+
# export GOOGLE_API_KEY=your-api-key
8+
# export GOOGLE_GENAI_USE_VERTEXAI=FALSE
9+
# ./scripts/dev.sh
10+
#
11+
# For production, GOOGLE_GENAI_USE_VERTEXAI=TRUE is set in Cloud Run
12+
13+
# (no API key needed - uses Application Default Credentials)
1414

1515
echo "Starting development environment..."
1616
echo "WebSocket endpoint: ws://localhost:8080/ws/{device_id}"

scripts/setup_artifact_registry.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
set -e
33

44
PROJECT_ID="${1:-$(gcloud config get-value project)}"
5-
REGION="${REGION:-asia-southeast1}"
5+
REGION="${REGION:-us-central1}"
66
REPO_NAME="jemmie-backend"
77

88
echo "Creating Artifact Registry repository..."

scripts/setup_infra.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
set -e
33

44
PROJECT_ID="${1:-$(gcloud config get-value project)}"
5-
REGION="${REGION:-asia-southeast1}"
5+
REGION="${REGION:-us-central1}"
66

77
echo "Setting up infrastructure for project: $PROJECT_ID"
88
echo ""

0 commit comments

Comments
 (0)