Skip to main content

Logto on Google Cloud Run

Logto on Google Cloud Run

Logto is an open-source, MPL-2.0-licensed identity provider — an Auth0 alternative that speaks OIDC and OAuth 2.0 and ships with sign-in flows, social/enterprise connectors, multi-tenancy, and an admin console. This module deploys Logto 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 Logto 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.


What Logto costs on RAD, and how that compares​

Logto on RAD's Cloud Run module costs about US$110 a month in your own project, with no per-user or per-MAU fee. RAD charges 175 credits once per deployment in your own project (157.5 credits, 10% lower, in a project RAD manages), plus build time. Logto also deploys on GKE Autopilot for about US$150 a month — see the GKE guide if you need it to run there instead. If you only need it occasionally, a RAD-managed project can be deleted and restored within 30 days for a few credits, so that monthly figure becomes a few dollars instead — see Pause it for free, below.

What you pay on RAD​

In a Google Cloud project you ownIn a project RAD manages for you
Module fee, once per deployment175 credits (US$17.50 at the top-up price)157.5 credits (10% lower)
Build timeA few credits per buildThe same
Google Cloud running costBilled by Google to your own billing account, about US$110 a month for the default configuration (table below)Metered hourly in credits; RAD publishes 49 credits a day, about 1,470 a month (about US$147.00 at the top-up price, less on a plan)
Who owns whatYou own the project and its billing; RAD deploys and updates itRAD owns the project, with guardrails, quotas and budget alerts; you get console access, and a minimum purchased balance is held in reserve

10 credits cost US$1 on a one-off top-up, and less on a monthly plan. In a project RAD manages, the database, file server and network are shared by every application in the project, so a second application does not add a second database.

Default running cost in your own project (us-central1, Google list prices):

Resource (module default)Per month
Cloud Run, 2x vCPU / 4 GiB (warm)US$39
Cloud SQL for PostgreSQL, 1 vCPU / 3.75 GB, zonal, 10 GB SSDUS$51
NFS/cache file server (small VM)US$13
Cloud NAT and networkingUS$5
Cloud Storage (add-ons, backups)US$1
Totalabout US$110

How it compares​

  • Auth0 (B2C) starts at US$35 a month on its Essentials plan for up to 500 monthly active users, scaling with MAUs after that; its B2B Essentials plan starts at US$150 a month. A free tier covers up to 25,000 MAUs but drops most enterprise features.
  • RAD's Logto module costs about US$110 a month in your own project — more than Auth0's entry tier at very low user counts, but it has no MAU-based metering or per-tenant pricing tier to grow out of, and you hold the user database and signing keys yourself rather than trusting a third party with every login.
  • Self-managed comparison: Logto's 2 vCPU / 4 GiB footprint is close to a GCP Compute Engine e2-standard-2 (~US$49/month) or a larger Hetzner/DigitalOcean box, plus you would still need to run and patch PostgreSQL and the NFS/cache layer it depends on yourself.

Pause it for free: delete a RAD-managed project, restore it when you need it​

If Logto runs in a project RAD manages for you, you have a second option that goes well beyond scaling to zero: delete the whole project, and restore it within 30 days for close to nothing. This suits Logto you only need occasionally — evaluating it, a demo environment, a seasonal or intermittent workload — far better than running it continuously.

  • How it works. Deleting a RAD-managed project unlinks its billing first, then asks Google to delete the project. Google does not remove the project immediately: it keeps it, recoverable, for 30 days. Because billing is already unlinked, nothing is charged while it waits. Unlike deleting one module, this does not tear down the database, any VM or the compute resource one by one — the whole project, and everything in it, simply stops.
  • Restoring costs a few credits, not a rebuild. Within 30 days, the project's owner can restore it. RAD asks Google to undelete the project and reattaches its billing account, then asks you to run Update on each deployment to confirm everything came back. Because nothing was individually destroyed, that Update finds the same resources already there — it is a check, not a rebuild, and an Update never charges the module fee again. For Logto behind Services_GCP (a small NFS/cache VM, a Postgres database) and Project_GCP, that is roughly a handful of credits (under US$1) in total, against the about 180 credits (US$18.00) a full redeploy costs.
  • So a month of occasional use can cost a few dollars, not US$110. Deploy Logto, use it for a while, delete the project. Restore it next time you need it, confirm with Update, and delete it again when you're done. You pay only for the module fee once, the builds, and whatever time it was actually live.
  • What this needs. You must own the project (not one RAD only manages billing for), and you restore it yourself within the 30 days — after that, Google deletes it for good. Restoring is admitted like creating a new project: your purchased credit balance must still clear the tier's floor (100 credits for the sandbox tier most evaluation use fits). Google says most services are fully working again within 36 hours of a restore.
  • One real gap: nightly backups do not survive. Backups and other generated files are written to a bucket inside the project, and that bucket is not protected by Cloud Storage's soft-delete, so it is very likely gone as soon as you delete the project — even though the project itself is recoverable for 30 days. If you have customised Logto and want to keep that work, copy a backup out (to Google Drive, or a bucket outside the project) before you delete. For a default installation with nothing irreplaceable in it, this does not matter.

