mirror of
https://github.com/YunoHost-Apps/nodebb_ynh.git
synced 2024-09-03 19:46:29 +02:00
Fix
This commit is contained in:
parent
2c9aa9b766
commit
f11ba8bc80
6 changed files with 2 additions and 69 deletions
|
@ -1,3 +0,0 @@
|
||||||
export admin__username="__ADMIN__"
|
|
||||||
export admin__password="__PASSWORD__"
|
|
||||||
export admin__password__confirm="__PASSWORD__"
|
|
|
@ -8,20 +8,11 @@
|
||||||
"admin__password__confirm":"__PASSWORD__",
|
"admin__password__confirm":"__PASSWORD__",
|
||||||
"trust_proxy": true,
|
"trust_proxy": true,
|
||||||
"isCluster": false,
|
"isCluster": false,
|
||||||
"redis": {
|
|
||||||
"host": "127.0.0.1",
|
|
||||||
"port": "6379",
|
|
||||||
"password": "",
|
|
||||||
"database": "__REDIS_DB__"
|
|
||||||
},
|
|
||||||
"postgres": {
|
"postgres": {
|
||||||
"host": "localhost",
|
"host": "localhost",
|
||||||
"port": "5432",
|
"port": "5432",
|
||||||
"username": "__DB_NAME__",
|
"username": "__DB_NAME__",
|
||||||
"password": "__DB_PWD__",
|
"password": "__DB_PWD__",
|
||||||
"database": "__DB_NAME__"
|
"database": "__DB_NAME__"
|
||||||
},
|
|
||||||
"socket.io": {
|
|
||||||
"transports": ["websocket"]
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
# dependencies used by the app
|
# dependencies used by the app
|
||||||
pkg_dependencies="postgresql redis-server"
|
pkg_dependencies="postgresql"
|
||||||
|
|
||||||
nodejs_version=14
|
nodejs_version=14
|
||||||
|
|
||||||
|
@ -22,41 +22,3 @@ nodebb_version=v1.18.x
|
||||||
#=================================================
|
#=================================================
|
||||||
# FUTURE OFFICIAL HELPERS
|
# 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
|
|
||||||
}
|
|
||||||
|
|
|
@ -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_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
||||||
db_user=$db_name
|
db_user=$db_name
|
||||||
db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd)
|
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)
|
port=$(ynh_app_setting_get --app=$app --key=port)
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -72,15 +72,6 @@ ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies
|
||||||
# Install Nodejs
|
# Install Nodejs
|
||||||
ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version
|
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
|
# CREATE DEDICATED USER
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -143,7 +134,7 @@ chown $app "$final_path/config.json"
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
pushd $final_path
|
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
|
popd
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -60,13 +60,6 @@ ynh_script_progression --message="Removing dependencies..." --weight=1
|
||||||
ynh_remove_app_dependencies
|
ynh_remove_app_dependencies
|
||||||
ynh_remove_nodejs
|
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
|
# REMOVE APP MAIN DIR
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
Loading…
Reference in a new issue