Skip to content

Redis Architecture

Redis is a core runtime dependency of FynnCloud Server (REDIS_URL, default redis://127.0.0.1:6379). It coordinates shared state across single-node and multi-replica deployments.

Redis persists to its own /data volume (completely separate from PostgreSQL). Persistence settings vary slightly across the default deployment templates:

Deployment Method Persistence Mode Configuration
FynnCloud AIO RDB snapshots (dump.rdb) save 60 1 in /etc/redis/redis.conf (persisted on redis_data volume; final snapshot on graceful shutdown)
Docker Compose (docker-compose.yml) AOF (Append-Only File) redis-server --appendonly yes --requirepass $REDIS_PASSWORD
Kubernetes (Helm v0.5.1) AOF (Append-Only File) --appendonly yes backed by a 5Gi ReadWriteOnce PVC (redis.persistence)

Key Pattern Type / TTL Purpose
session_activity Hash (cleaned on grant revoke/delete) Buffers live session { grantID, timestamp, ipAddress } per OAuthGrant UUID (HSET on every authenticated request; HMGET powers live Active Sessions view; SessionLastAccessFlushJob flushes to PostgreSQL every 1 minute)
grant:valid:{grantID} / grant:revoked:{grantID} String (60s tombstone) Fast OAuth grant validity cache and immediate revocation tombstone so revoked sessions/tokens stop working before JWT expiry
quota:pending:{userID} String (hold lifetime) Atomic pending-upload byte reservation preventing concurrent uploads from exceeding storage quota
upload:active_sessions Set / tracking Index of active in-flight multipart upload sessions
upload:parts:{sessionID} Hash (24h) Lua-guarded cumulative uploaded byte tracker for in-flight multipart uploads (enforces 5% / 1 MiB slack ceiling across parallel chunk uploads)
ratelimit:{category}:{clientIdentifier}:{window} String (60s) Fixed-window counters for .auth, .share, .api, and .ai rate-limit tiers
oauth:code:{code} String (short-lived) Single-use OAuth 2.0 PKCE authorization code payload
oidc:flow:{state} String (short-lived) Ephemeral OIDC login state, nonce, and PKCE verifier
oidc:discovery:{providerID}:{hash} String (cached) Cached OIDC .well-known/openid-configuration document keyed by provider + issuer hash
oidc:jwks:{providerID}:{hash} String (cached) Cached OIDC JWKS public keys keyed by provider + JWKS URI hash
auth:totp:setup:{userID} String (15m) Ephemeral pending TOTP enrollment secret prior to verification
auth:totp:used:{userID}:{step} String (120s) Single-use TOTP step replay guard (prevents reusing a 6-digit code within the window)
auth:passkey:reg:{userID} / auth:passkey:auth:{challenge} String (short-lived) Ephemeral WebAuthn registration and login challenges
auth:passkey:stepup:{userID}:{challenge} String (180s) Short-lived WebAuthn challenge bound to a specific admin AIO step-up action
presence:online ZSET (60s activity window) Tracks live online users across all replicas and tabs (score refreshed on /api/events connect & 25s keepalive)
presence:activity:{userID_lower} / presence:activity:index String (360s cap) / Set Elevated app activity headlines (in_call, presenting, in_meeting, focus) and active-user index
app:badges:{userID_lower} Hash Cached per-app unread badges replayed on /api/events connect
wopi:discovery:{base} / wopi:lock:{fileID} String (cached / lock TTL) Cached WOPI /hosting/discovery XML and active document edit locks
scheduled_job:{jobID}:last_run String (persistent) ISO-8601 timestamp markers powering the Admin Scheduled Jobs dashboard
vapor_queues:* Lists (queue lifecycle) Vapor Queues job storage (ProcessFileEmbeddingJob, GenerateThumbnailJob, SendEmailJob)

Pub/Sub Channels (Multi-Replica Coordination)

Section titled “Pub/Sub Channels (Multi-Replica Coordination)”

FynnCloud maintains a dedicated .pubsub Redis connection (PubSubLifecycleHandler) subscribed to three channels across every replica:

Channel Published When Subscriber Effect on All Replicas
settings:invalidate An admin edits any dynamic AppSettings key Clears in-memory SettingsService cache and hot-reloads the SSOProviderRegistry (OIDC/LDAP/Trusted Header configs) on every replica. (Does not trigger WOPI discovery reload—WOPI caches invalidate independently.)
subscription:invalidate An admin installs, refreshes, or removes a subscription key Clears SubscriptionService’s in-memory cache across replicas.
user-events File sync mutation (sync.changed, 0.3s debounce), app notification, badge change, presence update, or POST /api/apps/realtime/publish Fans out batched envelopes (up to 500 recipients per publish) to local /api/events and /api/sync/events SSE streams (capped at 10 concurrent streams per user per replica).

  • Memory policy: Set maxmemory-policy noeviction (default) so Redis never silently drops Vapor Queue jobs, session_activity, or active quota:pending:* keys under memory pressure. Allocate at least 256 MB for small deployments and 512 MB – 1 GB for busy multi-user instances.
  • Authentication & Network Isolation: Always require a password (--requirepass) and keep Redis on an internal: true network (automatic in AIO and Docker Compose) or restricted by Kubernetes NetworkPolicy. Never expose port 6379 to the public internet.
  • Managed Redis (TLS): When connecting to managed Redis (AWS ElastiCache, Upstash, Redis Cloud), pass rediss://:password@host:6380 in REDIS_URL.