Skip to main content

LimeSurvey on Google Cloud Run

LimeSurvey on Google Cloud Run

LimeSurvey is a free, open-source (GPL) online survey and questionnaire platform written in PHP, supporting unlimited surveys, conditional branching, quotas, and multi-language questionnaires with exportable results. This module deploys LimeSurvey 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 LimeSurvey 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

LimeSurvey runs as a PHP/Apache container on Cloud Run v2. The deployment wires together a focused set of Google Cloud services:

CapabilityGoogle Cloud serviceNotes
ComputeCloud Run v2PHP/Apache service on port 8080, 1 vCPU / 2 GiB by default; scale-to-zero supported
DatabaseCloud SQL for MySQL 8.0Required — the engine is fixed and InnoDB is forced
File persistenceCloud Filestore (NFS)Persists /var/www/html/upload across restarts; enabled by default
Object storageCloud StorageA dedicated limesurvey-uploads bucket provisioned automatically
Cache (optional)RedisOptional object cache; disabled by default
SecretsSecret ManagerAuto-generated ADMIN_PASSWORD; database password
IngressCloud Run URL / Cloud Load BalancingDefault run.app URL; optional external HTTPS load balancer + custom domain

Sensible defaults worth knowing up front:

  • MySQL 8.0 is mandatory and InnoDB is forced. The engine is fixed by the shared application layer (database_type = MYSQL_8_0). InnoDB is forced because Cloud SQL disables MyISAM — the image's MyISAM default would otherwise fail table creation on first boot.
  • The schema is created on first container start, not by a migration job. The db-init job only provisions an empty database + user; the upstream LimeSurvey console installer then builds the schema when the app boots. Allow generous startup time on the first deploy.
  • ADMIN_PASSWORD is generated automatically and stored in Secret Manager. The container refuses to start without it. The first super-admin is seeded as admin / admin@techequity.cloud.
  • Cloud SQL is reached over TCP by default (enable_cloudsql_volume = false) — LimeSurvey dials the Cloud SQL private IP over private networking; MySQL over private-IP TCP needs no SSL.
  • NFS is enabled by default (enable_nfs = true) so uploaded assets survive container restarts. Requires the gen2 execution environment (the default).
  • Scale-to-zero is enabled by default (min_instance_count = 0) with max_instance_count = 1. Cold starts add latency after idle; set min_instance_count = 1 to keep the service always warm.
  • PUBLIC_URL is set from the service URL at plan time and corrected at runtime by the container entrypoint, so survey links and assets resolve on the real host.
  • Public ingress is the default (ingress_settings = "all") so respondents can reach public surveys. Enabling IAP will block anonymous respondents.

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 LimeSurvey service

LimeSurvey 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 MySQL 8.0

LimeSurvey stores all application data (surveys, questions, responses, users, global settings) in a managed Cloud SQL for MySQL 8.0 instance. By default the service connects over private-IP TCP (enable_cloudsql_volume = false); no public IP is exposed. On first deploy the db-init Job creates the application database and user; the schema is then built by LimeSurvey's own installer on container start.

  • 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> --database=<db-name> --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. Cloud Filestore (NFS)

Enabled by default, a Cloud Filestore (NFS) instance is mounted into the service so LimeSurvey's upload directory (/var/www/html/upload — asset images, signatures, barcodes, uploaded response files) persists across container restarts and revisions. NFS mounts require the gen2 execution environment.

  • Console: Filestore → Instances.
  • CLI:
    gcloud filestore instances list --project "$PROJECT"

See App_CloudRun for the shared-NFS discovery model.

D. Cloud Storage

A dedicated Cloud Storage bucket (limesurvey-uploads) is provisioned automatically. Additional buckets can be declared via storage_buckets.

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

See App_CloudRun for GCS Fuse and CMEK options.

E. Redis (optional object cache)

