-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeploy.sh
More file actions
executable file
·71 lines (55 loc) · 1.57 KB
/
deploy.sh
File metadata and controls
executable file
·71 lines (55 loc) · 1.57 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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#!/bin/bash
# Simple Cloud Build deployment script for libpostal-api
# This script uses the cloudbuild.yaml configuration for deployment
set -e
# Configuration
PROJECT_ID="${PROJECT_ID:-libpostal-api}"
REGION="${REGION:-us-central1}"
IMAGE_NAME="gcr.io/${PROJECT_ID}/libpostal-api"
# Colors for output
GREEN='\033[0;32m'
RED='\033[0;31m'
YELLOW='\033[1;33m'
NC='\033[0m'
log_info() {
echo -e "${GREEN}[INFO]${NC} $1"
}
log_error() {
echo -e "${RED}[ERROR]${NC} $1"
}
log_info "Building Docker image locally..."
log_info "Project: $PROJECT_ID"
log_info "Image: $IMAGE_NAME"
# Build Docker image locally
docker build -t "$IMAGE_NAME" .
log_info "Pushing image to Google Container Registry..."
# Configure Docker to use gcloud as credential helper
gcloud auth configure-docker --quiet
# Push the image
docker push "$IMAGE_NAME"
log_info "Deploying to Cloud Run..."
# Deploy to Cloud Run
gcloud run deploy libpostal-api \
--image="$IMAGE_NAME" \
--platform=managed \
--region="$REGION" \
--project="$PROJECT_ID" \
--memory=3Gi \
--cpu=1 \
--max-instances=10 \
--min-instances=0 \
--concurrency=500 \
--timeout=900 \
--allow-unauthenticated \
--set-env-vars=RUST_LOG=info \
--port=3000 \
--execution-environment=gen2
log_info "Deployment completed! 🚀"
# Get service URL
SERVICE_URL=$(gcloud run services describe libpostal-api \
--platform=managed \
--region="$REGION" \
--project="$PROJECT_ID" \
--format="value(status.url)")
log_info "Service URL: $SERVICE_URL"
log_info "Health check: $SERVICE_URL/api/v1/health"