This project uses Terraform to manage infrastructure as code. It deploys:
- Compute Engine (
main): Ane2-microinstance (Free Tier) running Redis and serving as a general utility server. - Cloud Run: Two services (
werewolf-backendandwerewolf-frontend) connected to the VM via Direct VPC Egress.
- Google Cloud SDK: Installed and authenticated (
gcloud auth login). - Terraform: Installed (
brew install terraform). - Project: A GCP project (e.g.,
tbd-project-82910).
Ensure your latest code is built and pushed to GitHub Container Registry (GHCR). Usually done via GitHub Actions, but you can trigger it by tagging a release.
Run the helper script:
./scripts/deploy_infra.sh 0.1.1This script will:
- Initialize Terraform.
- Plan the deployment using images from
ghcr.io/WeixuanZ/.... - Ask for confirmation before applying.
After deployment, the script outputs the Frontend URL. Visit it to play the game.
- VPC:
werewolf-vpc - Subnet:
werewolf-subnet(Required for Direct VPC Egress) - Firewall:
- Internal: Allows Cloud Run to talk to Redis (port 6379).
- SSH (IAP): Allows you to SSH into
mainsafely usinggcloud compute ssh.
- VM: Uses
e2-microinus-central1. (Limit: 1 per billing account). - Disk: 30GB Standard PD.
- Cloud Run: Scales to zero when not in use.