Skip to main content

SimpleRisk on Google Cloud Run

SimpleRisk is a free, open-source governance, risk and compliance (GRC) platform. Security and compliance teams use it to keep a risk register, score risks, plan and track mitigations, run management reviews and keep an auditable history for assessors. This module deploys SimpleRisk 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 SimpleRisk 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​

SimpleRisk runs as a PHP application under Apache on Cloud Run v2. The deployment wires together a focused set of Google Cloud services:

CapabilityGoogle Cloud serviceNotes
ComputeCloud Run v2Apache + PHP, 1 vCPU / 2 GiB by default; scale-to-zero by default
DatabaseCloud SQL for MySQL 8.0Required — SimpleRisk_Common fixes the engine; holds the risk register, users and sessions
Object storageCloud Storage (GCS FUSE)A storage bucket mounted at /var/www/simplerisk/files for uploaded files; a generic data bucket is also created but unused
SecretsSecret ManagerThe database password only — SimpleRisk needs no other generated secret
IngressCloud Run URL / Cloud Load BalancingDefault run.app URL; optional external HTTPS load balancer + custom domain

Sensible defaults worth knowing up front:

  • The vendor image is not used as shipped. simplerisk/simplerisk is an all-in-one appliance that runs its own MySQL server inside the container and keeps every piece of state in Docker volumes — ephemeral on Cloud Run, so the stock image would come back with an empty risk register after every cold start, with no error. SimpleRisk_Common builds a wrapper image whose entrypoint points SimpleRisk at Cloud SQL instead (see SimpleRisk_Common).
  • MySQL 8.0 is mandatory, reached over the instance's private IP (DB_IP) — enable_cloudsql_volume = false, no Auth Proxy socket.
  • There are no default credentials. On first access SimpleRisk shows a Default Admin Account Creation form, and whoever submits it becomes the administrator. The service is public by default, so create the account as soon as the deployment finishes (see §6).
  • Scale-to-zero is enabled by default (min_instance_count = 0, max_instance_count = 1). Sessions are stored in the database, so raising max_instance_count does not log users out when requests land on different instances.
  • Pin an exact image tag. SimpleRisk tags are dated build ids (20260909-001, the default), not semver.
  • NFS is not used (enable_nfs = false); uploaded files go to the GCS FUSE volume.

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 SimpleRisk service​

SimpleRisk 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​

All SimpleRisk data — risks, assessments, mitigations, users, and PHP sessions — lives in a managed Cloud SQL for MySQL 8.0 instance. The service connects to the instance's private IP over TCP. On first deploy two jobs run in order: db-init creates the application database and user, then schema-load loads SimpleRisk's schema (/simplerisk.sql, shipped inside the vendor image).

  • 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 Storage​

SimpleRisk_Common declares a storage bucket (public access prevention enforced) and, with enable_gcs_storage_volume = true, mounts it with GCS FUSE at /var/www/simplerisk/files, where SimpleRisk keeps uploaded files. The Foundation's generic data bucket (storage_buckets) is also created but SimpleRisk does not use it. Both are created only when create_cloud_storage = true.

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

D. Secret Manager​

SimpleRisk itself mints no secrets. The only generated credential is the database password, which the Foundation creates and injects as DB_PASSWORD; its secret name is the database_password_secret output. Data-at-rest encryption (a SimpleRisk Extra) is deliberately not enabled: it would introduce a key file on the container filesystem, which is ephemeral on Cloud Run.

  • Console: Security → Secret Manager.
  • CLI:
    gcloud secrets list --project "$PROJECT" --filter="name~simplerisk"

E. Networking & ingress​

The service is reachable at its run.app URL by default (ingress_settings = "all", allUsers invoker). An external HTTPS load balancer with a custom domain, Cloud CDN, and Cloud Armor can be layered on with enable_cloud_armor.

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

F. Cloud Logging & Monitoring​

Container logs flow to Cloud Logging; Cloud Run and Cloud SQL metrics flow to Cloud Monitoring. An uptime check is created only when uptime_check_config is enabled and min_instance_count >= 1 — a scale-to-zero service is not probed.

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

