Skip to content

[feature]: Add KEY_PREFIX to Redis cache and make clear_cache optional on startup #9759

Description

@cxhello

Summary

Plane's Docker entrypoint (docker-entrypoint-api.sh) unconditionally runs python manage.py clear_cache on every container startup. This command calls Django's cache.clear(), which in django-redis translates to a Redis FLUSHDB — wiping all keys in the entire Redis database, not just Plane's own cache entries.

When REDIS_URL points to a shared Redis instance (common in organizations that deploy Plane into existing infrastructure), this silently destroys data belonging to other services on the same database.

Why should this be worked on?

In a real production incident, Plane was deployed into a Kubernetes cluster where REDIS_URL was misconfigured to point at a shared Redis db0 used by other services. Every container restart (6 rounds of iterative deployment) triggered FLUSHDB, wiping all keys — including task queues, result caches, and runtime state of other applications — causing cascading failures across all dependent services.

Proposed improvements:

  1. Make clear_cache skippable: Add an environment variable (e.g. PLANE_SKIP_CACHE_CLEAR=true) so operators can disable the startup cache flush when sharing a Redis instance.
  2. Add KEY_PREFIX to Redis cache config: Configure a prefix like plane: in Django's CACHES setting, so even if clear_cache runs, it only affects Plane's own keys. This requires changing the clear_cache management command to use cache.delete_pattern("plane:*") instead of cache.clear(), since django-redis's clear() always calls FLUSHDB regardless of KEY_PREFIX (upstream issue).
  3. Document the risk: Note in the self-hosting docs that REDIS_URL should point to a dedicated Redis database, and that startup will flush it.

Reference: django-redis clear() implementation calls client.flushdb() unconditionally. Django core has the same open issue: #35039.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions