Careeroza
Configuration, Secrets & Scaling
Environment Variables and Secrets
gcloud run services update course-api \
--set-env-vars ENV=production,LOG_LEVEL=info \
--set-secrets DATABASE_URL=db-url:latest,JWT_SECRET=jwt-secret:latest \
--service-account [email protected]Secrets are stored in Secret Manager and injected at start-up; the service account needs roles/secretmanager.secretAccessor.
Scaling and Resources
| Flag | Effect |
|---|---|
--min-instances 1 | keep one warm instance (no cold starts, small idle cost) |
--max-instances 20 | cap scaling (protects the database and your bill) |
--concurrency 80 | requests handled at once per instance |
--cpu 1 --memory 512Mi | resources per instance |
--timeout 300 | maximum request duration (seconds) |
Note: A cold start happens when a new instance must start. Keep images small, start-up fast, and use min instances for latency-sensitive APIs.