diff --git a/scripts/_common.sh b/scripts/_common.sh index ae61994..838ccf5 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -452,45 +452,3 @@ ynh_cleanup_ruby () { ynh_secure_remove --file="/etc/profile.d/rbenv.sh" 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 -} diff --git a/scripts/install b/scripts/install index b805edd..eb0b11d 100644 --- a/scripts/install +++ b/scripts/install @@ -155,9 +155,6 @@ ynh_script_progression --message="Adding a configuration file..." --weight=1 database_yml="$final_path/config/database.yml" 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) ynh_app_setting_set --app="$app" --key=secret_key_base --value="$secret_key_base" diff --git a/scripts/upgrade b/scripts/upgrade index f3c206a..4540205 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -22,7 +22,6 @@ admin=$(ynh_app_setting_get --app=$app --key=admin) final_path=$(ynh_app_setting_get --app=$app --key=final_path) db_name=$(ynh_app_setting_get --app=$app --key=db_name) 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) port_web=$(ynh_app_setting_get --app=$app --key=port_web) 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" 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 [[ -z "$secret_key_base" ]]; then secret_key_base=$(grep -oP "SECRET_KEY_BASE=\K\w+" $config) @@ -102,6 +95,7 @@ if [[ -z "$secret_key_base" ]]; then fi ynh_remove_extra_repo +ynh_app_setting_delete --app=$app --key=redis_namespace #================================================= # CREATE DEDICATED USER @@ -164,9 +158,6 @@ ynh_script_progression --message="Updating a configuration file..." --weight=1 database_yml="$final_path/config/database.yml" 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) ynh_app_setting_set --app="$app" --key=secret_key_base --value="$secret_key_base"