Skip to main content

LubeLogger on Google Cloud Run

LubeLogger on Google Cloud Run

LubeLogger is a free, open-source vehicle maintenance and fuel-mileage tracker built on ASP.NET Core (.NET), shipped as a single container image with an embedded LiteDB database. This module deploys LubeLogger 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 LubeLogger 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

LubeLogger runs as an ASP.NET Core container on Cloud Run v2. The deployment wires together a minimal set of Google Cloud services — there is no managed database in the default configuration:

CapabilityGoogle Cloud serviceNotes
ComputeCloud Run v2ASP.NET Core service, 1 vCPU / 1 GiB by default, serverless autoscaling; fixed at a single instance
DatabaseNone (default)LubeLogger's default mode uses an internal embedded LiteDB database file — no Cloud SQL instance is created
Object storageCloud StorageTwo buckets: storage (LiteDB database file + uploaded photos/receipts/documents) and dpkeys (ASP.NET Core Data Protection keys)
Cache & queueNoneLubeLogger has no Redis usage and no background worker/queue
SecretsNoneNo secrets are generated — the first account is created via self-service registration
IngressCloud Run URL / Cloud Load BalancingDefault run.app URL (ingress_settings = "all"); optional external HTTPS load balancer + custom domain

Sensible defaults worth knowing up front:

  • No external database by default. database_type = "NONE" — LubeLogger's own embedded LiteDB database file is the source of truth, persisted via a GCS FUSE volume. LubeLogger also supports an optional external Postgres backend via a single POSTGRES_CONNECTION DSN environment variable, but this module does not wire Cloud SQL for it.
  • Single instance only. min_instance_count = 1 and max_instance_count = 1 — LubeLogger's default mode serves one shared database file from one volume; running multiple instances against the same file corrupts it.
  • Secure by default. EnableAuth = "true" overrides LubeLogger's own appsettings.json default of fully open access. There is no seeded admin account — the first person to complete the Register form on /Login gains access.
  • Persistent Data Protection keys. A dedicated small dpkeys bucket is always mounted at /root/.aspnet/DataProtection-Keys so login sessions survive container restarts; this is separate from the main storage bucket.
  • Prebuilt image, no build step. The module deploys the official ghcr.io/hargata/lubelogger image directly (mirrored into Artifact Registry by default) — there is no Dockerfile or Cloud Build involved.
  • Health probes use /Login, not / — the app root is [Authorize]-gated and would fail an unauthenticated platform probe even on a healthy container.

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

LubeLogger runs as a single Cloud Run v2 service (fixed at one instance). 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 Storage

Two dedicated Cloud Storage buckets are provisioned automatically:

  • storage — mounted at /App/data via GCS FUSE; holds the embedded LiteDB database file and uploaded photos/receipts/documents.
  • dpkeys — mounted at /root/.aspnet/DataProtection-Keys; holds ASP.NET Core's cookie/session signing keys.
gcloud storage buckets list --project "$PROJECT" --filter="name~lubelogger"
gcloud storage ls gs://<storage-bucket>/ # bucket names are in the Outputs

See App_CloudRun for GCS Fuse and CMEK options.

C. Networking & ingress

The service is reachable at its run.app URL by default (ingress_settings = "all"). 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.

D. 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. LubeLogger Application Behaviour

  • No first-deploy database setup. There is no db-init job — LubeLogger initialises its own LiteDB database file and directory structure (config/, documents/, images/, temp/, themes/, translations/ under /App/data) on first boot.
  • No fixed admin credential. Open the service, go to /Login, and submit the Register form — that becomes the usable account. Complete this immediately after first deploy: EnableAuth = "true" restricts the rest of the app, but registration itself is open to anyone who can reach the URL until a first account exists.
  • Health path. Startup and liveness probes target /Login — LubeLogger's public, unauthenticated page. The app root / is [Authorize]-gated and would 401/redirect an unauthenticated probe even on a healthy container.
  • Optional external Postgres. LubeLogger supports a single POSTGRES_CONNECTION DSN environment variable (Host=<host>;Port=5432;Username=<user>;Password=<pass>;Database=<db>;) to use an external Postgres database instead of the embedded LiteDB file. This module does not provision Cloud SQL for this path — an operator supplying their own Postgres instance can set the variable via secret_environment_variables.
  • Single instance, always. max_instance_count is fixed at 1 — LubeLogger's default mode has no distributed-locking or multi-writer support for its embedded database.
  • Inspect the running revision:
    gcloud run services describe <service-name> \
    --region "$REGION" --project "$PROJECT" \
    --format='value(status.url)'

4. Configuration Variables

