From ab5fd20a7645e6cc4b3b6059ad91ae3dc30c35c3 Mon Sep 17 00:00:00 2001 From: Sumesh Pradhan Date: Mon, 23 Jan 2023 17:50:37 +0530 Subject: [PATCH] fix: Redis rdb persistance | User session persistance (#19981) ## Description - Updated redis.conf to set the Redis rdb directory to `/appsmith-stacks/data/redis` bind-mount directory, so that the data is persisted after the container restarts/updates. ( This was causing user sessions on Appsmith installations using the embedded Redis to reset after every container restart, since the redis data was not being persisted) - Updated redis.conf for the embedded Redis to increase the snapshot frequency to dump after every 15 sec if at least 1 key changed Fixes #19768 ## Type of change - Bug fix (non-breaking change which fixes an issue) ## How Has This Been Tested? - Manual --- deploy/docker/entrypoint.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/deploy/docker/entrypoint.sh b/deploy/docker/entrypoint.sh index 6ba07cf368..6404ac8f2c 100755 --- a/deploy/docker/entrypoint.sh +++ b/deploy/docker/entrypoint.sh @@ -248,8 +248,14 @@ configure_supervisord() { fi if [[ $APPSMITH_REDIS_URL == *"localhost"* || $APPSMITH_REDIS_URL == *"127.0.0.1"* ]]; then cp "$SUPERVISORD_CONF_PATH/redis.conf" /etc/supervisor/conf.d/ + # Initialize Redis rdb directory + local redis_db_path="$stacks_path/data/redis" + mkdir -p "$redis_db_path" # Enable saving Redis session data to disk more often, so recent sessions aren't cleared on restart. - sed -i 's/^# save 60 10000$/save 60 1/g' /etc/redis/redis.conf + sed -i \ + -e 's/^save 60 10000$/save 15 1/g' \ + -e "s|^dir /var/lib/redis$|dir ${redis_db_path}|g" \ + /etc/redis/redis.conf fi if ! [[ -e "/appsmith-stacks/ssl/fullchain.pem" ]] || ! [[ -e "/appsmith-stacks/ssl/privkey.pem" ]]; then cp "$SUPERVISORD_CONF_PATH/cron.conf" /etc/supervisor/conf.d/