From f11ba8bc80293973a0a6423094913b6bef066bcb Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Wed, 1 Sep 2021 15:32:18 +0200 Subject: [PATCH] Fix --- conf/.env | 3 --- conf/config.json | 9 --------- scripts/_common.sh | 40 +--------------------------------------- scripts/change_url | 1 - scripts/install | 11 +---------- scripts/remove | 7 ------- 6 files changed, 2 insertions(+), 69 deletions(-) delete mode 100644 conf/.env diff --git a/conf/.env b/conf/.env deleted file mode 100644 index efda5af..0000000 --- a/conf/.env +++ /dev/null @@ -1,3 +0,0 @@ -export admin__username="__ADMIN__" -export admin__password="__PASSWORD__" -export admin__password__confirm="__PASSWORD__" \ No newline at end of file diff --git a/conf/config.json b/conf/config.json index 62805bd..dc62c83 100644 --- a/conf/config.json +++ b/conf/config.json @@ -8,20 +8,11 @@ "admin__password__confirm":"__PASSWORD__", "trust_proxy": true, "isCluster": false, - "redis": { - "host": "127.0.0.1", - "port": "6379", - "password": "", - "database": "__REDIS_DB__" - }, "postgres": { "host": "localhost", "port": "5432", "username": "__DB_NAME__", "password": "__DB_PWD__", "database": "__DB_NAME__" - }, - "socket.io": { - "transports": ["websocket"] } } diff --git a/scripts/_common.sh b/scripts/_common.sh index fc2dd90..7358130 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -5,7 +5,7 @@ #================================================= # dependencies used by the app -pkg_dependencies="postgresql redis-server" +pkg_dependencies="postgresql" nodejs_version=14 @@ -22,41 +22,3 @@ nodebb_version=v1.18.x #================================================= # FUTURE OFFICIAL 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/change_url b/scripts/change_url index 231e438..e1755ac 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -34,7 +34,6 @@ admin=$(ynh_app_setting_get --app=$app --key=admin) db_name=$(ynh_app_setting_get --app=$app --key=db_name) db_user=$db_name db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd) -redis_db=$(ynh_app_setting_get --app=$app --key=redis_db) port=$(ynh_app_setting_get --app=$app --key=port) #================================================= diff --git a/scripts/install b/scripts/install index 22345da..88a264b 100644 --- a/scripts/install +++ b/scripts/install @@ -72,15 +72,6 @@ ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies # Install Nodejs ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version -#================================================= -# CREATE A REDIS DATABASE -#================================================= -ynh_script_progression --message="Creating a Redis database..." --weight=5 - -# Configure redis -redis_db=$(ynh_redis_get_free_db) -ynh_app_setting_set --app="$app" --key=redis_db --value="$redis_db" - #================================================= # CREATE DEDICATED USER #================================================= @@ -143,7 +134,7 @@ chown $app "$final_path/config.json" #================================================= pushd $final_path - ynh_exec_as $app env $ynh_node_load_PATH $final_path/nodebb setup #-l > $install_log + ynh_exec_as $app env $ynh_node_load_PATH $final_path/nodebb setup popd #================================================= diff --git a/scripts/remove b/scripts/remove index 5142d55..222fcaf 100644 --- a/scripts/remove +++ b/scripts/remove @@ -60,13 +60,6 @@ ynh_script_progression --message="Removing dependencies..." --weight=1 ynh_remove_app_dependencies ynh_remove_nodejs -#================================================= -# REMOVE THE REDIS DATABASE -#================================================= -ynh_script_progression --message="Removing the Redis database..." - -ynh_redis_remove_db "$redis_db" - #================================================= # REMOVE APP MAIN DIR #=================================================