The Simplest Way to Make Cloud Run and Superset Work Like They Should

Published
Length
3 min read

Luis Felipe Dias

All posts

Running Cloud Run and Superset together gives your team a fast analytics app. Cloud Run hosts the web containers while Superset reads and charts your data. You do not need to manage dedicated servers to keep dashboards online. Instead, the container scales up when analysts log in and view charts. It then scales down when your team finishes work for the day. How data and roles flow in Cloud Run and Superset To make Cloud Run and Superset work well, separate state from compute. Cloud Run runs s

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 Superset together gives your team a fast analytics app. Cloud Run hosts the web containers while Superset reads and charts your data. You do not need to manage dedicated servers to keep dashboards online. Instead, the container scales up when analysts log in and view charts. It then scales down when your team finishes work for the day.

How data and roles flow in Cloud Run and Superset

To make Cloud Run and Superset work well, separate state from compute. Cloud Run runs stateless containers that start and stop at any time. Because of this, Superset needs an external database to store dashboard state. A managed Postgres or MySQL instance holds chart metadata, users, and permissions. When a container starts, it reads this store to load the app.

User login should pass through your company identity provider using OAuth or OIDC. When an analyst opens the app, the identity provider checks their account. Then Superset maps their group membership to an internal dashboard role. This role controls which datasets and charts the user can read.

From there, Superset sends SQL queries to your main data warehouse. The Cloud Run service account provides the base identity for the container. This account needs permission to reach the metadata store and secret manager. You should store database keys and app secrets in a secret manager. The container reads those keys at startup without saving them to disk.

Common failure modes and how to scope access

Many teams use one shared admin account for all Superset data sources. This setup creates big security gaps when many analysts run custom queries. Every query hits the database under the exact same service account name. When a bad query slows down the database, you cannot see who wrote it. Audit logs only show the shared app account instead of the real user.

Broad database tokens also create high risk for sensitive customer data. If the Superset role can read all tables, any SQL user can too. Analysts might query tables with raw emails, phone numbers, or card numbers. You should split data sources by team and assign strict read-only roles. Give each data source connection only the tables that specific group needs.

End-to-End Encryption: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

Network paths between the container and your databases also need tight rules. Do not expose your metadata database or data warehouse to public networks. Route all traffic from the container through a private virtual network connector. Set firewall rules so only the container subnet can reach database ports.

Keeping background tasks and queries stable

Long queries and scheduled reports often fail in basic serverless container setups. Cloud Run stops CPU work as soon as an HTTP request finishes. If an analyst runs a slow query, the request might time out early. You need to align container timeout settings with your database query limits.

Scheduled alerts and async queries also need background workers and a queue. You can run worker containers alongside the main web app container. Both services read from a shared queue to process heavy chart loads. Keep CPU allocated during background work so jobs do not freeze mid-run. Finally, mask sensitive fields like national IDs by rewriting matched fields in results.

Add runtime guardrails and masking beside your databases and APIs

Login rules, role grants, and CI checks govern who connects to your stack. Yet any allowed script, engineer, or AI agent still runs commands with the full scope of its role. For workloads on Postgres, MySQL, SQL Server, MongoDB, ClickHouse, Kubernetes, SSH, or internal HTTP services, hoop.dev sits beside the service as an open-source proxy, a sidecar for your database or API.

Before a query runs, hoop.dev guardrails check the statement against your rules. An AI Analyzer you configure can score intent or hold risky calls for human review. Next, hoop.dev data masking rewrites sensitive fields in responses, and each verdict is logged per listener. Explore the MIT-licensed project on GitHub.

Frequently asked questions

Why does my Superset app lose sessions on Cloud Run?

Stateless containers do not share local memory across different running instances. You must store user sessions and metadata in an external database instead. Also set a static secret key from your secret manager across all instances.

How do we stop analysts from querying raw sensitive data in Superset?

Do not connect Superset to your database with a single admin account. Create narrow read-only database roles for each team and data source. You can also use data masking that rewrites emails and card numbers in results.

Can Cloud Run scale to zero when running Superset?

Yes, the web app container can scale to zero when no one logs in. Still, cold starts take time because the app loads many Python files. Keep one minimum instance warm during work hours so dashboards load fast.

The query runs. The emails stay hidden.