We run Dokku, and therefore dokku redis, in its own Docker container. In order to make this work we map a path from the host into the container as `/var/lib/dokku/services/redis`. Unfortunately the path on the host is user-configurable, and generally _won't_ be the same as the path in the container. This means that when we run `docker` commands (e.g. to spin up Redis containers), the directory used for bind mounts (the `-v` option) needs to be different. This commit allows us to do this, but keeps the existing behaviour (the redis root for Docker binds is the same as the redis root for other uses) by default.
28 lines
988 B
Bash
Executable File
28 lines
988 B
Bash
Executable File
#!/usr/bin/env bash
|
|
export REDIS_IMAGE=${REDIS_IMAGE:="redis"}
|
|
export REDIS_IMAGE_VERSION=${REDIS_IMAGE_VERSION:="4.0.8"}
|
|
export REDIS_ROOT=${REDIS_ROOT:="/var/lib/dokku/services/redis"}
|
|
export REDIS_HOST_ROOT=${REDIS_HOST_ROOT:=$REDIS_ROOT}
|
|
|
|
export PLUGIN_COMMAND_PREFIX="redis"
|
|
export PLUGIN_CONFIG_ROOT=${PLUGIN_CONFIG_ROOT:="$DOKKU_LIB_ROOT/config/$PLUGIN_COMMAND_PREFIX"}
|
|
export PLUGIN_DATA_ROOT=$REDIS_ROOT
|
|
export PLUGIN_DATA_HOST_ROOT=$REDIS_HOST_ROOT
|
|
export PLUGIN_DATASTORE_PORTS=(6379)
|
|
export PLUGIN_DATASTORE_WAIT_PORT=6379
|
|
export PLUGIN_DEFAULT_ALIAS="REDIS"
|
|
export PLUGIN_ALT_ALIAS="DOKKU_REDIS"
|
|
export PLUGIN_IMAGE=$REDIS_IMAGE
|
|
export PLUGIN_IMAGE_VERSION=$REDIS_IMAGE_VERSION
|
|
export PLUGIN_SCHEME="redis"
|
|
export PLUGIN_SERVICE="Redis"
|
|
export PLUGIN_VARIABLE="REDIS"
|
|
export PLUGIN_BASE_PATH="$PLUGIN_PATH"
|
|
if [[ -n $DOKKU_API_VERSION ]]; then
|
|
export PLUGIN_BASE_PATH="$PLUGIN_ENABLED_PATH"
|
|
fi
|
|
|
|
if [[ -d "$PLUGIN_DATA_ROOT/*" ]]; then
|
|
rm -rf "${PLUGIN_DATA_ROOT:?}/*"
|
|
fi
|