mirror of
https://github.com/YunoHost-Apps/acropolis_ynh.git
synced 2024-09-03 18:06:22 +02:00
Remove not user redis
This commit is contained in:
parent
fb4edf295e
commit
5740935db9
3 changed files with 1 additions and 55 deletions
|
@ -452,45 +452,3 @@ ynh_cleanup_ruby () {
|
||||||
ynh_secure_remove --file="/etc/profile.d/rbenv.sh"
|
ynh_secure_remove --file="/etc/profile.d/rbenv.sh"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# REDIS HELPERS
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
# get the first available redis database
|
|
||||||
#
|
|
||||||
# usage: ynh_redis_get_free_db
|
|
||||||
# | returns: the database number to use
|
|
||||||
ynh_redis_get_free_db() {
|
|
||||||
local result max db
|
|
||||||
result="$(redis-cli INFO keyspace)"
|
|
||||||
|
|
||||||
# get the num
|
|
||||||
max=$(cat /etc/redis/redis.conf | grep ^databases | grep -Eow "[0-9]+")
|
|
||||||
|
|
||||||
db=0
|
|
||||||
# default Debian setting is 15 databases
|
|
||||||
for i in $(seq 0 "$max")
|
|
||||||
do
|
|
||||||
if ! echo "$result" | grep -q "db$i"
|
|
||||||
then
|
|
||||||
db=$i
|
|
||||||
break 1
|
|
||||||
fi
|
|
||||||
db=-1
|
|
||||||
done
|
|
||||||
|
|
||||||
test "$db" -eq -1 && ynh_die --message="No available Redis databases..."
|
|
||||||
|
|
||||||
echo "$db"
|
|
||||||
}
|
|
||||||
|
|
||||||
# Create a master password and set up global settings
|
|
||||||
# Please always call this script in install and restore scripts
|
|
||||||
#
|
|
||||||
# usage: ynh_redis_remove_db database
|
|
||||||
# | arg: database - the database to erase
|
|
||||||
ynh_redis_remove_db() {
|
|
||||||
local db=$1
|
|
||||||
redis-cli -n "$db" flushall
|
|
||||||
}
|
|
||||||
|
|
|
@ -155,9 +155,6 @@ ynh_script_progression --message="Adding a configuration file..." --weight=1
|
||||||
database_yml="$final_path/config/database.yml"
|
database_yml="$final_path/config/database.yml"
|
||||||
diaspora_toml="$final_path/config/diaspora.toml"
|
diaspora_toml="$final_path/config/diaspora.toml"
|
||||||
|
|
||||||
redis_namespace=${app}_production
|
|
||||||
ynh_app_setting_set --app="$app" --key=redis_namespace --value="$redis_namespace"
|
|
||||||
|
|
||||||
secret_key_base=$(ynh_string_random --length=128)
|
secret_key_base=$(ynh_string_random --length=128)
|
||||||
ynh_app_setting_set --app="$app" --key=secret_key_base --value="$secret_key_base"
|
ynh_app_setting_set --app="$app" --key=secret_key_base --value="$secret_key_base"
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,6 @@ admin=$(ynh_app_setting_get --app=$app --key=admin)
|
||||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||||
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
||||||
db_user=$(ynh_app_setting_get --app=$app --key=db_user)
|
db_user=$(ynh_app_setting_get --app=$app --key=db_user)
|
||||||
redis_namespace=$(ynh_app_setting_get --app=$app --key=db_name)
|
|
||||||
db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd)
|
db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd)
|
||||||
port_web=$(ynh_app_setting_get --app=$app --key=port_web)
|
port_web=$(ynh_app_setting_get --app=$app --key=port_web)
|
||||||
secret_key_base=$(ynh_app_setting_get --app=$app --key=secret_key_base)
|
secret_key_base=$(ynh_app_setting_get --app=$app --key=secret_key_base)
|
||||||
|
@ -86,12 +85,6 @@ if [[ -z "$db_pwd" ]]; then
|
||||||
ynh_replace_string --match_string="DB_PASS=" --replace_string="DB_PASS=${db_pwd}" --target_file="$config"
|
ynh_replace_string --match_string="DB_PASS=" --replace_string="DB_PASS=${db_pwd}" --target_file="$config"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# If redis_namespace doesn't exist, create it
|
|
||||||
if [[ -z "$redis_namespace" ]]; then
|
|
||||||
redis_namespace=${app}_production
|
|
||||||
ynh_app_setting_set --app=$app --key=redis_namespace --value=$redis_namespace
|
|
||||||
fi
|
|
||||||
|
|
||||||
# If secret_key_base doesn't exist, retrieve it or create it
|
# If secret_key_base doesn't exist, retrieve it or create it
|
||||||
if [[ -z "$secret_key_base" ]]; then
|
if [[ -z "$secret_key_base" ]]; then
|
||||||
secret_key_base=$(grep -oP "SECRET_KEY_BASE=\K\w+" $config)
|
secret_key_base=$(grep -oP "SECRET_KEY_BASE=\K\w+" $config)
|
||||||
|
@ -102,6 +95,7 @@ if [[ -z "$secret_key_base" ]]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
ynh_remove_extra_repo
|
ynh_remove_extra_repo
|
||||||
|
ynh_app_setting_delete --app=$app --key=redis_namespace
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CREATE DEDICATED USER
|
# CREATE DEDICATED USER
|
||||||
|
@ -164,9 +158,6 @@ ynh_script_progression --message="Updating a configuration file..." --weight=1
|
||||||
database_yml="$final_path/config/database.yml"
|
database_yml="$final_path/config/database.yml"
|
||||||
diaspora_toml="$final_path/config/diaspora.toml"
|
diaspora_toml="$final_path/config/diaspora.toml"
|
||||||
|
|
||||||
redis_namespace=${app}_production
|
|
||||||
ynh_app_setting_set --app="$app" --key=redis_namespace --value="$redis_namespace"
|
|
||||||
|
|
||||||
secret_key_base=$(ynh_string_random --length=128)
|
secret_key_base=$(ynh_string_random --length=128)
|
||||||
ynh_app_setting_set --app="$app" --key=secret_key_base --value="$secret_key_base"
|
ynh_app_setting_set --app="$app" --key=secret_key_base --value="$secret_key_base"
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue