Google Cloud Deployment
Deploy to Google Cloud Platform with support for Cloud Run, GKE, App Engine, and Cloud Functions. Leverage Google's global infrastructure for your applications.
Setup Time
~10 minutes
Complexity
Medium
Best For
Containers & Serverless
Overview
Google Cloud Platform (GCP) offers a comprehensive suite of cloud services with excellent container support and global infrastructure. QODRYX provides seamless integration with GCP's most popular deployment targets.
Deployment Options
Cloud Run
Fully managed serverless containers. Best for stateless applications with automatic scaling.
RecommendedGoogle Kubernetes Engine (GKE)
Managed Kubernetes with Autopilot mode. Best for complex microservices architectures.
EnterpriseApp Engine
Platform as a Service (PaaS). Best for simple applications with minimal configuration.
SimpleCloud Functions
Event-driven serverless functions. Best for webhooks, triggers, and lightweight APIs.
ServerlessPrerequisites
- A Google Cloud account with a project
- A service account with appropriate permissions
- GCP APIs enabled (Cloud Run, GKE, etc.)
Step 1: Connect Google Cloud
Configure GCP credentials in QODRYX using a service account:
# Option 1: Service account JSON file
qodryx secrets set GCP_SERVICE_ACCOUNT "$(cat service-account.json)"
# Option 2: Individual credentials
qodryx secrets set GCP_PROJECT_ID my-project-id
qodryx secrets set GCP_CLIENT_EMAIL sa@project.iam.gserviceaccount.com
qodryx secrets set GCP_PRIVATE_KEY "-----BEGIN PRIVATE KEY-----..."
# Set default region
qodryx config set gcp.region us-central1Service Account Permissions
Your service account needs: Cloud Run Admin, Cloud Build Editor, Storage Admin, and Service Account User roles.
Cloud Run Deployment
Deploy containerized applications to Cloud Run:
deployment:
provider: gcp
service: cloud-run
cloud_run:
# Service configuration
service_name: my-app
region: us-central1
# Allow unauthenticated access
allow_unauthenticated: true
# Container settings
container:
port: 3000
# Resources
cpu: 1
memory: 512Mi
# Concurrency (requests per container)
concurrency: 80
# Auto-scaling
scaling:
min_instances: 0 # Scale to zero
max_instances: 100
# Environment variables
environment:
NODE_ENV: production
DATABASE_URL: "{{secrets.DATABASE_URL}}"
# Secrets from Secret Manager
secrets:
- name: API_KEY
secret: projects/my-project/secrets/api-key/versions/latest
# Custom domain (optional)
domain:
- api.myapp.com
# Traffic splitting (optional)
traffic:
- revision: LATEST
percent: 100Multi-Region Deployment
Deploy to multiple regions for global availability:
deployment:
provider: gcp
service: cloud-run
cloud_run:
service_name: my-app
# Deploy to multiple regions
regions:
- us-central1
- europe-west1
- asia-east1
# Global load balancer
load_balancer:
enabled: true
ssl: true
domain: api.myapp.comGKE Deployment
Deploy to Google Kubernetes Engine:
deployment:
provider: gcp
service: gke
gke:
# Cluster configuration
cluster: my-cluster
region: us-central1
# Use Autopilot (recommended)
autopilot: true
# Namespace
namespace: production
# Deployment settings
deployment:
replicas: 3
container:
port: 3000
resources:
requests:
cpu: 100m
memory: 128Mi
limits:
cpu: 500m
memory: 512Mi
livenessProbe:
path: /health
port: 3000
# Service configuration
service:
type: LoadBalancer
port: 80
# Horizontal Pod Autoscaler
autoscaling:
min_replicas: 2
max_replicas: 20
target_cpu: 70Cloud Functions
Deploy serverless functions:
deployment:
provider: gcp
service: cloud-functions
cloud_functions:
# Function configuration
name: my-function
runtime: nodejs20
entry_point: handler
region: us-central1
# Trigger type
trigger:
type: http
# Or: pubsub, storage, firestore
# Resources
memory: 256MB
timeout: 60s
# Environment variables
environment:
LOG_LEVEL: info
# Gen 2 functions (recommended)
generation: 2
# Concurrency (Gen 2 only)
concurrency: 80Container Registry (GCR)
Push images to Google Container Registry or Artifact Registry:
docker:
registry: gcp
gcp:
project_id: my-project
# Use Artifact Registry (recommended) or GCR
artifact_registry:
enabled: true
location: us-central1
repository: my-repo
# Or legacy GCR
# gcr:
# location: gcr.io # us.gcr.io, eu.gcr.io, asia.gcr.io
# Vulnerability scanning
vulnerability_scanning: trueDeployment Commands
# Deploy to Cloud Run
qodryx deploy --provider gcp --service cloud-run
# Deploy to GKE
qodryx deploy --provider gcp --service gke
# Deploy Cloud Function
qodryx deploy --provider gcp --service cloud-functions
# Deploy to specific region
qodryx deploy --provider gcp --region europe-west1
# View deployment status
qodryx status --provider gcp
# View logs
qodryx logs --provider gcp --service my-app --follow
# Rollback
qodryx rollback --provider gcp --revision 00001GCP-Specific Features
Scale to zero, pay per request
Managed Kubernetes
Native CI/CD integration
Secure secrets injection
Global content delivery
Centralized log management
Troubleshooting
Permission Denied
- Verify service account has required roles
- Check if APIs are enabled in your project
- Ensure IAM bindings are correct
Cloud Run Startup Failures
- Check container logs in Cloud Console
- Verify PORT environment variable is respected
- Ensure container starts within timeout (4 minutes max)
Cold Starts
Cloud Run and Cloud Functions may experience cold starts. Set minimum instances to 1 for latency-sensitive applications.