overleaf / toolkit

GNU Affero General Public License v3.0
576 stars 138 forks source link

Added '--appendonly yes' configuration to redis #263

Closed mserranom closed 2 months ago

mserranom commented 3 months ago

Description

Turns on redis appendonly on config-seed for new installs, and introduces an REDIS_AOF_PERSISTENCE variable to enable it on existing installs, printing a warning when it's not defined.

https://redis.io/docs/latest/operate/oss_and_stack/management/persistence

AOF Persistence writes all redis updates to a journal, allowing better recovery and mitigating potential data loss after shutdown

--appendonly yes is set via docker-compose command option since overriding CMD is the recommendation of the official docker image https://hub.docker.com/_/redis.

Manual test

Tested login, load and compiled projects.

When REDIS_AOF_PERSISTENCE is not defined:

$ bin/up -d redis
Initiating Mongo replica set...
WARNING: the value of REDIS_AOF_PERSISTENCE is not set in config/overleaf.rc
See https://github.com/overleaf/overleaf/wiki/Release-Notes-5.x.x#server-pro-510
[+] Running 1/2
...

$docker inspect redis | jq '.[0].Args'
[
  "redis-server"
]

When REDIS_AOF_PERSISTENCE=true:

$ bin/up -d redis
Initiating Mongo replica set...
[+] Running 1/2
...

$docker inspect redis | jq '.[0].Args'
[
  "redis-server",
  "--appendonly",
  "yes"
]

When REDIS_AOF_PERSISTENCE=false:

$ bin/up -d redis
Initiating Mongo replica set...
[+] Running 1/2
...

$docker inspect redis | jq '.[0].Args'
[
  "redis-server"
]

Contributor Agreement

mserranom commented 3 months ago

I made the option the default for new installs, printing a warning with a link for existing installs.

mserranom commented 3 months ago

WDYT about moving the docs into the wiki?

Yeah, the documentation needs to be upgraded.

mserranom commented 2 months ago

WDYT about moving the docs into the wiki? e.g. here: https://github.com/overleaf/overleaf/wiki/Data-and-Backups#redis

Done in https://github.com/overleaf/overleaf/wiki/Data-and-Backups/_compare/20eff2d3341d49ffb5ae9daaf5a9d15bb8914706...309a3c10fa16de3c7ad7d000720916f6076fa4b4