Variables are grouped exactly as they appear on the deployment platform. Only settings specific to or notable for LubeLogger 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_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_namelubeloggerBase name for resources. Do not change after first deploy.
application_display_nameLubeLoggerHuman-readable name shown in the Console.
description(set)Service description.
application_versionlatestImage tag on ghcr.io/hargata/lubelogger. Since the image is prebuilt (not custom-built), this directly selects the released version.

Group 4 — Runtime & Scaling

VariableDefaultDescription
deploy_applicationtrueSet false to provision infrastructure only.
cpu_limit1000mCPU per instance.
memory_limit1GiMemory per instance.
min_instance_count1Kept at 1 to avoid cold starts.
max_instance_count1Must stay at 1 — LubeLogger's default mode serves one shared database file.
container_port8080LubeLogger listens on port 8080.
execution_environmentgen2Gen2 required for GCS Fuse mounts.
timeout_seconds300Maximum request duration (0–3600 seconds).
enable_cloudsql_volumefalseLubeLogger's default mode has no Cloud SQL.
enable_image_mirroringtrueMirror the LubeLogger image into Artifact Registry.
traffic_split[]Split traffic across revisions for staged rollouts.
max_revisions_to_retain7Declared for convention parity; not referenced by this module's deployment.

Group 5 — Access & Ingress Control

VariableDefaultDescription
ingress_settingsallPublic access — LubeLogger is a user-facing web app.
vpc_egress_settingPRIVATE_RANGES_ONLYRoute only RFC 1918 traffic via VPC.
enable_iapfalseRequire Google sign-in.
iap_authorized_users / iap_authorized_groups[]Who may access through IAP.

Group 6 — Environment Variables & Secrets

VariableDefaultDescription
environment_variables{}Extra non-secret settings, merged with the module's default EnableAuth = "true".
secret_environment_variables{}Map of env var → Secret Manager secret name. Use this for POSTGRES_CONNECTION if wiring the optional external Postgres backend.
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_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 10 — Storage & Filesystem

VariableDefaultDescription
create_cloud_storagetrueCreate GCS buckets defined in storage_buckets.
storage_buckets[]Additional GCS buckets beyond the auto-provisioned storage/dpkeys buckets.
enable_nfsfalseNot used by LubeLogger by default.
gcs_volumes[]Additional GCS Fuse volume mounts (requires gen2).
manage_storage_kms_iam / enable_artifact_registry_cmekfalseCMEK options.

Group 12 — Database Backend

VariableDefaultDescription
database_typeNONEFixed — LubeLogger's default mode has no Cloud SQL database.
database_password_length32Not referenced in the default configuration.

Group 13 — Jobs & Scheduled Tasks

VariableDefaultDescription
initialization_jobs[]LubeLogger's default mode needs no init job.
cron_jobs[]No platform-scheduled recurring tasks by default.

Group 14 — Observability & Health

VariableDefaultDescription
startup_probeHTTP /Login 15s delayStartup probe.
liveness_probeHTTP /Login 30s delayLiveness probe.
startup_probe_configHTTP /LoginAlternative structured probe.
health_check_configHTTP /LoginAlternative structured liveness probe.
uptime_check_config{ enabled=false, path="/Login" }Cloud Monitoring uptime check; disabled by default.
alert_policies[]Metric alert policies.

Group 23 — 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.
lubelogger_urlInternal VPC URL for the LubeLogger web UI.
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).
storage_bucketsCreated Cloud Storage buckets (storage, dpkeys).
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.
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. 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_count1CriticalLubeLogger's default mode serves one shared embedded database file from one volume; more than one instance risks database corruption from concurrent writers.
storage/dpkeys bucketsNever deleteCriticalLosing storage loses every vehicle record; losing dpkeys invalidates all existing login sessions (recoverable — forces re-login only).
EnableAuthtrue (default)CriticalSetting it to false reverts to LubeLogger's fully open-access mode — anyone with the URL can view/edit all data with no login at all.
First-run registrationComplete immediately after deployHighUntil a first account is registered, the Register form is reachable by anyone who can reach the URL.
startup_probe/liveness_probe path/LoginCriticalPointing probes at / (or any [Authorize]-gated path) fails the probe on an otherwise-healthy container — the revision never becomes Ready.
database_typeNONE (default)HighLubeLogger's default mode ignores this setting entirely; changing it does not connect LubeLogger to a Cloud SQL instance — use POSTGRES_CONNECTION instead for the optional external Postgres path.
min_instance_count1MediumSetting to 0 allows cold starts; since max_instance_count is fixed at 1 there is no traffic-splitting risk, only added latency on the first request after idle.
backup_retention_days7 (raise for prod)MediumToo short for compliance retention.
enable_cloud_armorenable for productionMediumThe public web UI and REST API are reachable without WAF protection otherwise.

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