Skip to content

A free and open source instant messaging and VoIP chat app built for friends, groups, and communities.

TypeScript fluxerfluxerapp

fix(self-host): persist valkey and stop evicting durable state (#2240)

Hampusbb81a2f165c1
diff --git a/deploy/self-hosting/.env.example b/deploy/self-hosting/.env.example
index 26f6945e1..a947a4577 100644
--- a/deploy/self-hosting/.env.example
+++ b/deploy/self-hosting/.env.example
@@ -97,3 +97,12 @@ FLUXER_DISCOVERY_ENABLED=true
#FLUXER_POSTGRES_SHARED_BUFFERS=512MB
#FLUXER_POSTGRES_EFFECTIVE_CACHE_SIZE=2GB
#FLUXER_POSTGRES_WORK_MEM=8MB
+
+# The bundled Valkey holds durable state as well as cache: the bulk message
+# deletion queue, the account deletion queue and every distributed lock, none of
+# which carry an expiry. It therefore runs with an append-only file on a named
+# volume and with noeviction, so an over-limit write fails loudly instead of
+# silently deleting queued work. Only change the policy if you have moved that
+# durable state elsewhere.
+#FLUXER_VALKEY_MAXMEMORY=192mb
+#FLUXER_VALKEY_MAXMEMORY_POLICY=noeviction
diff --git a/deploy/self-hosting/docker-compose.yml b/deploy/self-hosting/docker-compose.yml
index eeb56df2b..6facc4069 100644
--- a/deploy/self-hosting/docker-compose.yml
+++ b/deploy/self-hosting/docker-compose.yml
@@ -180,7 +180,11 @@ services:
memory: ${FLUXER_VALKEY_MEMORY_LIMIT:-256mb}
restart: unless-stopped
networks: [fluxer]
- command: ["valkey-server", "--save", "", "--appendonly", "no", "--maxmemory", "192mb", "--maxmemory-policy", "allkeys-lru"]
+ command: ["valkey-server", "--appendonly", "yes", "--appendfsync", "everysec", "--dir", "/data",
+ "--maxmemory", "${FLUXER_VALKEY_MAXMEMORY:-192mb}",
+ "--maxmemory-policy", "${FLUXER_VALKEY_MAXMEMORY_POLICY:-noeviction}"]
+ volumes:
+ - valkey-data:/data
healthcheck:
test: ["CMD", "valkey-cli", "ping"]
interval: 10s
@@ -607,6 +611,7 @@ volumes:
caddy-data:
caddy-config:
postgres-data:
+ valkey-data:
nats-data:
meilisearch-data:
seaweedfs-data: