Skip to main content

PocketBase on Google Cloud Run

PocketBase on Google Cloud Run

PocketBase is an open-source backend in a single file — an embedded SQLite database with a realtime REST API, built-in authentication, file storage, and an admin dashboard. This module deploys PocketBase 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 PocketBase 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 PocketBase costs on RAD, and how that compares​

Running PocketBase in your own Google Cloud project costs about US$19.14/month in infrastructure, plus a one-time module fee of 40 RAD credits (sized at 1 vCPU / 1 GiB on an always-on warm Cloud Run instance). RAD charges the module fee once, at deploy time — never again on Update — plus build time metered in credits; Google Cloud usage itself is billed to your own billing account at Google's list price. On a RAD-managed project the same resources are metered hourly in credits at list price plus RAD's margin — about 9 credits/day — and the module fee is 10% lower, at 36 credits. See "Pause it for free" below for how a RAD-managed PocketBase deployment can be stopped, at no running cost, until you need it again. (or see the GKE guide if you need Kubernetes)

What you pay on RAD​

ItemOwn projectRAD-managed project
Module fee40 credits (once)36 credits (once)
Build time~3-6 credits, metered per build minutesame, metered in credits at list price + RAD's margin
Google Cloud running cost~$19.14/month, billed to your own billing account at Google's list price~9 credits/day, metered hourly at list price + RAD's margin

Default running cost in your own project

ResourceUS$/month (Google list price, us-central1)
Cloud Run, 1x vCPU / 1 GiB (warm)13.14
Cloud NAT and networking5
Cloud Storage (add-ons, backups)1
Total$19.14

How it compares​

  • We could not verify a current, directly-comparable commercial SaaS price for this exact open-source project, so the honest comparison is a bare self-managed server: Hetzner CPX22 (2 vCPU/4GB, $24/mo), a DigitalOcean 2 vCPU/4GB Droplet ($24/mo), or a GCP Compute Engine e2-standard-2 (2 vCPU/8GB, ~$49/mo). This app's own footprint (1 vCPU or less, 1 GiB or less) is smaller than any of those classes, so a bare self-managed box sized to match would cost less than the figures above — but you would still own every patch, backup and security update yourself.
  • RAD is not claiming to beat a bare VPS on sticker price — it usually does not. What RAD adds for the same or a similar dollar figure is a managed database, Secret Manager-held credentials, monitoring, and one-click Update, none of which a bare VPS gives you for free.
  • On a bare VPS you are the one applying OS/database security patches, taking and testing backups, and renewing certificates; RAD's managed Cloud SQL, Secret Manager and monitoring handle all three for you.

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

This is the headline option on a RAD-managed project, and it is free while paused. Deleting a RAD-managed project first unlinks its billing, then asks Google to delete the project itself — Google's own 30-day recoverable soft delete. Unlike deleting a single module, this does not tear down the database, any VM, or the compute resource one at a time: the whole project simply stops, and because billing is already unlinked, nothing is charged while it waits.

Restoring — within 30 days, and only by the project's owner — 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. The whole restore costs only a handful of credits (under US$1) in build time for a typical chain of deployments. What this needs: you must own the project (not merely have RAD manage its billing), you must restore it yourself within the 30 days — after that Google deletes it for good — and restoring is admitted like creating a new project, so your purchased credit balance must still clear the tier's floor (100 credits for the sandbox tier most study and demo use fits). Google says most services are fully working again within 36 hours of a restore.

One real gap: nightly backups are written to a bucket inside the project, and that bucket has Cloud Storage's soft-delete explicitly turned off, so the backup bucket 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 this deployment and want to keep that work, copy a backup out (to Google Drive, or a bucket outside the project) before deleting. For a default install with nothing irreplaceable in it, this does not matter.

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

The other lever, for an own project (or a RAD-managed one past its 30-day restore window), is to delete PocketBase outright and redeploy it later. A redeploy costs the module fee again plus the builds — roughly 43-46 credits in total for this module.

Deleting only saves money once PocketBase would otherwise sit unused long enough to clear that redeploy cost against its own running cost — for this module, that is about 7 days or more of being idle, based on its own US$19.14/month running cost above. Most of that running cost is usually the database and any shared file/cache VM, and they stop only once nothing else in the project uses them, so deleting this app alone saves only its own compute share if something else shares the project.

Keep 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 Billing Catalog API list prices; radmodules.dev/pricing for RAD's own fees and daily-credit estimates; Resource Manager: delete and restore projects for the pause/restore mechanics.

1. Overview​

PocketBase runs as a single self-contained Go binary on Cloud Run v2. The deployment wires together a deliberately minimal set of Google Cloud services:

