🚨 Before deploying to production, complete the PRODUCTION_CHECKLIST.md
- Google Cloud Project:
YOUR_GCP_PROJECT_ID - Workload Identity Pool configured
- Service Account:
github-actions-sa@YOUR_GCP_PROJECT_ID.iam.gserviceaccount.com - Artifact Registry repository:
us-docker.pkg.dev/YOUR_GCP_PROJECT_ID/ihep - PostgreSQL database provisioned and accessible
- All environment variables configured (see PRODUCTION_CHECKLIST.md)
| Environment | Branch | Cloud Run Service | Resources |
|---|---|---|---|
| Development | dev |
ihep-web-dev |
512Mi RAM, 1 CPU |
| Staging | CI |
ihep-web-staging |
512Mi RAM, 1 CPU |
| Production | production |
ihep-web-production |
1Gi RAM, 2 CPU |
The deployment uses Workload Identity Federation instead of service account keys for enhanced security.
Provider: projects/934473355501/locations/global/workloadIdentityPools/github-actions-pool/providers/github-provider
Service Account: github-actions-sa@YOUR_GCP_PROJECT_ID.iam.gserviceaccount.com
-
Copy environment variables:
cp .env.example .env.local
-
Update
.env.localwith your values -
Install dependencies:
npm install
-
Run development server:
npm run dev
Push to the dev branch:
git checkout dev
git merge main
git push origin devThe workflow will automatically:
- Build the Docker image
- Push to Artifact Registry
- Deploy to Cloud Run (
ihep-web-dev)
Push to the CI branch:
git checkout CI
git merge main
git push origin CIPush to the production branch:
git checkout production
git merge main
git push origin productionThese are configured in the workflow files:
PROJECT_ID: YOUR_GCP_PROJECT_IDREGION: us-central1SERVICE_NAME: ihep-web-{env}
Set these in Cloud Run service environment variables:
# Example: Set NEXTAUTH_SECRET for production
gcloud run services update ihep-web-production \
--project YOUR_GCP_PROJECT_ID \
--region us-central1 \
--set-env-vars "NEXTAUTH_SECRET=your-secret-here"Or use the Google Cloud Console → Cloud Run → Service → Variables & Secrets
The application uses Next.js standalone output for optimized Docker images:
- Base Image: node:20-alpine
- Output: Next.js standalone server
- Port: 5000 (configurable via PORT env var)
- Build: Multi-stage with separate deps/build/runtime layers
Check the GitHub Actions logs for detailed error messages.
-
Verify Cloud Run service exists:
gcloud run services describe ihep-web-dev \ --project YOUR_GCP_PROJECT_ID \ --region us-central1
-
Check service logs:
gcloud logging read "resource.type=cloud_run_revision AND resource.labels.service_name=ihep-web-dev" \ --project YOUR_GCP_PROJECT_ID \ --limit 50
Build and test the Docker image locally:
# Build
docker build -t ihep-test .
# Run
docker run -p 5000:5000 \
-e NEXTAUTH_SECRET=test-secret \
ihep-test
# Test
curl http://localhost:5000Before launching to production, ensure you have completed all items in:
- PRODUCTION_CHECKLIST.md - Comprehensive pre-launch checklist
- Complete PRODUCTION_CHECKLIST.md ← Start here
- Configure all required environment variables in Cloud Run
- Run database migrations (
npm run db:migrate) - Set up custom domain (optional)
- Configure CI/CD monitoring and alerts
- Set up Cloud CDN (optional for static assets)
- Enable Cloud Monitoring and alerting
- Configure backup and disaster recovery procedures
- CODESPACES_SETUP.md - Development environment setup
- SECURITY.md - Security guidelines and PHI handling
- README.md - Project overview and quick start