Metabase Production - Quick Fix Guide
One-Command Fix for Production
# Run the automated fix script (auto-detects barto-prod)
./scripts/fix-metabase-cloudsql.sh production
Manual Production Fix
If you prefer to fix it manually:
# 1. Verify Cloud SQL instances exist
gcloud sql instances describe metabase-db-production --project=barto-prod
gcloud sql instances describe flowpos-db-production --project=barto-prod
# 2. Fix the service configuration
gcloud run services update flowpos-metabase-production \
--region=us-central1 \
--project=barto-prod \
--clear-vpc-connector \
--add-cloudsql-instances=barto-prod:us-central1:metabase-db-production,barto-prod:us-central1:flowpos-db-production
# 3. Verify the fix
gcloud run services describe flowpos-metabase-production \
--region=us-central1 \
--project=barto-prod \
--format="value(spec.template.metadata.annotations['run.googleapis.com/cloudsql-instances'])"
Production Configuration
- Service Name:
flowpos-metabase-production - Project:
barto-prod - Region:
us-central1 - Cloud SQL Instances:
barto-prod:us-central1:metabase-db-production(Metabase metadata database)barto-prod:us-central1:flowpos-db-production(Application database)
What Changed
The Dockerfile now includes a wait script that:
- Waits for Cloud SQL Proxy to be ready before starting Metabase
- Tests the connection to ensure the proxy is accessible
- Prevents Metabase from crashing on startup due to connection failures
This fix applies to both staging and production - the same Dockerfile is used for both environments.
Next Steps
- The fix is already in the Dockerfile - no additional changes needed
- The next deployment (via GitHub Actions or manual) will automatically use the new image
- Monitor the logs to see the wait script in action:
gcloud logging read \
"resource.type=cloud_run_revision AND resource.labels.service_name=flowpos-metabase-production" \
--limit=50 \
--project=barto-prod \
--format="table(timestamp,severity,textPayload)"
Troubleshooting
If issues persist, see the full troubleshooting guide: cloudsql-troubleshooting.md