Pay only while you use it, the other way: delete and redeploy​

The option above only applies to a RAD-managed project; in your own project, or once the 30-day window has passed, the way to stop paying is to delete the deployment and deploy it again when you need it.

  • What a redeploy costs. The module fee again, plus the builds — roughly 180 credits (US$18.00) in total. Deleting saves money only once Logto would otherwise sit unused long enough to clear that redeploy cost against its own running cost — about 5 days or more, both in your own project (about US$3.66 a day) and in a RAD-managed one (49 credits a day).
  • Most of the running cost is usually shared. For Logto that is the database and the shared file/cache VM. They stop only when nothing else in the project uses them, so deleting this app while something else shares the project saves only this app's own compute part.
  • Keep your data first. Nightly backups go to a bucket inside the deployment and are deleted with it, so copy the latest backup out before deleting if you want to keep it.

Lab sessions and Managed Environments​

  • Lab sessions, for training. A trainer runs a session for a class. Each participant gets the app in their own Google Cloud project for 15 minutes to 24 hours, within an allowance the trainer sets. Either the trainer funds every place, or each participant pays for their own. Everything is deleted when the session ends and unused credits go back to the trainer.
  • Managed Environments, for consultancies. A partner runs the app for a client from a ring-fenced wallet it funds, and settles with the client directly. If the wallet runs low, billing pauses and the data is kept, so nobody receives an unexpected charge. At the end the partner hands the project over and the deployments become the client's own.

Credits can be bought in more than 20 currencies, including XAF, XOF, NGN, GHS, KES and ZAR, by card, bank transfer or mobile money.

Sources (8 October 2026): Google Cloud list prices from the Cloud Billing Catalog API; RAD fees and the daily-credit estimate from radmodules.dev/pricing; Delete and restore projects for the pause/restore mechanics and what it says about Cloud Storage objects without soft delete; Auth0. Prices change; check each source before relying on a figure.

1. Overview​

Logto runs as a Node.js container on Cloud Run v2. The deployment wires together a focused set of Google Cloud services:

CapabilityGoogle Cloud serviceNotes
ComputeCloud Run v2Node.js service, 2 vCPU / 4 GiB by default; serverless autoscaling
DatabaseCloud SQL for PostgreSQL 15Required — Logto does not support MySQL or other engines
Object storageCloud StorageOne bucket provisioned automatically; optional for Logto (all core state is in Postgres)
SecretsSecret ManagerOnly the database password — Logto has no external application secret (OIDC keys are DB-seeded)
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 mandatory. The database engine is fixed by the shared application layer; a plan-time guard rejects any non-PostgreSQL database_type.
  • Logto core is published on port 3001; the admin console (3002) is not. Cloud Run publishes a single port, so only the core API / OIDC endpoint (3001) is reachable. The admin console — where the first admin account and applications are registered — runs on 3002 and is not exposed through the run.app URL. Plan a separate path to 3002 for first-run setup (see §3).
  • There is no application secret to protect. Logto generates its OIDC signing keys on first boot and stores them in the database. Nothing in Secret Manager needs to be guarded or rotated except the foundation-managed DB password. Protecting Logto's keys means protecting Cloud SQL.
  • min_instance_count = 1 by default. Logto is an identity provider on the request path of every login, so one instance is kept warm to avoid cold-start latency on OIDC requests. All state is in Postgres, so 0 (scale-to-zero) is data-safe if you prefer to trade cold starts for cost.
  • cpu_always_allocated = false (request-based billing). Logto core is a request/response OIDC provider with no in-process background worker that must run without an inbound request, so CPU is billed only while serving.
  • The connection bypasses the Cloud SQL socket. enable_cloudsql_volume = true still injects the Auth Proxy sidecar, but Logto's slonik driver cannot parse the Unix-socket DSN form — the entrypoint connects over the injected private IP (DB_IP) with sslmode=no-verify instead (encrypted; CA verification is skipped for the DB hop only).
  • No Redis. Logto is Postgres-backed; enable_redis defaults to false.
  • ENDPOINT is derived from the service URL. The entrypoint sets Logto's OIDC issuer and absolute URLs from the injected CLOUDRUN_SERVICE_URL; override ENDPOINT via environment_variables for a custom domain.

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

Logto 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. The published container port is 3001 (Logto core / OIDC).

  • 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"
    # Confirm the injected DB_HOST / DB_IP / ENDPOINT on the running revision:
    gcloud run services describe <service-name> --project "$PROJECT" --region "$REGION" \
    --format='value(spec.template.spec.containers[0].env)'

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

