81 lines
1.7 KiB
Bash
Executable File
81 lines
1.7 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
readonly toolName=redis
|
|
readonly toolDeps=redis-server
|
|
sq_aptOpt=
|
|
|
|
seq_config() {
|
|
if ! initSeqConfig "${seq_configName:?}" "${seq_configTemplate:?}" ; then
|
|
# End if no configuration file exists
|
|
dry || return 1
|
|
fi
|
|
|
|
## Apt cmdline option to suppress user interaction
|
|
interactive || sq_aptOpt="-y"
|
|
|
|
return 0
|
|
}
|
|
|
|
step_1_info() { echo "Install $toolName"; }
|
|
step_1_alias() { echo "install"; }
|
|
step_1() {
|
|
exe apt update
|
|
exe apt install $toolDeps $sq_aptOpt
|
|
}
|
|
|
|
step_2_info() { echo "Installation notes"; }
|
|
step_2_alias() { echo "notes"; }
|
|
step_2() {
|
|
cat <<NOTES_EOF
|
|
# For php applications make sure php-redis is installed
|
|
apt install php-redis
|
|
|
|
# Bind to localhsot
|
|
[/etc/redis/redis.conf]
|
|
bind 127.0.0.1 ::1
|
|
|
|
# or use socket
|
|
unixsocket /var/run/redis/redis-server.sock
|
|
unixsocketperm 770
|
|
|
|
## Password protect
|
|
requirepass verystrongpassword
|
|
|
|
# Nextcloud configuration
|
|
[/var/www/nextcloud/config/config.php]
|
|
'memcache.locking' => '\\OC\\Memcache\\Redis',
|
|
'memcache.distributed' => '\\OC\\Memcache\\Redis',
|
|
'redis' =>
|
|
array (
|
|
'host' => '/var/run/redis/redis-server.sock',
|
|
'port' => 0,
|
|
'password' => 'verystrongpassword',
|
|
'timeout' => 0.0,
|
|
),
|
|
|
|
NOTES_EOF
|
|
}
|
|
|
|
step_10_info() {
|
|
echo "Execute redis-cli commands"
|
|
echoinfo " [CLI COMMAND]"
|
|
echoinfo " e.g. info"
|
|
}
|
|
step_10_options() { echo "[CLI COMMAND]"; }
|
|
step_10_alias() { echo "cli"; }
|
|
step_10() {
|
|
shift
|
|
local cliCmd="$@"
|
|
if [ ! -z "$REDIS_AUTH" ] ; then
|
|
#exe "echo -e \"AUTH=$REDIS_AUTH$cliCmd\" | redis-cli"
|
|
exe redis-cli -a "$REDIS_AUTH" $cliCmd
|
|
else
|
|
exe redis-cli $cliCmd
|
|
fi
|
|
}
|
|
|
|
# shellcheck disable=SC2034 # Appears unused
|
|
readonly sqr_minVersion=16
|
|
# shellcheck disable=SC1091 # Don't follow this source
|
|
. /usr/local/bin/sequencer.sh
|