Skip to main content

⚡ Quick Start: Deploy to New GCP Project

Time estimate: 30-45 minutes
Prerequisites: gcloud CLI, Terraform, Node.js 18+, Firebase CLI

📝 Before You Start

You'll need to prepare these values (they'll go in your .env file).


🚀 Deployment Commands (Copy & Paste)

1️⃣ Configure Environment

# Copy the example configuration
cp env.example .env

# Edit .env with your values
nano .env

Update these key values:

  • PROJECT_ID - Your GCP project ID (must be globally unique)
  • BILLING_ACCOUNT_ID - Your GCP billing account ID
  • REGION - Deployment region (e.g., asia-southeast1)
  • Firebase configuration (from Firebase Console)
  • Jira credentials
  • Bitbucket credentials

2️⃣ Create GCP Project

# Load configuration
set -a
source .env
set +a

# Login
gcloud auth login
gcloud auth application-default login

# Create and configure project
gcloud projects create $PROJECT_ID --name="$PROJECT_NAME"
gcloud config set project $PROJECT_ID
gcloud billing projects link $PROJECT_ID --billing-account=$BILLING_ACCOUNT_ID

# Enable APIs
gcloud services enable \
cloudbuild.googleapis.com \
run.googleapis.com \
secretmanager.googleapis.com \
firestore.googleapis.com \
cloudscheduler.googleapis.com \
firebase.googleapis.com \
--project=$PROJECT_ID

3️⃣ Set Up Firebase (Web Console)

  1. Go to https://console.firebase.google.com
  2. Click "Add project" → Select your GCP project
  3. Enable Email/Password authentication
  4. Create Firestore database (Production mode, asia-southeast1)
  5. Register Web app → Copy config (you'll need this!)
  6. Generate Service account key → Save as firebase-service-account.json
# Deploy Firebase rules and indexes
firebase deploy --only firestore:rules,firestore:indexes --project=$PROJECT_ID

Note: Add Firebase config values to your .env file from step 3.

4️⃣ Configure Secrets

# Run setup script (uses .env configuration)
./setup-secrets.sh

Enter when prompted:

  • Firebase config values
  • Path to firebase-service-account.json
  • Jira credentials
  • Bitbucket credentials

5️⃣ Deploy to Cloud Run

# Make executable and deploy
chmod +x deploy-to-gcp.sh deploy-all.sh
./deploy-to-gcp.sh

⏱️ Wait 5-10 minutes for build and deployment

📝 Copy the Cloud Run URL (shown at the end)

6️⃣ Add Authorized Domain to Firebase

  1. Go to Firebase Console → AuthenticationSettingsAuthorized domains
  2. Click "Add domain"
  3. Paste your Cloud Run domain (without https://): your-service-xxxxx.run.app

7️⃣ Deploy Cloud Scheduler

cd terraform

# Create terraform.tfvars
cp terraform.tfvars.example terraform.tfvars
nano terraform.tfvars

Update with your values:

project_id             = "your-project-id"
region = "asia-southeast1"
cloud_run_service_name = "gamuda-jira-tracker"
app_url = "https://your-service-xxxxx.run.app"
sync_schedule = "0 1 * * *"
time_zone = "Asia/Kuala_Lumpur"
# Deploy
terraform init
terraform plan
terraform apply

Type yes when prompted.

8️⃣ Initial Setup

  1. Access app: Open your Cloud Run URL
  2. Register: Create admin account
  3. Login: Use your credentials
  4. Upload configs: Go to Settings
    • Upload configs/team-config.json
    • Upload configs/project-mappings.json
  5. Initial Sync: Go to Sync Manager → Click "Sync All Data"
    • ⏱️ Wait 10-30 minutes

9️⃣ Test Scheduler

# Manually trigger
gcloud scheduler jobs run daily-jira-bitbucket-sync --location=$REGION

# Check logs
gcloud scheduler jobs describe daily-jira-bitbucket-sync --location=$REGION
gcloud logging read "resource.type=cloud_scheduler_job" --limit=10

🔟 Enable Auto-Sync (Optional)

  1. Go to your app → Settings
  2. Toggle "Enable Auto-Sync" to ON
  3. Set time: 01:00
  4. Click "Save Settings"

✅ Verification

Test these features:

  • Can access application
  • Can register and login
  • Dashboard shows data
  • Projects page works
  • Engineers page works
  • Manual sync completes
  • Scheduler job exists
# Quick verification commands
gcloud run services describe $SERVICE_NAME --region=$REGION --format="value(status.url)"
gcloud scheduler jobs list --location=$REGION
gcloud secrets list

🐛 Quick Troubleshooting

Build fails?

gcloud builds list --limit=5
gcloud services list --enabled | grep cloudbuild

Secrets not working?

PROJECT_NUMBER=$(gcloud projects describe $PROJECT_ID --format="value(projectNumber)")
SERVICE_ACCOUNT="${PROJECT_NUMBER}-compute@developer.gserviceaccount.com"

# Grant access to all secrets
for SECRET in jira-api-token jira-username jira-base-url bitbucket-api-token bitbucket-username bitbucket-workspace firebase-service-account firebase-api-key firebase-auth-domain firebase-project-id firebase-storage-bucket firebase-messaging-sender-id firebase-app-id; do
gcloud secrets add-iam-policy-binding $SECRET \
--member="serviceAccount:${SERVICE_ACCOUNT}" \
--role="roles/secretmanager.secretAccessor" \
--project=$PROJECT_ID
done

Can't access app?

# Check Cloud Run status
gcloud run services describe $SERVICE_NAME --region=$REGION

# View logs
gcloud run services logs read $SERVICE_NAME --region=$REGION --limit=50

Scheduler not working?

# Enable API if needed
gcloud services enable cloudscheduler.googleapis.com

# Check job
gcloud scheduler jobs list --location=$REGION

📚 Full Documentation


🎉 You're Done!

Your application is now deployed and running!

Access your app: https://your-service-xxxxx.run.app

Monitor:


Deployment Date: _________________ | Project ID: _________________