[feature]: Add KEY_PREFIX to Redis cache and make clear_cache optional on startup
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:
- Make
clear_cacheskippable: Add an environment variable (e.g.PLANE_SKIP_CACHE_CLEAR=true) so operators can disable the startup cache flush when sharing a Redis instance. - Add
KEY_PREFIXto Redis cache config: Configure a prefix likeplane:in Django'sCACHESsetting, so even ifclear_cacheruns, it only affects Plane's own keys. This requires changing theclear_cachemanagement command to usecache.delete_pattern("plane:*")instead ofcache.clear(), since django-redis'sclear()always callsFLUSHDBregardless ofKEY_PREFIX(upstream issue). - Document the risk: Note in the self-hosting docs that
REDIS_URLshould 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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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