makeplane / makeplane/plane

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

Open
#9,759 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
59.6k
Forks
5.8k
Avg merge
1d 22h
Merged PRs (30d)
49

Description

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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with docker-entrypoint-api.sh and the manage.py clear_cache command, then inspect the Django CACHES configuration and self-hosting documentation. Trace how cache.clear() reaches Redis and identify the startup, prefix, command, and documentation changes needed. Done means startup flushing is optional, Plane keys are isolated, and the shared-Redis risk is documented.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, python, redis, shell
Domain
backend, databases, devops, documentation
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.