Skip to main content

Certification track: Associate Cloud Engineer (ACE)

Zammad on Google Cloud Run

Zammad on Google Cloud Run

Zammad is an open-source helpdesk and customer support platform — a GDPR-compliant alternative to Zendesk and Freshdesk. This module deploys Zammad on Cloud Run v2 on top of the App_CloudRun foundation, which provisions and manages the shared Google Cloud infrastructure.

This guide focuses on the cloud services Zammad uses and how to explore and operate them from the Google Cloud Console and the command line. For the mechanics common to every Cloud Run application — service identity, ingress and load balancing, scaling and concurrency, CI/CD, Cloud Armor, IAP, Binary Authorization, VPC Service Controls, backups, and the deployment lifecycle — refer to the App_CloudRun foundation guide rather than repeating them here.


1. Overview

Zammad runs as a Ruby on Rails (railsserver) container on Cloud Run v2. The deployment wires together a focused set of Google Cloud services:

CapabilityGoogle Cloud serviceNotes
ComputeCloud Run v2Rails service, 2 vCPU / 4 GiB by default, request-based autoscaling
DatabaseCloud SQL for PostgreSQL 15Required — Zammad does not support MySQL
Attachment storageFilestore (NFS)Ticket attachments at /opt/zammad/storage, shared across all instances
Object storageCloud StorageA dedicated zammad-attachments bucket, always provisioned
Cache & job queueRedisEnabled by default; required for ActionCable WebSocket pub/sub and Sidekiq
SecretsSecret ManagerDatabase password managed automatically
IngressCloud Run URL / Cloud Load BalancingDefault run.app URL, optional external HTTPS load balancer + custom domain

Sensible defaults worth knowing up front:

  • PostgreSQL 15 is required. MySQL is not supported and is rejected at plan time.
  • Redis is required. Zammad uses Redis for real-time ticket updates (ActionCable) and background job processing (Sidekiq). Without it, Zammad fails to start.
  • A custom image is built via Cloud Build. container_image_source = "custom" is the default — Cloud Build wraps the official zammad/zammad Docker Hub image with a GCP-specific entrypoint.sh that maps Foundation DB_* variables to Zammad's POSTGRESQL_* convention.
  • The startup probe targets /. Zammad returns HTTP 200 there only once fully initialised. The probe is deliberately lenient (30 failure threshold) to accommodate first-boot schema migration.
  • Database migrations run on every instance start (idempotent via zammad-init), so version upgrades apply schema changes automatically.
  • min_instance_count = 0 is the default (scale-to-zero); override to 1 to eliminate 60–90-second cold starts on a production helpdesk.

2. Google Cloud Services & How to Explore Them

All commands assume PROJECT and REGION are set. Service and resource names are reported in the deployment Outputs.

A. Cloud Run — the Zammad service

Zammad runs as a Cloud Run v2 service that autoscales by request load between the minimum and maximum instance counts. Each deployment creates an immutable revision; traffic can be split across revisions for safe rollouts.

  • Console: Cloud Run → select the service for revisions, traffic, logs, and metrics.
  • CLI:
    gcloud run services list --project "$PROJECT" --region "$REGION"
    gcloud run services describe <service-name> --project "$PROJECT" --region "$REGION"
    gcloud run revisions list --service <service-name> --project "$PROJECT" --region "$REGION"

See App_CloudRun for scaling, concurrency, execution environment, and traffic splitting.

B. Cloud SQL for PostgreSQL 15

Zammad stores all helpdesk data (tickets, users, channels, SLA records) in a managed Cloud SQL for PostgreSQL 15 instance. The service connects privately through the Cloud SQL Auth Proxy over a Unix socket — no public IP is exposed. On the first deploy an initialization Job creates the application database and user. On every subsequent instance start, zammad-init applies any pending schema migrations.

