Skip to content

Instantly share code, notes, and snippets.

@chandlerroth
Last active August 24, 2022 02:30
Show Gist options
  • Save chandlerroth/c34a981185cd4e13173e5cd0d7917250 to your computer and use it in GitHub Desktop.
Save chandlerroth/c34a981185cd4e13173e5cd0d7917250 to your computer and use it in GitHub Desktop.

Workshop 08-22-2022

Frontend

Setup Firebase Hosting:

  1. Create a Firebase project
  2. Run firebase login
  3. Run firebase init

Deploy to Firebase Hosting:

  1. Add a file to the scripts/deploy.sh with the frontend-deploy.sh contents
  2. Run chmod +x scripts/deploy.sh to make the file executable
  3. Run scripts/deploy.sh

Backend

Setup Google Cloud Run:

  1. Install the gcloud CLI
  2. Run gcloud auth login
  3. Enable the Google Cloud Run API
  4. Enable the Google Cloud Artifacts Registry API
    • A guide on setting up a Docker repository with the Artifacts Registry
  5. Run gcloud auth configure-docker us-east1-docker.pkg.dev to authenticate Docker deployments
  6. Add a file to the scripts/build-upload.sh with the backend-build-upload.sh contents
  7. Run chmod +x scripts/build-upload.sh to make the file executable
  8. Run scripts/build-upload.sh

Deploy to Google Cloud Run:

  1. Create a new service with Google Cloud Run
  2. Add a file to the scripts/deploy.sh with the backend-deploy.sh contents
  3. Run chmod +x scripts/deploy.sh to make the file executable
  4. Run scripts/deploy.sh

Setup Google Cloud SQL:

  1. Create a PostgreSQL instance
  2. Update your Goolge Run deployment to connect to the Cloud SQL instance
#!/bin/sh
docker buildx build --platform linux/amd64 -t backend .
docker tag backend:latest us-east1-docker.pkg.dev/estimato-production/backend/backend:latest
docker push us-east1-docker.pkg.dev/estimato-production/backend/backend:latest
#!/bin/sh
gcloud run deploy backend --image=us-east1-docker.pkg.dev/estimato-production/backend/backend:latest --region=us-central1
DATABASE_URL=postgresql://USERNAME:PASSWORD@localhost/estimato_production?host=/cloudsql/estimato_production:us-central1:estimato-production
#!/bin/sh
npm run build
firebase deploy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment