The Simplest Way to Make Cloud Run and Metabase Work Like They Should
Running cloud run and metabase together lets teams host a scalable business analytics app on serverless containers. This setup helps data teams share charts and run SQL queries without managing virtual machines. Teams choose this pair to cut hosting costs and avoid server upkeep. The container platform runs the open-source analytics app and scales instances based on user traffic. Still, stateless containers need an external database to store saved questions, users, and app settings. Getting the
Your coding agents run with your access.
Claude Code reaches prod with a developer's credentials, and approval prompts get clicked through. hoop.dev checks every query, masks sensitive data, and holds risky changes for a human.
Running cloud run and metabase together lets teams host a scalable business analytics app on serverless containers. This setup helps data teams share charts and run SQL queries without managing virtual machines.
Teams choose this pair to cut hosting costs and avoid server upkeep. The container platform runs the open-source analytics app and scales instances based on user traffic. Still, stateless containers need an external database to store saved questions, users, and app settings. Getting the network paths, login keys, and database roles right keeps company data safe.
How cloud run and metabase handle logins and data flow
A working deployment needs three clear data paths to run well. First, users log in to the web app through an identity provider. Second, the container connects to an internal database to save dashboards, user groups, and app state. Third, the analytics app sends read queries to your production data sources and warehouses.
The container platform assigns a dedicated service identity to the running analytics container. That identity holds the permissions needed to reach a managed SQL instance for app state. You should store database passwords in a managed secret store rather than plain text variables. The platform mounts those secrets into the container at startup time.
When an analyst opens a dashboard, the container wakes up and checks the user session. It reads the saved SQL query from its state database and runs it against the target warehouse. Results return to the container, which renders the chart for the user in their browser.
Common failure modes and how to scope roles and networks
Several failure modes appear when teams rush this container setup into production. The first mistake is using the default embedded file database inside a stateless container. When the container scales down or restarts, the local file wipes out all saved dashboards. Always point the app to an external relational database for its state store.
Cold starts and idle CPU limits also break background sync jobs. The analytics app runs scheduled tasks to scan schemas and send email reports. If the platform takes away CPU between web requests, those background tasks stall and fail. Teams must set minimum instance counts or keep CPU allocated during background sync windows.
End-to-End Encryption: architecture patterns and best practices
Continue reading? Get the full guide.
Free. No spam. Unsubscribe anytime.
Security gaps happen when teams use one shared database user with broad write rights. If every chart uses the same admin role, someone could alter or drop production tables. Also, database logs will only show the shared app account instead of the real person. You lose the ability to trace which analyst ran a heavy or sensitive query.
To fix this, create read-only database roles scoped only to the tables analysts need. Place the container on a private virtual network bridge so traffic never crosses the public internet. Map user groups to restricted database schemas and mask sensitive fields like emails or phone numbers.
Keeping query performance and costs steady
Container memory limits need close attention when analysts run large data exports. Exporting thousands of rows into a spreadsheet file can spike memory usage and crash the container. Set enough memory per instance and cap the row limits inside the analytics app settings. Pair these limits with query timeouts on the database side to stop runaway joins.
Database connection pools also need careful sizing when containers scale out. Each new container starts its own pool of open database sessions. If ten containers spin up during a morning traffic spike, they can exhaust database connection limits. Keep the per-container pool size small or use a managed connection pooler in front of the database.
Check database and API queries on the wire
Identity tools, roles, and network rules decide who opens a session. Setup alone cannot check what each query does or mask sensitive values in a response once a session starts. When workflows touch Postgres, MySQL, SQL Server, MongoDB, ClickHouse, Kubernetes APIs, SSH, or internal HTTP APIs, hoop.dev runs beside those services as an open-source proxy, a sidecar for your Postgres or API. It inspects requests coming in and results going back on the wire.
Your login details and client tools stay as they are while hoop.dev guardrails refuse bad deletes or drops before they run. On responses, hoop.dev data masking rewrites matched sensitive values in memory. Furthermore, hoop.dev holds SOC 2 Type II, is MIT licensed, and writes every query and decision to an audit trail that generates evidence for HIPAA, GDPR, and PCI DSS. See the source on GitHub.
Frequently asked questions
Why do my dashboards disappear when the container restarts?
The app defaults to a local file database if you do not set up an external one. Stateless containers wipe local files on restart, so you must use an external SQL database for app state.
How do I stop cold starts from slowing down dashboard loads?
Set the container service to keep at least one warm instance running at all times. This stops the app from booting up from zero when the first analyst logs in each morning.
How should the analytics app connect to private databases?
Use a private network connector so the container sends traffic over your internal cloud network. Combine this with read-only database roles and secret management for all connection keys.
Related guides
In this post