Cloud Run TCP workaround: Zammad's docker-entrypoint.sh checks PostgreSQL readiness using a TCP bash socket. Because Cloud Run's DB_HOST is a Unix socket path (not TCP-addressable), the custom entrypoint.sh uses the Cloud SQL private IP (DB_IP) instead for this check.

  • Console: SQL → select the instance for connections, backups, flags, metrics.
  • CLI:
    gcloud sql instances list --project "$PROJECT"
    gcloud sql instances describe <instance-name> --project "$PROJECT"
    gcloud sql connect <instance-name> --user=<db-user> --project "$PROJECT"

The instance name, database, user, and password secret are in the Outputs. See App_CloudRun for the connection model, backups, and password rotation.

C. Filestore (NFS) and Cloud Storage

Ticket attachments and uploaded files are written to a Filestore (NFS) share mounted at /opt/zammad/storage inside the service so all instances share the same files. A dedicated Cloud Storage (zammad-attachments) bucket is also provisioned automatically. Gen2 execution environment is required for NFS mounts.

  • Console: Filestore → Instances; Cloud Storage → Buckets.
  • CLI:
    gcloud filestore instances list --project "$PROJECT"
    gcloud storage buckets list --project "$PROJECT"
    gcloud storage ls gs://<attachments-bucket>/ # bucket name is in the Outputs

See App_CloudRun for the NFS mount, GCS Fuse, and CMEK.

D. Redis cache and job queue

Redis is mandatory for Zammad and serves two critical roles:

  1. ActionCable pub/sub — delivers real-time ticket updates to agents across multiple Cloud Run instances.
  2. Sidekiq — processes background jobs (email dispatch, SLA notifications, LDAP sync, scheduler tasks).

When no external redis_host is configured and NFS is enabled, the NFS host IP is used as the Redis endpoint. For production, use a dedicated Google Cloud Memorystore for Redis instance and set vpc_egress_setting = "ALL_TRAFFIC" so Cloud Run can reach its private IP.

  • Console: Memorystore → Redis (if using a managed instance).
  • CLI:
    redis-cli -h <redis-host> ping
    redis-cli -h <redis-host> info keyspace

E. Secret Manager

The database password is stored in Secret Manager and injected into the service at runtime. Zammad manages its own internal signing keys — no application-level secret is auto-generated by this module.

  • Console: Security → Secret Manager.
  • CLI:
    gcloud secrets list --project "$PROJECT"
    gcloud secrets versions access latest --secret=<secret-name> --project "$PROJECT"

See App_CloudRun for injection and rotation details.

F. Networking & ingress

The service is reachable at its run.app URL by default. An external HTTPS load balancer with a custom domain, Cloud CDN, and Cloud Armor can be layered on. When using Memorystore for Redis, vpc_egress_setting must be "ALL_TRAFFIC" so Redis connections are routed through the VPC.

  • Console: Cloud Run (service URL); Network services → Load balancing.
  • CLI:
    gcloud run services describe <service-name> --region "$REGION" --format='value(status.url)'
    gcloud compute addresses list --project "$PROJECT"

See App_CloudRun.

G. Cloud Logging & Monitoring

Container logs flow to Cloud Logging; Cloud Run and Cloud SQL metrics flow to Cloud Monitoring, with optional uptime checks and alert policies.

  • Console: Logging → Logs Explorer; Monitoring → Dashboards / Alerting.
  • CLI:
    gcloud run services logs read <service-name> --project "$PROJECT" --region "$REGION" --limit 50