Redis is disabled by default (enable_redis = false). It is an optional object cache and is not required for LimeSurvey to run. When redis_host is left empty and enable_nfs is true, the NFS server VM's IP is used as the Redis endpoint.

  • Console: Memorystore → Redis (if using a managed instance).
  • CLI:
    redis-cli -h <redis-host> ping
    # Inspect env injected into the running revision:
    gcloud run services describe <service-name> --region "$REGION" \
    --format='value(spec.template.spec.containers[0].env)'

F. Secret Manager

The LimeSurvey super-administrator password (ADMIN_PASSWORD) is generated automatically and stored in Secret Manager, then injected as a secret env. The database password is managed separately by the foundation.

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

See App_CloudRun for injection and rotation details.

G. Networking & ingress

The service is reachable at its run.app URL by default, allowing the public access needed for anonymous survey respondents. An external HTTPS load balancer with a custom domain, Cloud CDN, and Cloud Armor can be layered on; ingress settings and VPC egress control connectivity.

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

H. 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. LimeSurvey Application Behaviour

  • First-deploy database setup. An initialization Job runs db-init.sh using mysql:8.0-debian. It connects over the Cloud SQL socket (if mounted) or the private-IP TCP fallback and idempotently creates the application database and user, grants privileges, and verifies the app user can connect. The job is safe to re-run.
  • Schema created on container start. There is no separate migration job. Once db-init has provisioned an empty database, the upstream martialblog/limesurvey entrypoint runs LimeSurvey's console installer / updatedb on boot to build (or upgrade) the schema. If the container reports healthy but every page 500s with "table settings_global not found", the installer silently failed — almost always a storage-engine problem (see InnoDB note below) or a DB the installer could not reach.
  • InnoDB is forced. DB_MYSQL_ENGINE = InnoDB and DBENGINE = InnoDB are set because Cloud SQL disables MyISAM. Do not override these back to MyISAM — table creation will fail.
  • ADMIN_PASSWORD is required. The container exits 1 without it. It is auto-generated and stored in Secret Manager, and seeds the initial super-admin (admin / admin@techequity.cloud) on first boot. Retrieve it before first login:
    gcloud secrets versions access latest \
    --secret="$(gcloud secrets list --project "$PROJECT" \
    --filter='name~admin-password' --format='value(name)' | head -1)" \
    --project "$PROJECT"
  • Public URL. PUBLIC_URL is set from the predicted service URL at plan time and corrected at runtime from CLOUDRUN_SERVICE_URL, so survey links and static assets resolve on the real Cloud Run host. Confirm the deployed URL:
    gcloud run services describe <service-name> --region "$REGION" \
    --project "$PROJECT" --format='value(status.url)'
  • Health path. The startup probe is TCP against the container port; the liveness probe is GET / (LimeSurvey serves an unauthenticated 200 at the root landing page). Allow generous first-boot time for the console installer.
  • Uploaded files. Persist under /var/www/html/upload via the NFS mount. Without NFS, uploaded assets are lost when the instance is recycled.
  • Inspect job execution:
    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 LimeSurvey are listed; every other input is inherited from App_CloudRun with its standard behaviour.

Group 3 — Application Identity

VariableDefaultDescription
application_namelimesurveyBase name for the service, registry repo, and secrets. Do not change after first deploy.
display_nameLimeSurveyHuman-readable name shown in the Console.
application_versionlatestMaps to the martialblog/limesurvey base tag; latest resolves to the pinned 6-apache. Pin (e.g. 6-apache) in production.

Group 4 — Runtime & Scaling

VariableDefaultDescription
deploy_applicationtrueSet false to provision infrastructure only.
cpu_limit1000mCPU per instance; 1 vCPU minimum for LimeSurvey + MySQL.
memory_limit2GiMemory per instance; 512Mi minimum, 2Gi recommended.
min_instance_count00 enables scale-to-zero; set 1 to avoid cold starts.
max_instance_count1Keep at 1 unless shared NFS + session handling for multi-instance is confirmed.
container_port8080LimeSurvey (Apache) listens on 8080.
execution_environmentgen2Gen2 required for NFS and GCS Fuse mounts.
timeout_seconds300Max request duration; raise for large CSV imports.
enable_cloudsql_volumefalsefalse uses private-IP TCP to MySQL; set true for the Auth Proxy socket.