B. Cloud SQL for PostgreSQL 15​

Logto stores everything — users, applications, connectors, OIDC signing keys, and per-tenant roles — in a managed Cloud SQL for PostgreSQL 15 instance. On Cloud Run the Auth Proxy sidecar is injected, but the app connects over the instance private IP (DB_IP) with sslmode=no-verify because Logto's driver cannot use the socket DSN form. On first deploy an initialization Job creates the application database and role (with CREATEROLE, required for Logto's per-tenant RLS roles).

  • 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 (logto), user (logto), and password secret are in the Outputs. See App_CloudRun for the connection model, backups, and password rotation.

C. Cloud Storage​

One Cloud Storage bucket is provisioned automatically. Logto keeps all core state in PostgreSQL, so this bucket is available for optional assets rather than required runtime storage.

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

See App_CloudRun for GCS Fuse and CMEK options.

D. Secret Manager​

Logto has no external application secret — its OIDC signing keys are generated and stored in the database on first boot. The only secret in play is the database password, which the foundation generates and manages.

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

See App_CloudRun for injection and rotation details.

E. Networking & ingress​

The service is reachable at its run.app URL by default. Logto's OIDC issuer and all absolute redirect URLs are built from ENDPOINT, which the entrypoint derives from the service URL — so the browser-facing host, the issuer, and registered redirect URIs must all agree. An external HTTPS load balancer with a custom domain, Cloud CDN, and Cloud Armor can be layered on; set ENDPOINT to the custom domain when you do.

  • 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, with optional uptime checks and alert policies. The entrypoint prints a [cloud-entrypoint] line reporting the resolved DB connection mode and ENDPOINT — useful when diagnosing connection or issuer-URL problems.

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

3. Logto Application Behaviour​

  • First-deploy database setup. An initialization Job runs db-init.sh using postgres:15-alpine. It idempotently creates the application role with CREATEDB CREATEROLE (required for Logto's per-tenant RLS roles) and the application database, then grants privileges and transfers public schema ownership to the app role. The job is safe to re-run.
  • Schema and OIDC keys seeded on boot. On start Logto runs npm run cli db seed -- --swe (--swe = seed-when-empty, idempotent) which creates its schema and generates the OIDC private signing keys into the database — only when the database is empty. These keys are not stored in Secret Manager; the database is their sole custodian. Wiping the database regenerates new keys and invalidates all previously issued tokens and registered clients.
  • No application secret to rotate. There is no encryption key or JWT secret in Secret Manager — only the foundation-managed DB password.
  • Admin console (3002) is not published. Cloud Run exposes only the core (3001). The admin console — where you create the first administrator and register applications — runs on 3002 and is not reachable through the run.app URL. Complete first-run setup by fronting Logto with a proxy that routes to 3002, or by temporarily exposing 3002 through a dedicated deployment. ADMIN_ENDPOINT defaults to the same host as ENDPOINT for URL consistency.
  • ENDPOINT must match the browser-facing host. Logto builds its OIDC issuer and redirect URLs from ENDPOINT; the entrypoint sets it from CLOUDRUN_SERVICE_URL. For a custom domain, set ENDPOINT in environment_variables before deploying.
  • Health path. Startup, liveness, and readiness probes target /api/status — an unauthenticated endpoint that returns 200 once the core is up. The startup probe allows a wide first-boot window (60s initial delay + 30 retries) for the seed step. Verify it manually:
    curl -s "$(gcloud run services describe <service-name> --region "$REGION" \
    --format='value(status.url)')/api/status"
  • 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 Logto 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.

Group 2 — Deployment Environment​

VariableDefaultDescription
tenant_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_namelogtoBase name for resources. Do not change after first deploy.
display_nameLogtoHuman-readable name shown in the Console.
descriptionLogto - open-source Auth0-alternative identity provider (OIDC)Service description.
application_versionlatestLogto image tag (svhd/logto:<tag>); pin to a specific release (e.g. 1.33) in production.

Group 4 — Runtime & Scaling​

VariableDefaultDescription
deploy_applicationtrueSet false to provision infrastructure only.
container_image_sourcecustomLogto is built as a thin wrapper FROM svhd/logto — keep custom.
cpu_limit2000mCPU per instance.
memory_limit4GiMemory per instance; Logto needs at least 2 GiB for reliable operation.
cpu_always_allocatedfalseRequest-based billing (CPU billed only while serving). Logto has no background worker to keep alive.
min_instance_count1Keep 1 warm so OIDC/login requests never hit a cold start; 0 is data-safe (all state in Postgres).
max_instance_count5Cost ceiling; must be ≥ min_instance_count.
container_port3001Logto core listens on 3001; the admin console (3002) is not published.
execution_environmentgen2Gen2 recommended.
timeout_seconds300Maximum request duration.
enable_cloudsql_volumetrueInjects the Auth Proxy sidecar; Logto still connects via DB_IP (socket DSN unsupported by slonik).

Group 5 — Access & Ingress Control​

VariableDefaultDescription
ingress_settingsallPublic ingress so external OIDC clients and browsers can reach Logto.
vpc_egress_settingPRIVATE_RANGES_ONLYRoute only RFC 1918 traffic via VPC.
enable_iapfalseRequire Google sign-in. Blocks unauthenticated OIDC/login traffic — leave off for a public IdP.
iap_authorized_users / iap_authorized_groups[]Who may access through IAP.

Group 6 — Environment Variables & Secrets​

VariableDefaultDescription
environment_variables{}Extra non-secret settings. Set ENDPOINT here for a custom domain. Do not set PORT (Cloud Run reserves it) or DB_URL (composed by the entrypoint).
secret_environment_variables{}Map of env var → Secret Manager secret name. Logto needs none by default.
secret_propagation_delay30Seconds to wait after secret creation before proceeding.

Group 7 — Backup & Restore​

VariableDefaultDescription
backup_schedule0 2 * * *Automated database 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–11 — Load Balancer / Storage / Custom SQL​

enable_cloud_armor, application_domains, enable_cdn, and the Artifact Registry retention settings (Group 9); create_cloud_storage, storage_buckets, enable_nfs, gcs_volumes (Group 10); and enable_custom_sql_scripts and friends (Group 11) all follow standard App_CloudRun behaviour. NFS is off by default — Logto needs no shared filesystem.

Group 12 — Database Backend​

VariableDefaultDescription
db_namelogtoPostgreSQL database name. Immutable after first deploy.
db_userlogtoApplication database user (granted CREATEROLE). Immutable after first deploy.
database_password_length32Generated password length.

Group 13 — Jobs & Scheduled Tasks​

VariableDefaultDescription
initialization_jobs[]Leave empty to use the built-in db-init job.

Group 14 — Observability & Health​

VariableDefaultDescription
startup_probeHTTP /api/status, 60s delay, 30 retriesWide first-boot window for the seed step.
liveness_probeHTTP /api/status, 60s delay, 30s periodLiveness probe.
uptime_check_config{ enabled=false, path="/" }Cloud Monitoring uptime check. Disabled by default; enable and set path = "/api/status" for production monitoring.

Group 21 — Redis Cache & Queue​

VariableDefaultDescription
enable_redisfalseLogto uses Postgres for all persistence — leave false.

Group 22 — VPC Service Controls & Audit Logging​

VariableDefaultDescription
enable_vpc_scfalseEnforce a VPC-SC perimeter.
enable_audit_loggingfalseDetailed Cloud Audit Logs.

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 (Logto core / OIDC endpoint).
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.
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).