3. Zammad Application Behaviour

  • First-deploy database setup. An initialization Job (db-init) runs before the service starts. It connects to Cloud SQL via the Auth Proxy and idempotently creates the Zammad database, user, and grants privileges. It is safe to re-run.
  • Migrations on every start. The custom entrypoint.sh calls zammad-init (Rails DB migration + seed) before starting the railsserver on every instance start. Pending migrations are applied; already-run ones are skipped.
  • Variable bridging. The Foundation module injects database credentials as DB_HOST, DB_USER, DB_PASSWORD, etc. The custom entrypoint.sh maps these to Zammad's POSTGRESQL_* convention, and uses DB_IP (Cloud SQL private IP) for the TCP readiness check because Cloud Run's DB_HOST is a Unix socket path.
  • WebSocket connectivity. Zammad agents receive live ticket updates via ActionCable WebSockets. With multiple instances, Redis pub/sub coordinates events across them — this is why enable_redis = true is mandatory.
  • Health path. Startup and liveness probes target /, which returns HTTP 200 only when Zammad is fully initialised. The startup probe allows up to 510 seconds total (60-second initial delay, 30 retries at 15-second intervals) to accommodate first-boot schema migration.
  • Email integration. Configure SMTP after first login at Admin → Channels → Email. SMTP credentials can be injected via secret_environment_variables.
  • Inspect scheduled jobs:
    gcloud run jobs list --project "$PROJECT" --region "$REGION"
    gcloud run jobs executions list --job <job-name> --project "$PROJECT" --region "$REGION"

4. Configuration Variables

Variables are grouped exactly as they appear on the deployment platform. Only settings specific to or notable for Zammad are listed; every other input is inherited from App_CloudRun with its standard behaviour.

Group 1 — Project & Identity

VariableDefaultDescription
project_id(required)Target Google Cloud project.
regionus-central1Region for the service and regional resources.
elasticsearch_url""Elasticsearch HTTP endpoint for full-text search. Leave empty to disable.
elasticsearch_username""Elasticsearch username. Leave empty when security is disabled.

Group 2 — Deployment Environment

VariableDefaultDescription
tenant_deployment_iddemoShort suffix that makes resource names unique per environment.
support_users[]Emails granted project access and monitoring alerts.
resource_labels{}Labels applied to all resources.

Group 3 — Application Identity

VariableDefaultDescription
application_namezammadBase name for resources. Do not change after first deploy.
display_nameZammad HelpdeskFriendly name shown in the Console.
description(set)Service description.
application_version6.4.1Zammad image version tag; increment to trigger a new build.

Group 4 — Runtime & Scaling

VariableDefaultDescription
deploy_applicationtrueSet false to provision infrastructure only.
container_image_sourcecustomcustom builds via Cloud Build (required for the GCP entrypoint); prebuilt skips the build.
container_image""Override container image URI. Leave empty for Cloud Build to manage.
cpu_limit2000mCPU per instance. 2 vCPU minimum for Zammad.
memory_limit4GiMemory per instance. Minimum 2 GiB; 4 GiB recommended.
container_port3000Zammad railsserver port. Must match ZAMMAD_RAILSSERVER_PORT.
execution_environmentgen2Gen2 required for NFS mounts and GCS Fuse.
min_instance_count0Minimum instances (scale-to-zero). Set ≥ 1 to avoid cold starts on a production helpdesk.
max_instance_count5Maximum instances (cost ceiling).
enable_cloudsql_volumetrueCloud SQL Auth Proxy for socket connections. Do not disable.
enable_image_mirroringtrueMirrors the Zammad Docker Hub image into Artifact Registry before deploy.
traffic_split[]Split traffic across revisions for staged rollouts.
max_revisions_to_retain7How many old revisions to keep.

Group 5 — Access & Ingress Control

VariableDefaultDescription
ingress_settingsallWhich networks may reach the service (all / internal / internal-and-cloud-load-balancing).
vpc_egress_settingPRIVATE_RANGES_ONLYUse ALL_TRAFFIC when Redis is hosted on Memorystore (private IP).
enable_iapfalseRequire Google sign-in via Identity-Aware Proxy.
iap_authorized_users / iap_authorized_groups[]Who may access through IAP.

Group 6 — Environment Variables & Secrets

VariableDefaultDescription
environment_variables{}Extra non-secret settings. Core POSTGRESQL_* and RAILS_* values are set automatically.
secret_environment_variables{}Map of env var → Secret Manager secret name (e.g. for SMTP passwords).
explicit_secret_values{}Sensitive values to store and inject as secrets.
secret_propagation_delay30Seconds to wait after secret creation before proceeding.
secret_rotation_period2592000sSecret Manager rotation notification frequency.

