1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/etherpad_ynh.git synced 2024-09-03 18:36:10 +02:00
This commit is contained in:
Éric Gaspar 2023-08-27 22:52:14 +02:00
parent 69d01dbc32
commit c7dc60f990
7 changed files with 20 additions and 56 deletions

View file

@ -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`.

View file

@ -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`.

View file

@ -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
}

View file

@ -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
#=================================================

View file

@ -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

View file

@ -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
#=================================================

View file

@ -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"