diff --git a/doc/ADMIN.md b/doc/ADMIN.md index ffd8479..8774b13 100644 --- a/doc/ADMIN.md +++ b/doc/ADMIN.md @@ -5,6 +5,6 @@ If you want to install Etherpad with plugins and mysql database: https://github. ## Configuration -You can access Etherpad's admin panel at `domain.tld/admin`. The configuration file for Etherpad is at the path `/var/www/etherpad/settings.json`. +You can access Etherpad's admin panel at `domain.tld/admin`. The configuration file for Etherpad is at the path `__INSTALL_DIR__/settings.json`. -*Skin Builder* (accessible at this address `domain.tld/pad/p/test#skinvariantsbuilder`) allows you to customize the skin of your pad. It will give you a parameter to copy into your configuration file `/var/www/etherpad/settings.json`. +*Skin Builder* (accessible at this address `__DOMAIN__/pad/p/test#skinvariantsbuilder`) allows you to customize the skin of your pad. It will give you a parameter to copy into your configuration file `__INSTALL_DIR__/settings.json`. diff --git a/doc/ADMIN_fr.md b/doc/ADMIN_fr.md index 827efe1..75c6ef4 100644 --- a/doc/ADMIN_fr.md +++ b/doc/ADMIN_fr.md @@ -1,3 +1,3 @@ -Vous pouvez accéder au panneau d'administration d'Etherpad à l'adresse `domain.tld/admin`. Le fichier de configuration d'Etherpad est `/var/www/etherpad/settings.json`. +Vous pouvez accéder au panneau d'administration d'Etherpad à l'adresse `domain.tld/admin`. Le fichier de configuration d'Etherpad est `__INSTALL_DIR__/settings.json`. -*Skin Builder* (accessible à l'adresse `domain.tld/pad/p/test#skinvariantsbuilder`) vous permet de personnaliser l'apparence de votre pad. Il vous donnera un paramètre à copier dans votre fichier de configuration `/var/www/etherpad/settings.json`. +*Skin Builder* (accessible à l'adresse `__DOMAIN__/pad/p/test#skinvariantsbuilder`) vous permet de personnaliser l'apparence de votre pad. Il vous donnera un paramètre à copier dans votre fichier de configuration `__INSTALL_DIR__/settings.json`. diff --git a/scripts/_common.sh b/scripts/_common.sh index b1ab6a0..44277c5 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -17,42 +17,3 @@ nodejs_version=20 #================================================= # 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/backup b/scripts/backup index 7c629c7..024f5ce 100644 --- a/scripts/backup +++ b/scripts/backup @@ -40,6 +40,13 @@ ynh_backup --src_path="/etc/logrotate.d/$app" ynh_backup --src_path="/etc/systemd/system/$app.service" +#================================================= +# BACKUP THE POSTGRESQL DATABASE +#================================================= +ynh_print_info --message="Backing up the PostgreSQL database..." + +ynh_psql_dump_db --database="$db_name" > db.sql + #================================================= # END OF SCRIPT #================================================= diff --git a/scripts/install b/scripts/install index ca91dde..bc8768b 100644 --- a/scripts/install +++ b/scripts/install @@ -15,16 +15,6 @@ source /usr/share/yunohost/helpers ynh_script_progression --message="Installing dependencies..." --weight=6 ynh_install_nodejs --nodejs_version=$nodejs_version -ynh_use_nodejs - -#================================================= -# CREATE A POSTQRESQL 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" #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE @@ -44,7 +34,6 @@ ynh_script_progression --message="Installing Etherpad..." --weight=60 pushd $install_dir ynh_use_nodejs - #ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH src/bin/run.sh ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH bin/installDeps.sh popd diff --git a/scripts/restore b/scripts/restore index 513c4a2..23a925f 100644 --- a/scripts/restore +++ b/scripts/restore @@ -29,6 +29,13 @@ ynh_script_progression --message="Reinstalling dependencies..." --weight=7 # Install Nodejs ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version +#================================================= +# RESTORE THE POSTGRESQL DATABASE +#================================================= +ynh_script_progression --message="Restoring the PostgreSQL database..." --weight=6 + +ynh_psql_execute_file_as_root --file="./db.sql" --database=$db_name + #================================================= # RESTORE SYSTEMD #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index cfee58a..5777dc7 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -22,7 +22,7 @@ upgrade_type=$(ynh_check_app_version_changed) #================================================= ynh_script_progression --message="Stopping a systemd service..." --weight=42 -ynh_systemd_action --service_name=$app --action=stop --log_path="/var/log/$app/$app.log" +ynh_systemd_action --service_name=$app --action=stop --log_path="systemd" #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE @@ -32,7 +32,7 @@ if [ "$upgrade_type" == "UPGRADE_APP" ] then ynh_script_progression --message="Upgrading source files..." --weight=1 # Download, check integrity, uncompress and patch the source from app.src - ynh_setup_source --dest_dir="$install_dir" --keep="$install_dir/settings.json $install_dir/credentials.json" + ynh_setup_source --dest_dir="$install_dir" --keep="settings.json credentials.json" fi chmod -R o-rwx "$install_dir"