Group 7 — Backup & Restore

VariableDefaultDescription
backup_schedule0 2 * * *Automated backup cron (UTC).
backup_retention_days7Retention; raise for production/compliance.
enable_backup_import / backup_source / backup_file / backup_formatrestore optionsRestore from a backup on deploy.

Group 8 — CI/CD & Binary Authorization

Standard App_CloudRun Cloud Build / Cloud Deploy integration — see App_CloudRun. Key inputs: enable_cicd_trigger, github_repository_url, github_token, enable_cloud_deploy, enable_binary_authorization.

Group 9 — Custom SQL Scripts

enable_custom_sql_scripts, custom_sql_scripts_bucket, custom_sql_scripts_path, custom_sql_scripts_use_root — run SQL from a GCS bucket after provisioning. See App_CloudRun.

Group 10 — Domain, CDN, Cloud Armor & Image Retention

VariableDefaultDescription
application_domains[]Custom hostnames for the external load balancer.
enable_cdnfalseEnable Cloud CDN on the LB backend (suitable only for static assets).
enable_cloud_armor / admin_ip_rangesoffAttach a WAF policy / restrict privileged access.
max_images_to_retain / delete_untagged_images / image_retention_days(set)Artifact Registry cleanup policy.

Group 11 — Storage & Filesystem

VariableDefaultDescription
enable_nfstrueShared Filestore volume for Zammad attachment storage. Requires Gen2.
nfs_mount_path/opt/zammad/storageMount path inside the container. Must match Zammad's storage configuration.
create_cloud_storage / storage_buckets / gcs_volumes(set)Additional buckets / GCS Fuse mounts. The zammad-attachments bucket is always created.
manage_storage_kms_iam / enable_artifact_registry_cmekfalseCMEK options.

Group 12 — Database Backend

VariableDefaultDescription
database_typePOSTGRES_15Fixed — do not change. Zammad requires PostgreSQL.
db_namezammadDatabase name. Immutable after first deploy.
db_userzammadApplication user. Immutable after first deploy.
database_password_length32Generated password length (16–64).
enable_auto_password_rotation / rotation_propagation_delay_secoffDB password rotation.

Group 13 — Jobs & Scheduled Tasks

VariableDefaultDescription
initialization_jobs[]Leave empty to use the built-in db-init job. Non-empty list replaces it entirely.
cron_jobs[]Recurring jobs triggered by Cloud Scheduler. Zammad handles its own internal scheduling; add custom maintenance jobs here.

Group 14 — Observability & Health

VariableDefaultDescription
startup_probe / startup_probe_config/, 60s delay, 30 retriesGenerous tolerance for first-boot schema migration.
liveness_probe / health_check_config/, 60s delayRestarts the container after 3 consecutive failures.
uptime_check_configdisabledCloud Monitoring uptime check targeting /; set enabled = true to provision it.
alert_policies[]Metric alert policies.

Group 21 — Redis Cache & Job Queue

VariableDefaultDescription
enable_redistrueRequired. Use Redis for ActionCable and Sidekiq.
redis_host""Leave empty to use the NFS host IP; set explicitly for Memorystore.
redis_port6379Redis port.
redis_auth""Optional Redis auth password (sensitive).

Group 22 — VPC Service Controls & Audit Logging

VariableDefaultDescription
enable_vpc_scfalseEnforce a VPC-SC perimeter (requires organization_id).
vpc_cidr_ranges / vpc_sc_dry_run(set)Access level CIDRs / dry-run mode.
enable_audit_loggingfalseDetailed Cloud Audit Logs.

5. Outputs

Returned on a successful deployment — the quickest way to locate and explore the running resources.

