Docs/Deployment/Google Cloud

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.

Recommended

Google Kubernetes Engine (GKE)

Managed Kubernetes with Autopilot mode. Best for complex microservices architectures.

Enterprise

App Engine

Platform as a Service (PaaS). Best for simple applications with minimal configuration.

Simple

Cloud Functions

Event-driven serverless functions. Best for webhooks, triggers, and lightweight APIs.

Serverless

Prerequisites

  • 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:

Terminal
# 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-central1

Service 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:

qodryx.config.yaml
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: 100

Multi-Region Deployment

Deploy to multiple regions for global availability:

qodryx.config.yaml
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.com

GKE Deployment

Deploy to Google Kubernetes Engine:

qodryx.config.yaml
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: 70

Cloud Functions

Deploy serverless functions:

qodryx.config.yaml
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: 80

Container Registry (GCR)

Push images to Google Container Registry or Artifact Registry:

qodryx.config.yaml
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: true

Deployment Commands

Terminal
# 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 00001

GCP-Specific Features

Cloud Run

Scale to zero, pay per request

GKE Autopilot

Managed Kubernetes

Cloud Build

Native CI/CD integration

Secret Manager

Secure secrets injection

Cloud CDN

Global content delivery

Cloud Logging

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.