3. SimpleRisk Application Behaviour​

  • What the wrapper entrypoint does on every boot. It renders /var/www/simplerisk/includes/config.php from the vendor's config.sample.php, substituting the Foundation-injected DB_IP, DB_PORT, DB_NAME, DB_USER and DB_PASSWORD with PHP str_replace (a generated password containing /, & or \ would break a sed substitution), and sets USE_DATABASE_FOR_SESSIONS to true. It then starts Apache. If DB_IP, DB_NAME, DB_USER or DB_PASSWORD is missing, the container exits rather than starting against nothing.
  • Port 80 serves the application. The vendor image serves SimpleRisk only on 443 and turns port 80 into an HTTP-to-HTTPS redirect, which behind Cloud Run's TLS termination is an infinite redirect loop. The wrapper rewrites the port-80 virtual host to serve /var/www/simplerisk directly (keeping the vendor's security headers, deliberately dropping HSTS) and removes the 443 virtual host.
  • Two-stage init chain. db-init (mysql:8.0-debian, up to 3 retries) creates the user and database, grants privileges and verifies the app user can connect. schema-load (app image, depends on db-init, up to 2 retries) counts the tables in the database and loads /simplerisk.sql only if there are none, then counts again to confirm the load landed. Both jobs are created with execute_on_apply = true and are safe to re-run. A fresh load produces about 154 tables.
  • Health check behaviour. Startup and liveness probes are HTTP GET / (startup: 30s initial delay, 15s period, 20 failures allowed). Note that the page renders before SimpleRisk needs the database, so a passing probe does not prove the database connection works — use the first-run form or a login to check that.
    curl -s -o /dev/null -w "%{http_code}\n" "$SERVICE_URL/"
  • First-run administrator. On first access SimpleRisk renders a Default Admin Account Creation form; submitting it creates the administrator. Seeing that form is also the proof that the app is talking to the (empty-of-users) Cloud SQL database.
  • Scheduled tasks. The wrapper runs Apache only — the vendor's supervisord-managed cron is not started — so SimpleRisk's scheduled reports and notifications do not run inside the container. Use cron_jobs if you need them; an entry without image runs the app image.
  • 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 SimpleRisk 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.
tenant_iddemoShort suffix (1–7 lowercase alphanumerics) that makes resource names unique per environment.
regionus-central1Region for the service and regional resources.

Group 2 — Deployment Environment​

VariableDefaultDescription
support_users[]Emails granted project access and monitoring alerts.
resource_labels{}Labels applied to all resources. A module key is reserved by the foundation and is overwritten.

Group 3 — Application Identity​

VariableDefaultDescription
application_namesimpleriskBase name for resources. Do not change after first deploy.
display_nameSimpleRiskHuman-readable name shown in the Console.
descriptionSimpleRisk IT asset management on Cloud RunCloud Run service description; the shipped wording is a leftover and purely cosmetic.
application_version20260909-001simplerisk/simplerisk tag, passed to the build as SIMPLERISK_VERSION. Dated build ids, not semver.
php_memory_limit512MInjected as the lowercase memory_limit env var. The vendor entrypoint that read it is replaced by the module's own, which does not.
admin_emailadmin@example.comNot used — the administrator is created through SimpleRisk's first-run form.
enable_gcs_storage_volumetrueGCS-FUSE-mount the storage bucket at /var/www/simplerisk/files.

Group 4 — Runtime & Scaling​