OutputDescription
service_nameCloud Run service name.
service_urlDefault run.app URL of the service.
service_locationRegion the service runs in.
stage_servicesStage-specific service URLs (Cloud Deploy).
load_balancer_ip / load_balancer_urlExternal HTTPS load balancer IP / URL (when enabled).
database_instance_nameCloud SQL instance name.
database_name / database_userApplication database name / user.
database_password_secretSecret Manager secret holding the DB password.
database_host / database_portDB endpoint / port.
storage_bucketsCreated Cloud Storage buckets (including zammad-attachments).
network_name / network_exists / regionsVPC network, presence, regions.
container_image / container_registryDeployed image and Artifact Registry repo.
monitoring_enabled / monitoring_notification_channels / uptime_check_namesMonitoring status, channels, uptime checks.
initialization_jobsNames of the setup jobs.
deployment_id / tenant_id / resource_prefixNaming identifiers.
project_id / project_numberProject identifiers.
cicd_enabled / github_repository_url / github_repository_owner / github_repository_name / cicd_configurationCI/CD status and details.
artifact_registry_repository / cloudbuild_trigger_name / cloudbuild_trigger_idRegistry and build trigger.
vpc_sc_enabled / vpc_sc_perimeter_name / vpc_sc_dry_run_modeVPC-SC status.
audit_logging_enabled / artifact_registry_cmek_enabledAudit logging and CMEK status.

6. Configuration Pitfalls & Sensible Defaults

Risk: Critical (data loss / outage / security) — High (service degraded) — Medium (cost or partial degradation) — Low (minor).

SettingSensible valueRiskConsequence if wrong
database_typePOSTGRES_15CriticalZammad requires PostgreSQL; MySQL is rejected at plan time.
container_image_sourcecustom (default)CriticalUsing prebuilt without the custom entrypoint means DB_*POSTGRESQL_* mapping does not happen and all database connections fail on startup.
enable_cloudsql_volumetrueCriticalDisabling removes the Auth Proxy socket; all database connections fail.
db_name / db_userset onceCriticalImmutable after first deploy; renaming recreates the DB/user and destroys all helpdesk data.
enable_backup_importfalse unless restoringCriticalEnabling without a valid backup fails the import job; enabling on every apply overwrites live data.
enable_redistrueCriticalWithout Redis, ActionCable and Sidekiq fail to initialise; Zammad will not start.
redis_hostexplicit or NFS IPCriticalEmpty with NFS disabled means no valid Redis endpoint — Zammad fails to start.
memory_limit4GiHighZammad OOMs during schema migration or under load below 2 GiB.
nfs_mount_path/opt/zammad/storageHighChanging this causes attachments to be written to ephemeral instance storage; existing NFS attachments become inaccessible.
enable_nfstrueHighWithout NFS, all uploaded attachments are lost on instance restart.
min_instance_count1High0 causes 60–90-second cold starts for the first agent to open a ticket.
vpc_egress_settingALL_TRAFFIC when using MemorystoreHighMemorystore Redis private IP may not be reachable with PRIVATE_RANGES_ONLY; Redis connections are refused.
startup_probe.initial_delay_seconds60 (or higher)HighToo short causes restart loops while schema migration is running on first boot.
max_instance_count > 1 without Redisconfigure Redis firstMediumMultiple instances without Redis cause race conditions on ticket assignment and real-time state divergence.
enable_iap / enable_cloud_armorenable for admin-facingMediumThe Zammad admin UI is otherwise publicly reachable.
backup_retention_days7 (raise for prod)MediumToo short for compliance retention.
enable_cdnoff (default)MediumZammad's API responses are dynamic; CDN caching breaks ticket lists and real-time views unless Cache-Control: no-cache headers are set.

For the foundation behaviour referenced throughout — service identity, scaling and concurrency, ingress and load balancing, CI/CD, Cloud Armor, IAP, Binary Authorization, VPC-SC, backups, and image mirroring — see App_CloudRun. Zammad-specific application configuration shared with the GKE variant is described in Zammad_Common.