// cloud · gcp

GCP: the developer-first cloud.

Cloud Run is what happens when you take Heroku and give it an actually good autoscaler. It's the sweet spot for most Ruby teams.

Cloud Run treats containers the way Heroku treats slugs: give it an image, get a URL. Add Cloud SQL for Postgres, Memorystore for Redis, and Artifact Registry for images — that's the whole stack.
~480 ms
cold start (Ruby container)
0 → 1000
scale range
60 min
max request timeout
01 / 04

Cloud Run for the web tier

One command deploys your image. Cloud Run gives you HTTPS, autoscaling, IAM, and rolling revisions out of the box. It's the closest thing to 'deploy and forget' in the industry.
bash
gcloud run deploy rails-web \ --image=us-central1-docker.pkg.dev/proj/app/web:latest \ --region=us-central1 \ --port=3000 \ --min-instances=1 --max-instances=20 \ --cpu=1 --memory=1Gi \ --set-secrets=RAILS_MASTER_KEY=rails-master-key:latest \ --add-cloudsql-instances=proj:us-central1:app-db
02 / 04

Cloud SQL via the built-in proxy

Cloud Run has a first-class Cloud SQL integration — you get a Unix socket at `/cloudsql/PROJECT:REGION:INSTANCE`. Point DATABASE_URL at it and skip the sidecar entirely.
03 / 04

Jobs & workers: Cloud Run Jobs

Cloud Run Jobs runs your container to completion — perfect for migrations, cron work, and Solid Queue supervisors. Trigger them via Cloud Scheduler.
04 / 04

Artifact Registry, not Container Registry

Container Registry (gcr.io) is being sunset. Push to Artifact Registry from the start. It supports Docker, npm, Maven and more — one registry to rule them all.

Gotchas we learned the hard way

  • !Cloud Run's request timeout maxes at 60 minutes but defaults to 5 minutes. Long-running requests need the flag bumped explicitly.
  • !Container concurrency defaults to 80 — often too high for Rails with a small thread pool. Set it to match your Puma threads * workers.
  • !Use Cloud SQL for production Postgres — automated backups, HA and PITR are configuration, not a project. Don't roll your own on a bare VM.
  • !Memorystore is production-grade Redis; for local dev and preview environments run Redis as a sidecar container or drop it entirely with Solid Cache/Queue.

Related guides

Ready?
Cloud Run + Rails 8 in 5 minutes

If you've never used GCP, start here. The learning curve is the shortest of any hyperscaler for Ruby workloads.