CapabilityGoogle Cloud serviceNotes
ComputeCloud Run v2Single Go binary, 1 vCPU / 1 GiB by default, listens on port 8090
DatabaseEmbedded SQLiteNo Cloud SQL — the database lives in /pb_data, persisted to Cloud Storage
Persistent storageCloud Storage (GCS FUSE)A dedicated data bucket mounted at /pb_data (gen2 required)
Cache & queueNonePocketBase uses no Redis; enable_redis = false
SecretsSecret ManagerNone auto-generated — auth lives inside SQLite; secrets optional for your own use
IngressCloud Run URL / Cloud Load BalancingDefault run.app URL (ingress = all); optional external HTTPS LB + custom domain

Sensible defaults worth knowing up front:

  • The database is embedded SQLite — there is no Cloud SQL. PocketBase stores every record, auth token, and uploaded file under /pb_data, which is mounted from a Cloud Storage bucket via GCS FUSE. Losing or wiping that bucket loses all data.
  • max_instance_count must stay at 1. SQLite is a single-writer database and the /pb_data FUSE mount is not safe for concurrent writers. Running more than one instance corrupts the database. This is why both min and max default to 1.
  • min_instance_count = 1 by default (no scale-to-zero). Keeping one instance warm avoids cold-start latency and keeps the single SQLite writer live. Cloud Run cold starts would otherwise add first-request latency after idle.
  • The admin account is created interactively on first run at /_/. No admin password is injected. Whoever reaches /_/ first creates the superuser — open the admin URL and create it immediately after deploy.
  • No secret is auto-generated. PocketBase issues and stores all auth itself; Secret Manager is used only if you add your own secrets (SMTP, external backup keys, etc.).
  • Public ingress by default. ingress_settings = "all" — PocketBase is a user-facing web app (admin UI at /_/ plus a public REST API). Enabling IAP will block public API and app traffic.
  • NFS and Redis are disabled. PocketBase needs neither; all state is the single /pb_data volume.
  • gen2 execution environment is required for the GCS FUSE /pb_data mount.

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

PocketBase runs as a Cloud Run v2 service listening on port 8090. Each deployment creates an immutable revision; traffic can be split across revisions for safe rollouts. Keep it at a single instance (see §3).

  • 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. Database — embedded SQLite (no Cloud SQL)​

There is no Cloud SQL instance. PocketBase's database is a set of SQLite files inside /pb_data, which is mounted from the Cloud Storage data bucket. To inspect or back up the database you work with the bucket contents, not a SQL endpoint.

  • Console: Cloud Storage → Buckets → the PocketBase data bucket → pb_data/.
  • CLI:
    # Confirm the service reports NO Cloud SQL attachment:
    gcloud run services describe <service-name> --region "$REGION" \
    --format='value(spec.template.metadata.annotations)'
    # Copy the SQLite database out of the bucket for an offline backup / inspection:
    gcloud storage cp gs://<data-bucket>/data.db ./pb_data-backup.db

C. Cloud Storage — the /pb_data volume​

A dedicated Cloud Storage bucket (suffix storage) is provisioned automatically and mounted at /pb_data via GCS FUSE. It holds the SQLite database, uploaded files, and settings — everything PocketBase persists.

  • Console: Cloud Storage → Buckets.
  • CLI:
    gcloud storage buckets list --project "$PROJECT" --filter="name~storage"
    gcloud storage ls gs://<data-bucket>/ # bucket name is in the Outputs
    gcloud storage du -s gs://<data-bucket>/ # total data size

See App_CloudRun for GCS FUSE and CMEK options. The bucket enforces public-access prevention.

D. Secret Manager​

No secret is auto-generated for PocketBase — its auth is stored inside SQLite. Secret Manager is used only if you inject your own secrets (for example, SMTP credentials or external backup keys) via secret_environment_variables.

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

E. Networking & ingress​

The service is reachable at its run.app URL by default (ingress = all), which allows the public access PocketBase's app and API need. An external HTTPS load balancer with a custom domain, Cloud CDN, and Cloud Armor can be layered on.

  • 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 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. PocketBase Application Behaviour​

  • No first-deploy database job. PocketBase creates its own SQLite database, system collections, and schema on first start under /pb_data. There is no db-init job to run or monitor.
  • Migrations apply automatically on start. PocketBase runs any pending schema migrations itself on every startup, so upgrading application_version applies schema changes with no separate migration step. Always back up /pb_data before a version bump.
  • The admin superuser is created on first run. Open https://<service-url>/_/ right after deploy and create the administrator account. Until it exists, anyone who reaches /_/ can claim it — treat this as a time-sensitive first-run step.
  • The /pb_data volume is the only durable state. The SQLite database, uploaded files, and settings all live there. Protect the data bucket accordingly; back it up on a schedule.
  • Single-instance by design. SQLite serialises writes through one database file and the GCS FUSE mount is single-writer. min_instance_count and max_instance_count both default to 1; do not raise max_instance_count.
  • Health path. Startup and liveness probes target /api/health, PocketBase's public, unauthenticated endpoint (returns HTTP 200 / {"code":200,"message":"API is healthy."}). First boot is fast because there is no external DB to wait on.
  • Verify runtime state:
    curl -s "$(gcloud run services describe <service-name> --region "$REGION" \
    --format='value(status.url)')/api/health"
    gcloud run services describe <service-name> --region "$REGION" \
    --format='value(spec.template.spec.containers[0].env)'