Group 5 — Access & Ingress Control

VariableDefaultDescription
ingress_settingsallall allows anonymous survey respondents. internal blocks the public.
enable_iapfalseRequire Google sign-in. Blocks anonymous respondents.

Group 11 — Storage & Filesystem

VariableDefaultDescription
enable_nfstrueProvisions Filestore and mounts it to persist /var/www/html/upload. Requires gen2.
nfs_mount_path/var/www/html/uploadContainer mount path for the NFS volume.
create_cloud_storagetrueCreate the declared GCS buckets.
gcs_volumes[]GCS Fuse volume mounts (requires gen2).

Group 12 — Database Backend

VariableDefaultDescription
database_typeMYSQL_8_0Fixed to MySQL 8.0. Other engines are unsupported.
db_namelimesurveyDatabase name (injected as DB_NAME). Immutable after first deploy.
db_userlimesurveyApplication DB user (injected as DB_USERNAME). Password auto-generated in Secret Manager.

Group 21 — Redis Cache

VariableDefaultDescription
enable_redisfalseOptional object cache; not required.
redis_host""Redis endpoint. Leave empty to use the NFS server IP (requires enable_nfs = true).
redis_port6379Redis port.

All other inputs follow standard App_CloudRun behaviour.


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 details (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.
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 / 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).

Inherited plan-time validation. This module passes its configuration through the App_CloudRun foundation engine, which validates values and combinations at plan time — a gen1 runtime with NFS/GCS mounts, IAP with no authorized identities, an out-of-range redis_port/backup_retention_days, a database_type that does not match an enabled extension. Invalid configuration fails the plan with a clear, named error before any resource is created, so most mistakes below are caught up front rather than at apply or runtime.

SettingSensible valueRiskConsequence if wrong
DB_MYSQL_ENGINE / DBENGINE (auto InnoDB)Never set to MyISAMCriticalCloud SQL disables MyISAM; the installer's CREATE TABLE … ENGINE=MyISAM fails and every page 500s ("table settings_global not found").
database_typeMYSQL_8_0CriticalLimeSurvey requires MySQL; changing to Postgres/None breaks startup.
db_name / db_userSet onceCriticalImmutable after first deploy; renaming recreates the DB/user and destroys all survey data.
ADMIN_PASSWORD (auto-generated)Retrieve from Secret ManagerCriticalThe container exits 1 without it; changing it re-seeds the super-admin on next boot.
enable_backup_importfalse unless restoringCriticalEnabling without a valid backup URI fails the import job.
enable_nfstrueHighWithout NFS, uploaded assets under /var/www/html/upload are lost when the instance recycles.
max_instance_count1HighMultiple instances without confirmed shared NFS + session handling cause inconsistent upload state.
execution_environmentgen2HighNFS/GCS mounts require gen2; gen1 fails the plan-time validation.
ingress_settingsallHighinternal blocks anonymous survey respondents from reaching public surveys.
enable_iaponly for internal-only surveysHighIAP requires Google sign-in for every request, blocking anonymous respondents.
memory_limit2GiHighBelow 512Mi risks OOM during large survey rendering or CSV import.
enable_cloudsql_volumefalse (TCP)MediumLimeSurvey/MySQL uses private-IP TCP; forcing the socket without a mounted volume can stall the DB connection.
min_instance_count1 for productionMediumScale-to-zero (0) adds cold-start latency on the first request after idle.
application_versionpin (e.g. 6-apache)Mediumlatest resolves to the pinned 6-apache; an unpinned major bump can require a schema upgrade.

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. LimeSurvey-specific application configuration shared with the GKE variant is described in LimeSurvey_Common.