accidently used debian entrypoint script for redis

This commit is contained in:
brooke 2025-02-12 19:47:08 -05:00
parent cd3800d74b
commit 7d557a7eca

View File

@ -7,39 +7,59 @@ else
fi
### docker entrypoint script, for starting redis stack
BASEDIR=/opt/redis-stack
cd ${BASEDIR}
CMD=${BASEDIR}/bin/redis-server
if [ -f /redis-stack.conf ]; then
CONFFILE=/redis-stack.conf
# first arg is `-f` or `--some-option`
# or first arg is `something.conf`
if [ "${1#-}" != "$1" ] || [ "${1%.conf}" != "$1" ]; then
set -- redis-server "$@"
fi
if [ -z "${REDIS_DATA_DIR}" ]; then
REDIS_DATA_DIR=/data
# allow the container to be started with `--user`
if [ "$1" = 'redis-server' -a "$(id -u)" = '0' ]; then
find . \! -user redis -exec chown redis '{}' +
exec gosu redis "$0" "$@"
fi
# when running in redis-stack (as opposed to redis-stack-server)
if [ -f ${BASEDIR}/nodejs/bin/node ]; then
${BASEDIR}/nodejs/bin/node -r ${BASEDIR}/share/redisinsight/api/node_modules/dotenv/config ${BASEDIR}/share/redisinsight/api/dist/src/main.js dotenv_config_path=${BASEDIR}/share/redisinsight/.env &
# set an appropriate umask (if one isn't set already)
# - https://github.com/docker-library/redis/issues/305
# - https://github.com/redis/redis/blob/bb875603fb7ff3f9d19aad906bd45d7db98d9a39/utils/systemd-redis_server.service#L37
um="$(umask)"
if [ "$um" = '0022' ]; then
umask 0077
fi
if [ -z "${REDISEARCH_ARGS}" ]; then
REDISEARCH_ARGS="MAXSEARCHRESULTS 10000 MAXAGGREGATERESULTS 10000"
if [ "$1" = 'redis-server' ]; then
echo "Starting Redis Server"
modules_dir="/usr/local/lib/redis/modules/"
if [ ! -d "$modules_dir" ]; then
echo "Warning: Default Redis modules directory $modules_dir does not exist."
elif [ -n "$(ls -A $modules_dir 2>/dev/null)" ]; then
for module in "$modules_dir"/*.so;
do
if [ ! -s "$module" ]; then
echo "Skipping module $module: file has no size."
continue
fi
if [ -d "$module" ]; then
echo "Skipping module $module: is a directory."
continue
fi
if [ ! -r "$module" ]; then
echo "Skipping module $module: file is not readable."
continue
fi
if [ ! -x "$module" ]; then
echo "Warning: Module $module is not executable."
continue
fi
set -- "$@" --loadmodule "$module"
done
fi
fi
${CMD} \
${CONFFILE} \
--dir ${REDIS_DATA_DIR} \
--protected-mode no \
--daemonize no \
--loadmodule /opt/redis-stack/lib/rediscompat.so \
--loadmodule /opt/redis-stack/lib/redisearch.so ${REDISEARCH_ARGS} \
--loadmodule /opt/redis-stack/lib/redistimeseries.so ${REDISTIMESERIES_ARGS} \
--loadmodule /opt/redis-stack/lib/rejson.so ${REDISJSON_ARGS} \
--loadmodule /opt/redis-stack/lib/redisbloom.so ${REDISBLOOM_ARGS} \
--loadmodule /opt/redis-stack/lib/redisgears.so v8-plugin-path /opt/redis-stack/lib/libredisgears_v8_plugin.so ${REDISGEARS_ARGS} \
${REDIS_ARGS}
exec "$@"