new commands to deploy dataconnect to front
This commit is contained in:
77
Makefile
77
Makefile
@@ -4,7 +4,7 @@
|
|||||||
# It is designed to be the main entry point for developers.
|
# It is designed to be the main entry point for developers.
|
||||||
|
|
||||||
# Use .PHONY to declare targets that are not files, to avoid conflicts.
|
# Use .PHONY to declare targets that are not files, to avoid conflicts.
|
||||||
.PHONY: help install dev build integrate-export prepare-export deploy-launchpad deploy-launchpad-full deploy-app admin-install admin-dev admin-build deploy-admin deploy-admin-full configure-iap-launchpad configure-iap-admin list-iap-users remove-iap-user setup-labels export-issues create-issues-from-file install-git-hooks mobile-client-install mobile-client-dev mobile-client-build mobile-staff-install mobile-staff-dev mobile-staff-build
|
.PHONY: help install dev build integrate-export prepare-export deploy-launchpad deploy-launchpad-full deploy-app admin-install admin-dev admin-build deploy-admin deploy-admin-full configure-iap-launchpad configure-iap-admin list-iap-users remove-iap-user setup-labels export-issues create-issues-from-file install-git-hooks mobile-client-install mobile-client-dev mobile-client-build mobile-staff-install mobile-staff-dev mobile-staff-build dataconnect-enable-apis dataconnect-init dataconnect-deploy dataconnect-sql-migrate dataconnect-generate-sdk dataconnect-sync dataconnect-bootstrap-db
|
||||||
|
|
||||||
# The default command to run if no target is specified (e.g., just 'make').
|
# The default command to run if no target is specified (e.g., just 'make').
|
||||||
.DEFAULT_GOAL := help
|
.DEFAULT_GOAL := help
|
||||||
@@ -38,10 +38,12 @@ ifeq ($(ENV),staging)
|
|||||||
GCP_PROJECT_ID := $(GCP_STAGING_PROJECT_ID)
|
GCP_PROJECT_ID := $(GCP_STAGING_PROJECT_ID)
|
||||||
FIREBASE_ALIAS := staging
|
FIREBASE_ALIAS := staging
|
||||||
HOSTING_TARGET := app-staging
|
HOSTING_TARGET := app-staging
|
||||||
|
SQL_TIER := db-n1-standard-1
|
||||||
else
|
else
|
||||||
GCP_PROJECT_ID := $(GCP_DEV_PROJECT_ID)
|
GCP_PROJECT_ID := $(GCP_DEV_PROJECT_ID)
|
||||||
FIREBASE_ALIAS := dev
|
FIREBASE_ALIAS := dev
|
||||||
HOSTING_TARGET := app-dev
|
HOSTING_TARGET := app-dev
|
||||||
|
SQL_TIER := db-g1-small
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# --- Conditional Variables by Service for IAP commands ---
|
# --- Conditional Variables by Service for IAP commands ---
|
||||||
@@ -95,6 +97,10 @@ help:
|
|||||||
@echo " make dataconnect-enable-apis - Enables required GCP APIs for Data Connect."
|
@echo " make dataconnect-enable-apis - Enables required GCP APIs for Data Connect."
|
||||||
@echo " make dataconnect-init - Initializes Firebase Data Connect (interactive wizard)."
|
@echo " make dataconnect-init - Initializes Firebase Data Connect (interactive wizard)."
|
||||||
@echo " make dataconnect-deploy - Deploys Data Connect schemas (GraphQL -> Cloud SQL)."
|
@echo " make dataconnect-deploy - Deploys Data Connect schemas (GraphQL -> Cloud SQL)."
|
||||||
|
@echo " make dataconnect-sql-migrate - Applies Data Connect SQL migrations to Cloud SQL."
|
||||||
|
@echo " make dataconnect-generate-sdk - Regenerates the Data Connect SDK (frontend-web + internal-api-harness)."
|
||||||
|
@echo " make dataconnect-sync - Runs sql:migrate + deploy + sdk:generate in order."
|
||||||
|
@echo " make dataconnect-bootstrap-db - ONE-TIME: creates krow-sql, krow_db, links Data Connect, deploys, and generates initial SDK."
|
||||||
@echo ""
|
@echo ""
|
||||||
@echo " --- BASE44 EXPORT WORKFLOW ---"
|
@echo " --- BASE44 EXPORT WORKFLOW ---"
|
||||||
@echo " make integrate-export - Integrates a new Base44 export from '../krow-workforce-export-latest'."
|
@echo " make integrate-export - Integrates a new Base44 export from '../krow-workforce-export-latest'."
|
||||||
@@ -331,6 +337,7 @@ dataconnect-enable-apis:
|
|||||||
@gcloud services enable sqladmin.googleapis.com --project=$(GCP_PROJECT_ID)
|
@gcloud services enable sqladmin.googleapis.com --project=$(GCP_PROJECT_ID)
|
||||||
@gcloud services enable iam.googleapis.com --project=$(GCP_PROJECT_ID)
|
@gcloud services enable iam.googleapis.com --project=$(GCP_PROJECT_ID)
|
||||||
@gcloud services enable cloudresourcemanager.googleapis.com --project=$(GCP_PROJECT_ID)
|
@gcloud services enable cloudresourcemanager.googleapis.com --project=$(GCP_PROJECT_ID)
|
||||||
|
@gcloud services enable secretmanager.googleapis.com --project=$(GCP_PROJECT_ID)
|
||||||
@echo "✅ APIs enabled for project [$(GCP_PROJECT_ID)]."
|
@echo "✅ APIs enabled for project [$(GCP_PROJECT_ID)]."
|
||||||
|
|
||||||
# Initialize Firebase Data Connect (interactive wizard).
|
# Initialize Firebase Data Connect (interactive wizard).
|
||||||
@@ -346,6 +353,74 @@ dataconnect-deploy:
|
|||||||
@firebase deploy --only dataconnect --project=$(FIREBASE_ALIAS)
|
@firebase deploy --only dataconnect --project=$(FIREBASE_ALIAS)
|
||||||
@echo "✅ Data Connect deployment completed for [$(ENV)]."
|
@echo "✅ Data Connect deployment completed for [$(ENV)]."
|
||||||
|
|
||||||
|
# Apply pending SQL migrations for Firebase Data Connect
|
||||||
|
dataconnect-sql-migrate:
|
||||||
|
@echo "--> Applying Firebase Data Connect SQL migrations to [$(ENV)] (project: $(FIREBASE_ALIAS))..."
|
||||||
|
@firebase dataconnect:sql:migrate --project=$(FIREBASE_ALIAS)
|
||||||
|
@echo "✅ Data Connect SQL migration completed for [$(ENV)]."
|
||||||
|
|
||||||
|
# Generate Data Connect client SDK for frontend-web and internal-api-harness
|
||||||
|
dataconnect-generate-sdk:
|
||||||
|
@echo "--> Generating Firebase Data Connect SDK for web frontend and API harness..."
|
||||||
|
@firebase dataconnect:sdk:generate --project=$(FIREBASE_ALIAS)
|
||||||
|
@echo "✅ Data Connect SDK generation completed for [$(ENV)]."
|
||||||
|
|
||||||
|
# Unified backend schema update workflow (schema -> deploy -> SDK)
|
||||||
|
dataconnect-sync:
|
||||||
|
@echo "--> [1/3] Applying SQL migrations..."
|
||||||
|
@firebase dataconnect:sql:migrate --project=$(FIREBASE_ALIAS)
|
||||||
|
@echo "--> [2/3] Deploying Data Connect..."
|
||||||
|
@firebase deploy --only dataconnect --project=$(FIREBASE_ALIAS)
|
||||||
|
@echo "--> [3/3] Regenerating SDK..."
|
||||||
|
@firebase dataconnect:sdk:generate --project=$(FIREBASE_ALIAS)
|
||||||
|
@echo "✅ Data Connect SQL, deploy, and SDK generation completed for [$(ENV)]."
|
||||||
|
|
||||||
|
# -------------------------------------------------------------------
|
||||||
|
# ONE-TIME FULL SETUP FOR CLOUD SQL + DATA CONNECT
|
||||||
|
# -------------------------------------------------------------------
|
||||||
|
# ⚠️ WARNING:
|
||||||
|
# This should only be executed when setting up a brand new environment
|
||||||
|
# (e.g., first-time dev setup or new GCP project).
|
||||||
|
# -------------------------------------------------------------------
|
||||||
|
dataconnect-bootstrap-db:
|
||||||
|
@echo "⚠️ Creating Cloud SQL instance krow-sql (tier: $(SQL_TIER)) (ONLY RUN THIS ONCE PER PROJECT)..."
|
||||||
|
gcloud sql instances create krow-sql \
|
||||||
|
--database-version=POSTGRES_15 \
|
||||||
|
--tier=$(SQL_TIER)\
|
||||||
|
--region=us-central1 \
|
||||||
|
--storage-size=10 \
|
||||||
|
--storage-auto-increase \
|
||||||
|
--availability-type=zonal \
|
||||||
|
--backup-start-time=03:00 \
|
||||||
|
--project=$(GCP_PROJECT_ID)
|
||||||
|
|
||||||
|
@echo "⚠️ Creating Cloud SQL database krow_db..."
|
||||||
|
gcloud sql databases create krow_db \
|
||||||
|
--instance=krow-sql \
|
||||||
|
--project=$(GCP_PROJECT_ID)
|
||||||
|
|
||||||
|
@echo "⚠️ Creating Firebase Data Connect service identity..."
|
||||||
|
gcloud beta services identity create \
|
||||||
|
--service=firebasedataconnect.googleapis.com \
|
||||||
|
--project=$(GCP_PROJECT_ID)
|
||||||
|
|
||||||
|
@echo "⚠️ Enabling IAM authentication on Cloud SQL instance krow-sql..."
|
||||||
|
gcloud sql instances patch krow-sql \
|
||||||
|
--project=$(GCP_PROJECT_ID) \
|
||||||
|
--database-flags=cloudsql.iam_authentication=on \
|
||||||
|
--quiet
|
||||||
|
|
||||||
|
@echo "⚠️ Linking Data Connect service (krow-workforce-db) with Cloud SQL..."
|
||||||
|
firebase dataconnect:sql:setup krow-workforce-db --project=$(FIREBASE_ALIAS)
|
||||||
|
|
||||||
|
@echo "⚠️ Deploying initial Data Connect configuration..."
|
||||||
|
@firebase deploy --only dataconnect --project=$(FIREBASE_ALIAS)
|
||||||
|
|
||||||
|
@echo "⚠️ Generating initial Data Connect SDK..."
|
||||||
|
@firebase dataconnect:sdk:generate --project=$(FIREBASE_ALIAS)
|
||||||
|
|
||||||
|
@echo "🎉 Cloud SQL + Data Connect bootstrap completed successfully!"
|
||||||
|
|
||||||
# --- Mobile App Development ---
|
# --- Mobile App Development ---
|
||||||
FLAVOR :=
|
FLAVOR :=
|
||||||
ifeq ($(ENV),dev)
|
ifeq ($(ENV),dev)
|
||||||
|
|||||||
Reference in New Issue
Block a user