Skip to content
mango·agentby Mangosteen Studio
Server setup · Google Cloud

Deploy on Google Cloud

Run the Docker Compose stack on Google's free e2-micro VM, with the Firebase service account attached so push needs no key file. Cloud Run is the managed alternative when you want autoscaling.

$0–4 / month on the free e2-micro You run updates; nightly backups go to R2 Built in: the VM runs as the service account (PUSH_PROVIDER=fcm)

1The free e2-micro#

Google's free tier includes one e2-micro per billing account in us-west1, us-central1 or us-east1, with a 30 GB standard disk. A static public IPv4 address may cost about $3–4 a month. Check the current terms on Google's free-tier page.

2Reserve an IP and open the web ports#

bash
gcloud config set project mangosteen-mango-agent
gcloud services enable compute.googleapis.com
gcloud compute addresses create mango-agent-ip --region=us-central1
gcloud compute firewall-rules create mango-agent-web --allow=tcp:80,tcp:443 --target-tags=mango-agent

3Create the VM with the service account attached#

bash
gcloud compute instances create mango-agent \
  --zone=us-central1-a --machine-type=e2-micro \
  --image-family=debian-12 --image-project=debian-cloud \
  --boot-disk-size=30GB --boot-disk-type=pd-standard \
  --address=mango-agent-ip --tags=mango-agent \
  --service-account=mango-agent-backend@mangosteen-mango-agent.iam.gserviceaccount.com \
  --scopes=cloud-platform

The VM gets the service account's credentials from the metadata server. That account already has Firebase Cloud Messaging access, so set PUSH_PROVIDER=fcm and leave GOOGLE_CREDENTIALS_JSON empty.

4Backups: off-site to R2, no snapshots#

Instead of GCP disk snapshots, the nightly database dump goes to a separate Cloudflare R2 bucket (VM guide: backups). That survives losing the VM, the disk or even the GCP project. Recovery means rebuilding the VM from this guide (about 30–45 minutes), then running ./restore.sh r2:latest. Screenshots already live in R2.

5Install the app#

gcloud compute ssh mango-agent --zone=us-central1-a, then follow the VM guide from “Prepare the server”.

6Managed alternative: Cloud Run#

Cloud Run removes the server, but the backend must keep one instance always on, with CPU always allocated, for WebSockets and the worker. That's about $45 a month for the backend, plus Cloud SQL (about $10+) or a hosted Postgres. Deploy with --min-instances=1 --no-cpu-throttling --timeout=3600 --port=8000, keep secrets in Secret Manager, run migrations as a Cloud Run job, and deploy the panel as a second service from frontend/Dockerfile.prod.