4. Configuration Variables​

Variables are grouped exactly as they appear on the deployment platform. Only settings specific to or notable for PocketBase 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_namepocketbaseBase name for resources. Do not change after first deploy.
application_versionlatestImage tag; latest resolves to the pinned 0.22.21 build ARG. Pin an explicit release in production.

Group 4 — Runtime & Scaling​

VariableDefaultDescription
deploy_applicationtrueSet false to provision infrastructure only.
cpu_limit1000mCPU per instance; 1 vCPU is comfortable for the single Go binary.
memory_limit1GiMemory per instance; PocketBase is lightweight (512Mi is often enough).
min_instance_count1Keep at 1 — avoids cold starts and keeps the single SQLite writer live.
max_instance_count1Do not raise. SQLite + GCS FUSE are single-writer; >1 corrupts data.
container_port8090PocketBase listens on 8090 (HTTP API + admin UI).
execution_environmentgen2Required for the GCS FUSE /pb_data mount.
enable_cloudsql_volumefalseForced off — PocketBase uses no Cloud SQL.
enable_image_mirroringtrueMirror/build the PocketBase image into Artifact Registry.

Group 5 — Access & Ingress Control​

VariableDefaultDescription
ingress_settingsallPublic access for the app UI and REST API. internal restricts to the VPC.
enable_iapfalseRequire Google sign-in. Blocks the public API and admin UI.

Group 6 — Environment Variables & Secrets​

VariableDefaultDescription
environment_variables{}Extra non-secret settings for the container (PocketBase needs none for first boot).
secret_environment_variables{}Map of env var → Secret Manager secret name (only for your own secrets).

Group 11 — Storage & Filesystem​

VariableDefaultDescription
create_cloud_storagetrueProvision the /pb_data data bucket and any extra storage_buckets.
storage_buckets[]Additional GCS buckets beyond the auto-provisioned data bucket.
enable_nfsfalseNFS is off — PocketBase persists everything to the /pb_data bucket.
gcs_volumes[]Extra GCS FUSE volumes (the /pb_data volume is added automatically).

Group 12 — Database Backend​

VariableDefaultDescription
database_typeNONEFixed — PocketBase uses an embedded SQLite database; no Cloud SQL is created.

Group 14 — Observability & Health​

VariableDefaultDescription
startup_probeHTTP /api/health, 15s delayStartup probe; fast because there is no external DB to wait on.
liveness_probeHTTP /api/health, 30s delayLiveness probe against the public health endpoint.
uptime_check_configdisabled, path /api/healthCloud Monitoring uptime check.

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.
pocketbase_urlService URL for the PocketBase HTTP API + admin UI (port 8090).
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).
storage_bucketsCreated Cloud Storage buckets (includes the /pb_data bucket).
network_name / network_exists / regionsVPC network, presence, available 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 any custom setup jobs (none by default).
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 — an invalid container_port, a gen1 runtime with GCS FUSE mounts, IAP with no authorized identities, out-of-range probe or retention values. 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
max_instance_count1 (never raise)CriticalSQLite + GCS FUSE are single-writer; more than one instance corrupts the database.
The /pb_data data bucketNever delete; back upCriticalThe bucket is the database and file store — deleting or wiping it destroys all data.
database_typeNONE (fixed)CriticalPocketBase has no external DB; selecting an engine provisions unused Cloud SQL and does not change where data lives.
Admin account at /_/Create immediately after deployCriticalUntil the superuser exists, anyone reaching /_/ can claim it and own the instance.
application_version bumpBack up /pb_data firstHighPocketBase auto-migrates the schema on start; an interrupted upgrade can leave the SQLite DB mid-migration.
execution_environmentgen2Highgen1 cannot mount the GCS FUSE /pb_data volume; the service starts with no persistent data.
ingress_settingsallHighinternal blocks the public app UI and REST API from the internet.
enable_iapOnly for private deploymentsHighIAP blocks all unauthenticated requests, including public API clients and the admin UI.
min_instance_count1MediumScale-to-zero (0) adds cold-start latency and briefly drops the single SQLite writer between requests.
memory_limit1Gi (512Mi min)LowPocketBase is lightweight; over-provisioning only adds cost.

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

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