VariableDefaultDescription
deploy_applicationtrueSet false to provision infrastructure only.
container_image_sourcecustomBuilds the wrapper image via Cloud Build. prebuilt skips the wrapper — the stock image cannot use Cloud SQL.
cpu_limit1000mCPU per instance.
memory_limit2GiMemory per instance.
min_instance_count00 enables scale-to-zero.
max_instance_count1Autoscaling upper bound.
container_port80Apache serves SimpleRisk on port 80.
execution_environmentgen2Required for the GCS FUSE mount.
timeout_seconds300Max request duration (0–3600).
enable_cloudsql_volumefalseKeep false — the app connects to DB_IP over TCP.
enable_image_mirroringtrueMirror the image into Artifact Registry.
container_protocolhttp1HTTP/1.1.
service_annotations{}Custom-namespace keys only; run.googleapis.com/* keys are rejected by the Cloud Run v2 API at apply time.

Group 5 — Access & Ingress Control​

VariableDefaultDescription
ingress_settingsallinternal-and-cloud-load-balancing closes the public run.app URL.
vpc_egress_settingPRIVATE_RANGES_ONLYUppercase values (ALL_TRAFFIC), unlike ingress_settings.
enable_iapfalseRequire Google sign-in; also removes the allUsers invoker binding.
iap_authorized_users / iap_authorized_groups[]Who may access through IAP.

Group 6 — Environment Variables & Secrets​

VariableDefaultDescription
environment_variables{}Merged over the module defaults (DB_PORT = "3306", memory_limit); the Foundation's DB_* variables are kept.
secret_environment_variables{}Map of env var → Secret Manager secret name.
protect_sensitive_environment_variablestrueMoves credential-looking environment_variables into Secret Manager.
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 database backup cron (UTC), run by Cloud Scheduler.
backup_retention_days7Retention, enforced as a lifecycle rule on the backups bucket.
enable_backup_import / backup_source / backup_uri / 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 & NFS Instance​

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. Do not use them to alter SimpleRisk's own tables. nfs_instance_name and nfs_instance_base_name apply only when enable_nfs = true. See App_CloudRun.

Group 10 — Load Balancer, CDN & Image Retention​

VariableDefaultDescription
enable_cloud_armorfalseProvision Global HTTPS LB + Cloud Armor WAF.
admin_ip_ranges[]CIDR ranges allowed for privileged access.
application_domains[]Custom domain names for the HTTPS LB.
enable_cdnfalseEnable Cloud CDN on the HTTPS LB backend.
max_images_to_retain / delete_untagged_images / image_retention_days7 / true / 30Apply only to an inline-created Artifact Registry repository — no effect when images go to the Services_GCP shared repository.

Group 11 — Storage & Filesystem​

VariableDefaultDescription
create_cloud_storagetrueCreate the storage bucket and the generic data bucket.
enable_nfsfalseNot needed by SimpleRisk.
nfs_mount_path/var/lib/simpleriskOnly used when enable_nfs = true; SimpleRisk does not write there.
gcs_volumes[]Extra GCS FUSE mounts (the storage mount is added automatically).
manage_storage_kms_iam / enable_artifact_registry_cmekfalseCMEK options.

Group 12 — Database Backend​

VariableDefaultDescription
database_typeMYSQL_8_0Fixed by SimpleRisk_Common.
db_name / db_usersimpleriskPassed to SimpleRisk_Common. Do not change after first deploy.
database_password_length32Generated password length (16–64). Changing it on a running deployment breaks authentication (see §6).
enable_auto_password_rotationfalseAutomated password rotation.
db_host_env_var_nameDB_IPKeep DB_IP — the entrypoint and schema-load read it.

Group 13 — Jobs & Scheduled Tasks​

VariableDefaultDescription
initialization_jobs[]Leave empty to use the built-in db-init → schema-load chain; a non-empty list replaces both.
cron_jobs[]No scheduled tasks by default. An entry without image runs the app image.

Group 14 — Observability & Health​

VariableDefaultDescription
startup_probeHTTP GET /, 30s delay, 15s period, 20 retriesThe vendor image's own health path.
liveness_probeHTTP GET /, 60s delay, 30s period, 3 retriesSame path.
uptime_check_config{ enabled = false, path = "/" }Created only when enabled and min_instance_count >= 1.
alert_policies[]Metric alert policies.

Group 21 — Redis​

VariableDefaultDescription
enable_redisfalseSimpleRisk has no Redis integration.

Group 22 — VPC Service Controls & Audit Logging​

VariableDefaultDescription
enable_vpc_scfalseEnforce a VPC-SC perimeter (requires an organization).
vpc_sc_dry_runtrueLog violations without blocking.
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.
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 (sensitive) / 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 (db-init, schema-load).
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. 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
First-run administrator formCreate the admin account immediately after deploy, or restrict access firstCriticalSimpleRisk has no default credentials; whoever submits the Default Admin Account Creation form first becomes administrator. With ingress_settings = "all" and the allUsers invoker binding, that can be anyone who finds the URL. ingress_settings = "internal-and-cloud-load-balancing" or enable_iap = true closes the public URL.
container_image_sourcecustomCriticalprebuilt deploys an image without the wrapper entrypoint; the stock image ignores Cloud SQL, runs its own MySQL in the container and loses all data on every cold start, silently.
db_name / db_userSet onceCriticalChanging them points SimpleRisk at a new, empty database.
database_password_lengthLeave unchanged after first deployHighChanging it writes a new password to Secret Manager without updating the Cloud SQL user, so the service and both jobs fail to authenticate. The HTTP probes stay green because / renders without the database. Re-run the db-init job (it runs ALTER USER) to resync.
application_versionAn exact dated tagHighA rebuild under an unchanged tag produces no Terraform diff and no new revision — the running service keeps the old image.
initialization_jobs[]HighAny non-empty list replaces db-init and schema-load; the schema is then never loaded into a fresh database.
db_host_env_var_nameDB_IPHighThe entrypoint requires DB_IP; without it the container exits at start.
enable_backup_importfalse unless restoringCriticalEnabling without a valid backup_uri fails the import job.
min_instance_count1 for productionMediumScale-to-zero adds cold-start latency, and no uptime check is created while it is 0.
enable_cloud_armorenable for productionMediumThe service is publicly reachable without WAF protection by default.
service_annotationscustom-namespace keys onlyLowrun.googleapis.com/* keys pass the plan and fail at apply ("system annotations are not supported").

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. The SimpleRisk-specific application layer is described in SimpleRisk_Common.

Need RAD to do something it does not do yet? Request it on the roadmap, or vote on what is already there.