-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdeploy.sh
More file actions
executable file
·69 lines (58 loc) · 2.01 KB
/
deploy.sh
File metadata and controls
executable file
·69 lines (58 loc) · 2.01 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
#!/bin/bash
# GCP Cloud Run Deployment Script
# This script helps deploy the News Curation API to Google Cloud Run
set -e
PROJECT_ID="jan26-intern-c"
SERVICE_NAME="news-curation-api"
REGION="us-central1"
echo "🚀 Starting deployment to GCP Cloud Run..."
echo "Project: $PROJECT_ID"
echo "Service: $SERVICE_NAME"
echo "Region: $REGION"
echo ""
# Check if gcloud is installed
if ! command -v gcloud &> /dev/null; then
echo "❌ Error: gcloud CLI is not installed"
echo "Install it from: https://cloud.google.com/sdk/docs/install"
exit 1
fi
# Check if user is authenticated
if ! gcloud auth list --filter=status:ACTIVE --format="value(account)" | grep -q .; then
echo "⚠️ Not authenticated. Running gcloud auth login..."
gcloud auth login
fi
# Set project
echo "📋 Setting project to $PROJECT_ID..."
gcloud config set project $PROJECT_ID
# Enable required APIs
echo "🔧 Enabling required APIs..."
gcloud services enable cloudbuild.googleapis.com --quiet
gcloud services enable run.googleapis.com --quiet
gcloud services enable containerregistry.googleapis.com --quiet
# Deploy to Cloud Run
echo "🏗️ Building and deploying to Cloud Run..."
echo ""
echo "⚠️ NOTE: You'll need to set environment variables in the Cloud Run console after deployment."
echo " Go to: Cloud Run > $SERVICE_NAME > Edit & Deploy New Revision > Variables & Secrets"
echo ""
gcloud run deploy $SERVICE_NAME \
--source . \
--platform managed \
--region $REGION \
--allow-unauthenticated \
--memory 512Mi \
--cpu 1 \
--timeout 300 \
--max-instances 10
echo ""
echo "✅ Deployment complete!"
echo ""
echo "📝 Next steps:"
echo "1. Go to Cloud Run console: https://console.cloud.google.com/run"
echo "2. Click on your service: $SERVICE_NAME"
echo "3. Click 'Edit & Deploy New Revision'"
echo "4. Go to 'Variables & Secrets' tab"
echo "5. Add all environment variables from your .env file"
echo "6. Click 'Deploy'"
echo ""
echo "🔗 Your service URL will be shown above after deployment completes."