Copy and paste these commands in order to deploy LegalMind to Google Cloud.
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
.\setup-gcp.ps1chmod +x setup-gcp.sh
./setup-gcp.shRun this after the setup script completes:
# Replace YOUR_PROJECT_ID with your actual project ID
gcloud iam service-accounts keys create firebase-key.json \
--iam-account=legalmind-backend@YOUR_PROJECT_ID.iam.gserviceaccount.comWindows (PowerShell):
$content = Get-Content firebase-key.json -Raw
[Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes($content)) | Set-Clipboard
# Now paste into GitHub secretmacOS/Linux:
cat firebase-key.json | base64 -w 0 | pbcopy # macOS
cat firebase-key.json | base64 -w 0 | xclip # LinuxGo to: Settings → Secrets and variables → Actions → New repository secret
Add these secrets:
| Name | Value |
|---|---|
GCP_PROJECT_ID |
(from setup script output) |
WIF_PROVIDER |
(from setup script output) |
WIF_SERVICE_ACCOUNT |
(from setup script output) |
CLOUD_RUN_SERVICE_ACCOUNT |
(from setup script output) |
FIREBASE_SERVICE_ACCOUNT |
(base64 encoded JSON from step 2) |
API_URL |
(leave empty for now) |
git add .
git commit -m "Deploy LegalMind to Google Cloud"
git push origin mainWatch the deployment in: Actions → deploy-backend.yml and deploy-frontend.yml
gcloud run services describe legalmind-backend \
--region us-central1 \
--format='value(status.url)'https://YOUR_PROJECT_ID.web.appOnce you have your backend URL, add it to GitHub:
# Copy the Cloud Run URL from step 5 and add as API_URL secretcurl https://legalmind-backend-YOUR_PROJECT_ID.cloudfunctions.net/docsgcloud run logs read legalmind-backend \
--region us-central1 \
--followgcloud run services list --region us-central1gcloud firestore databases listSimply push to main branch:
git push origin mainGitHub Actions will automatically redeploy both frontend and backend.
# View previous revisions
gcloud run revisions list \
--service=legalmind-backend \
--region=us-central1
# Route traffic to previous revision
gcloud run services update-traffic legalmind-backend \
--to-revisions=REVISION_NAME=100 \
--region=us-central1firebase hosting:channel:list
# Select previous deployment and promote to livegcloud run logs read legalmind-backend \
--region us-central1 \
--followgcloud run logs read legalmind-backend \
--region us-central1 \
--limit 50gcloud run services describe legalmind-backend \
--region us-central1gcloud monitoring dashboards listgcloud run services delete legalmind-backend \
--region us-central1gsutil -r rm gs://YOUR_PROJECT_ID-documents
gsutil -r rm gs://YOUR_PROJECT_ID-artifactsfirebase hosting:disablegcloud run deploy legalmind-backend \
--set-env-vars="DEBUG=false,GOOGLE_CLOUD_PROJECT=YOUR_PROJECT_ID" \
--region us-central1Edit .env or next.config.ts and redeploy:
git push origin maingcloud firestore export gs://YOUR_PROJECT_ID-backups/backup-$(date +%s)gcloud firestore import gs://YOUR_PROJECT_ID-backups/backup-TIMESTAMPgsutil -r cp gs://YOUR_PROJECT_ID-documents/path/to/file ./local-pathFor issues, check:
- GitHub Actions logs: Actions → Select workflow → View logs
- Cloud Run logs:
gcloud run logs read legalmind-backend --region us-central1 - Firebase Hosting logs:
firebase hosting:sites list - Deployment guides: DEPLOYMENT_GUIDE.md
Last Updated: February 4, 2026 Status: Ready for Deployment ✅