Google Cloud Deployment
Deploy a production-ready Temp-Number App to Google Cloud Platform with automatic scaling, managed database, and SSL certificates.
Overview
Google Cloud deployment provides:
- β Auto-scaling: Automatically scales based on traffic
- β Managed Infrastructure: No server management required
- β Global CDN: Fast content delivery worldwide
- β Automatic SSL: Free HTTPS certificates
- β Automated Backups: Database backups included
- β High Availability: 99.95% uptime SLA
Architecture
Prerequisites
Required Accounts
- Google Cloud: Account with billing enabled (Sign up )
- Platfone: API credentials (Get access )
- Domain Name: Custom domain (recommended)
Required Tools
- gcloud CLI: Installation guide
- Docker: For local image building (optional)
- Git: For cloning the repository
Deployment
β‘ Automated Deployment (Recommended)
You can use the provided deployment scripts for automated deployment to Google Cloud. These scripts handle the entire deployment process, including building Docker images, deploying to Cloud Run, and configuring the necessary services.
git clone https://github.com/platfone-com/temp-number-deploy.git
cd temp-number-deploy
./google-cloud-deploy.shScript will prompt for necessary configuration values.
For automated assistance with Firebase and GCP setup, consider using the Setup Wizard instead.
Setup Wizard
Interactive setup wizard that handles all prerequisites and configuration
π’ Manual Deployment Steps
Step 1: Clone the Deployment Repository
git clone https://github.com/platfone-com/temp-number-deploy.git
cd temp-number-deployStep 2: Clone Application Repositories
# Clone backend repository
git clone https://github.com/platfone-com/temp-number-backend.git
# Clone frontend repository
git clone https://github.com/platfone-com/temp-number-web.gitStep 3: Prepare environment
# Prepare environment variables
cp config/env/backend.env.example config/env/backend.env
cp config/env/web.env.example config/env/web.env
# Prepare secrets
cp config/secrets/backend.secrets.example config/secrets/backend.secrets
echo "Fill in the configuration files with your values"Step 4: Prepare GCP and Firebase service accounts
Create a Google Cloud service account with the following roles:
- Cloud SQL Admin
- Cloud Run Admin
- Service Account User
- Secret Manager Secret Accessor
- Cloud Build Editor
- Artifact Registry Administrator
- Service Usage Admin
- Logging Viewer
- Storage Admin
- IAM Service Account User
Enable the following APIs in your Google Cloud project:
- Cloud Build API
- Cloud Run API
- Cloud SQL Admin API
- Secret Manager API
- Artifact Registry API
- Compute Engine API
- Cloud Resource Manager API
- IAM API
Link your Google Cloud project to a billing account.
Create a Firebase project
- Configure Firebase Authentication (Email/Password, Google, etc.)
- Generate a Firebase service account key and download the JSON file
See Firebase Configuration Guide for detailed steps.
Step 5: Create Cloud SQL Instance
# Create Cloud SQL instance
./scripts/gcp/create_sql_instance.sh --project-id "YOUR_PROJECT_ID" --service-account "path_to_gcp-service-account.json" --env-file "path_to_backend.env" --secrets-file "path_to_backend.secrets" --region "us-central1" --db-tier "db-f1-micro" --service-name "temp-number-backend" --skip-if-existsStep 6: Deploy Backend to Cloud Run
The following will:
- Create secrets in Secret Manager
- Grant access to Cloud Run service account
- Run Cloud Build to build and push Docker image
- Deploy the backend service to Cloud Run
- Run database migrations
./scripts/gcp/deploy_backend.sh --project-id "YOUR_PROJECT_ID" --service-account "path_to_gcp-service-account.json" --env-file "path_to_backend.env" --project-root "path_to_temp-number-backend" --region "us-central1" --service-name "temp-number-backend" --port 3333 --run-migrations --non-interactiveOn successful deployment, note:
- the backend URL for frontend configuration.
- Payment gateway webhook URL (for Stripe, etc.).
Step 7: Deploy Web (Frontend) to Cloud Run
./scripts/gcp/deploy_web.sh --project-id "YOUR_PROJECT_ID" --service-account "path_to_gcp-service-account.json" --env-file "path_to_web.env" --project-root "path_to_temp-number-web" --region "us-central1" --service-name "temp-number-web" --port 80Note the frontend URL for DNS configuration.
Step 8: Update WEB Environment Variables
Update the following variables in your web.env file:
VITE_TEMP_NUMBER_FRONTEND_BASE_APP_URL=https://your-frontend-url
VITE_TEMP_NUMBER_BACKEND_API_BASE_PATH=https://your-backend-url
# Firebase console -> Settings -> General -> Your apps -> SDK setup and configuration
VITE_FIREBASE_WEB_API_KEY=YOUR_FIREBASE_WEB_API_KEY
VITE_FIREBASE_AUTH_DOMAIN=YOUR_FIREBASE_AUTH_DOMAIN
VITE_FIREBASE_PROJECT_ID=YOUR_PROJECT_ID
VITE_FIREBASE_APP_ID=YOUR_FIREBASE_APP_IDRedeploy the web service after updating (see Step 6).
Step 9: Update Firebase Authentication Settings
- Update the Authorized Domains in Firebase Authentication settings to include your frontend domain.
- Set
%LINK%variable in Firebase Authentication -> Templates -> Email address verification to<your frontend URL>/app/deeplink.
See Firebase Configuration Guide for detailed steps.
Next Steps
Configuration
Configure authentication and payments
Development Guide
Customize and extend the application