Inherited plan-time validation. This module passes its configuration through the App_CloudRun foundation engine, which validates values and combinations at plan time — a non-PostgreSQL database_type, min_instance_count > max_instance_count, Redis enabled with no resolvable host, enable_cloudsql_volume with no database. 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
Cloud SQL databaseBack up; never wipeCriticalLogto's OIDC signing keys live in the DB. Wiping it regenerates new keys and invalidates every issued token and registered client.
db_name / db_userSet onceCriticalImmutable after first deploy; renaming recreates the DB/role and destroys all identity data.
database_typePOSTGRES_15CriticalMySQL/other engines are rejected at plan time; Logto only runs on PostgreSQL.
enable_backup_importfalse unless restoringCriticalEnabling without a valid backup file fails the import job.
ENDPOINTActual browser-facing hostHighA mismatched issuer breaks OIDC discovery, redirect URIs, and every OAuth callback.
container_port3001HighThe core listens on 3001; a wrong port makes every probe and request fail. Admin console (3002) is intentionally unpublished.
enable_iapfalse for a public IdPHighIAP blocks all unauthenticated requests, including the OIDC/login flows Logto exists to serve.
memory_limit4Gi (≥ 2 GiB)HighBelow ~2 GiB Logto is prone to OOM under load.
Admin console access (3002)Plan a route before go-liveHighThe first-admin/setup UI is on 3002, unreachable via the run.app URL — first-run setup stalls without a separate path.
enable_cloudsql_volumetrueMediumThe proxy sidecar is injected for parity, but Logto connects via DB_IP; disabling it removes the sidecar without harming the app's private-IP path.
min_instance_count1 for productionMediumScale-to-zero (0) adds cold-start latency to the first login after idle (data-safe otherwise).
enable_redisfalseLowLogto does not use Redis; enabling it wires an unused dependency.
backup_retention_days7 (raise for prod)MediumToo short for compliance retention.

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

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