migrate redis to multiple dragonflydb instances

This commit is contained in:
Ruben 2025-08-14 21:30:01 -05:00
commit 5daafdf806
Signed by: sneexy
GPG key ID: 8ECFA045E63BC583
2 changed files with 64 additions and 28 deletions

View file

@ -14,9 +14,6 @@ services:
api:
image: registry.activitypub.software/transfem-org/sharkey:latest
restart: always
depends_on:
redis:
condition: service_healthy
ports:
- "127.0.0.1:60628:3001"
networks:
@ -39,9 +36,6 @@ services:
worker:
image: registry.activitypub.software/transfem-org/sharkey:latest
restart: always
depends_on:
redis:
condition: service_healthy
networks:
- db
- sharkey
@ -60,9 +54,6 @@ services:
activity:
image: registry.activitypub.software/transfem-org/sharkey:latest
restart: always
depends_on:
redis:
condition: service_healthy
ports:
- "127.0.0.1:47815:3002"
networks:
@ -86,9 +77,6 @@ services:
media:
image: registry.activitypub.software/transfem-org/sharkey:latest
restart: always
depends_on:
redis:
condition: service_healthy
ports:
- "127.0.0.1:57378:3003"
networks:
@ -108,18 +96,66 @@ services:
- ./media:/sharkey/.config
- ./default.yml:/sharkey/.config/default.yml:ro
# redis is used for caching
redis:
# "redis is for caching" WRONG!!! it is long term persistent storage in misskey. for some reason. "caching".
# do NOT wipe redis or you lose a bunch of actual data like timelines and notifications.
# also, we use dragonflydb over redis. personal preference, better performance and stability.
# general dfdb
dragonfly:
image: docker.dragonflydb.io/dragonflydb/dragonfly
restart: always
image: redis:alpine
volumes:
- ./redis:/data
ulimits:
memlock: -1
networks:
- sharkey
healthcheck:
test: "redis-cli ping"
interval: 5s
retries: 20
environment:
# these envvars are important in order for dragonflydb/misskey to interact with each other properly, and to load and save all data properly
DFLY_snapshot_cron: '* * * * *'
DFLY_version_check: false
DFLY_default_lua_flags: allow-undeclared-keys # without this, dfdb would immediately complain loading data
DFLY_dbfilename: 'dump.rdb' # misskey expects this
DFLY_df_snapshot_format: false # misskey doesn't know how to handle dfdb's format
DFLY_dir: '/data' # directory with the snapshot/data
volumes:
- ./dragonfly/general:/data
# job queue dfdb
dragonfly-queue:
image: docker.dragonflydb.io/dragonflydb/dragonfly
restart: always
ulimits:
memlock: -1
networks:
- sharkey
environment:
DFLY_port: 6380
DFLY_snapshot_cron: '* * * * *'
DFLY_version_check: false
DFLY_default_lua_flags: allow-undeclared-keys
DFLY_dbfilename: 'dump.rdb'
DFLY_df_snapshot_format: false
DFLY_dir: '/data'
volumes:
- ./dragonfly/queue:/data
# timelines dfdb
dragonfly-tl:
image: docker.dragonflydb.io/dragonflydb/dragonfly
restart: always
ulimits:
memlock: -1
networks:
- sharkey
environment:
DFLY_port: 6381
DFLY_snapshot_cron: '* * * * *'
DFLY_version_check: false
DFLY_default_lua_flags: allow-undeclared-keys
DFLY_dbfilename: 'dump.rdb'
DFLY_df_snapshot_format: false
DFLY_dir: '/data'
volumes:
- ./dragonfly/timelines:/data
networks:
db:

View file

@ -141,7 +141,7 @@ dbReplications: false
#───┘ Redis configuration └─────────────────────────────────────
redis:
host: redis
host: dragonfly
port: 6379
#family: 0 # 0=Both, 4=IPv4, 6=IPv6
#pass: example-pass
@ -160,9 +160,9 @@ redis:
# # You can specify more ioredis options...
# #username: example-username
#redisForJobQueue:
# host: redis
# port: 6379
redisForJobQueue:
host: dragonfly-queue
port: 6380
# #family: 0 # 0=Both, 4=IPv4, 6=IPv6
# #pass: example-pass
# #prefix: example-prefix
@ -170,9 +170,9 @@ redis:
# # You can specify more ioredis options...
# #username: example-username
#redisForTimelines:
# host: redis
# port: 6379
redisForTimelines:
host: dragonfly-tl
port: 6381
# #family: 0 # 0=Both, 4=IPv4, 6=IPv6
# #pass: example-pass
# #prefix: example-prefix