ops Tutorial

Deploying Expense Tracker to Google Cloud

In this series

Google Cloud Platform (GCP) is excellent for containerized applications. We'll use Cloud Run for the backend and Firebase Hosting for the frontend.

Backend (Cloud Run)

  1. Containerize: Ensure your Dockerfile is ready.

  2. Build and Push: Submit your build to Cloud Build.

    gcloud builds submit --tag gcr.io/PROJECT-ID/expense-tracker-api
  3. Deploy: Deploy the image to Cloud Run.

    gcloud run deploy expense-tracker-api --image gcr.io/PROJECT-ID/expense-tracker-api --platform managed
  4. Database (Cloud SQL): Create a Cloud SQL instance for MySQL. Connect it to Cloud Run using the Cloud SQL Auth Proxy or direct VPC connection.

Frontend (Firebase Hosting)

  1. Install CLI:

    npm install -g firebase-tools
  2. Initialize:

    firebase init hosting

    Select your project and set dist as the public directory.

  3. Deploy:

    npm run build
    firebase deploy

Conclusion

You now have your application running on Google's scalable infrastructure!