1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/etherpad_mypads_ynh.git synced 2024-09-03 18:36:09 +02:00
This commit is contained in:
Éric Gaspar 2023-02-16 14:37:28 +01:00
parent 0f6b5703c0
commit fe9618c06e
11 changed files with 90 additions and 292 deletions

View file

@ -1,5 +1,5 @@
[Unit] [Unit]
Description=Etherpad-lite, the collaborative editor. Description=Etherpad-lite: the collaborative editor.
After=syslog.target network.target After=syslog.target network.target
[Service] [Service]

View file

@ -15,26 +15,22 @@ website = "http://etherpad.org"
demo = "https://video.etherpad.com" demo = "https://video.etherpad.com"
admindoc = "http://etherpad.org/doc/v1.8.18" admindoc = "http://etherpad.org/doc/v1.8.18"
code = "https://github.com/ether/etherpad-lite" code = "https://github.com/ether/etherpad-lite"
cpe = "???" # FIXME: optional but recommended if relevant, this is meant to contain the Common Platform Enumeration, which is sort of a standard id for applications defined by the NIST. In particular, Yunohost may use this is in the future to easily track CVE (=security reports) related to apps. The CPE may be obtained by searching here: https://nvd.nist.gov/products/cpe/search. For example, for Nextcloud, the CPE is 'cpe:2.3:a:nextcloud:nextcloud' (no need to include the version number)
fund = "???" # FIXME: optional but recommended (or remove if irrelevant / not applicable). This is meant to be an URL where people can financially support this app, especially when its development is based on volunteers and/or financed by its community. YunoHost may later advertise it in the webadmin.
[integration] [integration]
yunohost = ">= 4.3.0" yunohost = ">= 11.1.7"
architectures = "all" # FIXME: can be replaced by a list of supported archs using the dpkg --print-architecture nomenclature (amd64/i386/armhf/arm64), for example: ["amd64", "i386"] architectures = "all"
multi_instance = true multi_instance = true
ldap = "?" # FIXME: replace with true, false, or "not_relevant". Not to confuse with the "sso" key : the "ldap" key corresponds to wether or not a user *can* login on the app using its YunoHost credentials. ldap = false
sso = "?" # FIXME: replace with true, false, or "not_relevant". Not to confuse with the "ldap" key : the "sso" key corresponds to wether or not a user is *automatically logged-in* on the app when logged-in on the YunoHost portal. sso = false
disk = "50M" # FIXME: replace with an **estimate** minimum disk requirement. e.g. 20M, 400M, 1G, ... disk = "50M"
ram.build = "50M" # FIXME: replace with an **estimate** minimum ram requirement. e.g. 50M, 400M, 1G, ... ram.build = "50M"
ram.runtime = "50M" # FIXME: replace with an **estimate** minimum ram requirement. e.g. 50M, 400M, 1G, ... ram.runtime = "50M"
[install] [install]
[install.domain] [install.domain]
# this is a generic question - ask strings are automatically handled by Yunohost's core
type = "domain" type = "domain"
[install.path] [install.path]
# this is a generic question - ask strings are automatically handled by Yunohost's core
type = "path" type = "path"
default = "/pad" default = "/pad"
@ -52,11 +48,9 @@ ram.runtime = "50M" # FIXME: replace with an **estimate** minimum ram requiremen
default = "en" default = "en"
[install.admin] [install.admin]
# this is a generic question - ask strings are automatically handled by Yunohost's core
type = "user" type = "user"
[install.password] [install.password]
# this is a generic question - ask strings are automatically handled by Yunohost's core
type = "password" type = "password"
[install.export] [install.export]
@ -86,8 +80,15 @@ ram.runtime = "50M" # FIXME: replace with an **estimate** minimum ram requiremen
[resources.install_dir] [resources.install_dir]
[resources.ports]
[resources.permissions] [resources.permissions]
main.url = "/" main.url = "/"
admin.url = "/admin*"
admin.auth_header = false
api.show_tile = false
admin.allowed = ["admins"]
[resources.database] [resources.database]
type = "mysql" type = "mysql"

View file

@ -8,7 +8,7 @@
abiword_app_depencencies="abiword" abiword_app_depencencies="abiword"
# Dependencies for LibreOffice # Dependencies for LibreOffice
#REMOVEME? libreoffice_app_dependencies="unoconv libreoffice-writer" libreoffice_app_dependencies="unoconv libreoffice-writer"
# NodeJS version # NodeJS version
nodejs_version=14 nodejs_version=14

View file

@ -10,27 +10,6 @@
source ../settings/scripts/_common.sh source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
#=================================================
# MANAGE SCRIPT FAILURE
#=================================================
#REMOVEME? ynh_clean_setup () {
true
}
# Exit if an error occurs during the execution of the script
#REMOVEME? ynh_abort_if_errors
#=================================================
# LOAD SETTINGS
#=================================================
#REMOVEME? ynh_print_info --message="Loading installation settings..."
#REMOVEME? app=$YNH_APP_INSTANCE_NAME
#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir)
#REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain)
#REMOVEME? db_name=$(ynh_app_setting_get --app=$app --key=db_name)
#================================================= #=================================================
# DECLARE DATA AND CONF FILES TO BACKUP # DECLARE DATA AND CONF FILES TO BACKUP
#================================================= #=================================================

View file

@ -30,9 +30,6 @@ app=$YNH_APP_INSTANCE_NAME
#================================================= #=================================================
ynh_script_progression --message="Loading installation settings..." --weight=5 ynh_script_progression --message="Loading installation settings..." --weight=5
# Needed for helper "ynh_add_nginx_config"
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
# Add settings here as needed by your application # Add settings here as needed by your application
mypads=$(ynh_app_setting_get --app=$app --key=mypads) mypads=$(ynh_app_setting_get --app=$app --key=mypads)
port=$(ynh_app_setting_get --app=$app --key=port) port=$(ynh_app_setting_get --app=$app --key=port)

View file

@ -10,16 +10,6 @@
source _common.sh source _common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
ynh_abort_if_errors
#=================================================
# RETRIEVE ARGUMENTS
#=================================================
app=$YNH_APP_INSTANCE_NAME
final_path=$(ynh_app_setting_get $app final_path)
#================================================= #=================================================
# SPECIFIC CODE # SPECIFIC CODE
#================================================= #=================================================

View file

@ -13,31 +13,14 @@ fi
source _common.sh source _common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
#=================================================
# MANAGE SCRIPT FAILURE
#=================================================
#REMOVEME? ynh_clean_setup () {
true
}
# Exit if an error occurs during the execution of the script
#REMOVEME? ynh_abort_if_errors
#================================================= #=================================================
# RETRIEVE ARGUMENTS FROM THE MANIFEST # RETRIEVE ARGUMENTS FROM THE MANIFEST
#================================================= #=================================================
#REMOVEME? domain=$YNH_APP_ARG_DOMAIN password="$YNH_APP_ARG_PASSWORD"
#REMOVEME? path=$YNH_APP_ARG_PATH export=$YNH_APP_ARG_EXPORT
#REMOVEME? is_public=$YNH_APP_ARG_IS_PUBLIC mypads=$YNH_APP_ARG_MYPADS
#REMOVEME? language=$YNH_APP_ARG_LANGUAGE useldap=$YNH_APP_ARG_USELDAP
#REMOVEME? admin=$YNH_APP_ARG_ADMIN
#REMOVEME? password="$YNH_APP_ARG_PASSWORD"
#REMOVEME? export=$YNH_APP_ARG_EXPORT
#REMOVEME? mypads=$YNH_APP_ARG_MYPADS
#REMOVEME? useldap=$YNH_APP_ARG_USELDAP
#REMOVEME? app=$YNH_APP_INSTANCE_NAME
#================================================= #=================================================
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS # CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
@ -49,23 +32,11 @@ then
ynh_die --message="The password must be between 8 and 30 characters." ynh_die --message="The password must be between 8 and 30 characters."
fi fi
#REMOVEME? install_dir=/var/www/$app
#REMOVEME? test ! -e "$install_dir" || ynh_die --message="This path already contains a folder"
# Register (book) web path
#REMOVEME? ynh_webpath_register --app=$app --domain=$domain --path=$path
#================================================= #=================================================
# STORE SETTINGS FROM MANIFEST # STORE SETTINGS FROM MANIFEST
#================================================= #=================================================
#REMOVEME? ynh_script_progression --message="Storing installation settings..." --weight=3 ynh_script_progression --message="Storing installation settings..." --weight=3
#REMOVEME? ynh_app_setting_set --app=$app --key=domain --value=$domain
#REMOVEME? ynh_app_setting_set --app=$app --key=path --value=$path
ynh_app_setting_set --app=$app --key=language --value=$language
#REMOVEME? ynh_app_setting_set --app=$app --key=admin --value=$admin
#REMOVEME? ynh_app_setting_set --app=$app --key=password --value="$password"
#REMOVEME? ynh_app_setting_set --app=$app --key=export --value=$export
ynh_app_setting_set --app=$app --key=mypads --value=$mypads ynh_app_setting_set --app=$app --key=mypads --value=$mypads
ynh_app_setting_set --app=$app --key=useldap --value=$useldap ynh_app_setting_set --app=$app --key=useldap --value=$useldap
ynh_app_setting_set --app=$app --key=overwrite_settings --value="1" ynh_app_setting_set --app=$app --key=overwrite_settings --value="1"
@ -73,48 +44,24 @@ ynh_app_setting_set --app=$app --key=overwrite_credentials --value="1"
ynh_app_setting_set --app=$app --key=overwrite_nginx --value="1" ynh_app_setting_set --app=$app --key=overwrite_nginx --value="1"
ynh_app_setting_set --app=$app --key=overwrite_systemd --value="1" ynh_app_setting_set --app=$app --key=overwrite_systemd --value="1"
#=================================================
# STANDARD MODIFICATIONS
#=================================================
# FIND AND OPEN A PORT
#=================================================
#REMOVEME? ynh_script_progression --message="Finding an available port..." --weight=2
# Find an available port
#REMOVEME? port=$(ynh_find_port --port=9001)
#REMOVEME? ynh_app_setting_set --app=$app --key=port --value=$port
#================================================= #=================================================
# INSTALL DEPENDENCIES # INSTALL DEPENDENCIES
#================================================= #=================================================
#REMOVEME? ynh_script_progression --message="Installing dependencies..." --weight=120 #REMOVEME? ynh_script_progression --message="Installing dependencies..." --weight=120
if [ "$export" = "abiword" ]; then if [ "$export" = "abiword" ]; then
#REMOVEME? ynh_exec_warn_less ynh_install_app_dependencies $abiword_app_depencencies ynh_exec_warn_less ynh_install_app_dependencies $abiword_app_depencencies
elif [ "$export" = "libreoffice" ]; then elif [ "$export" = "libreoffice" ]; then
#REMOVEME? ynh_exec_warn_less ynh_install_app_dependencies $libreoffice_app_dependencies ynh_exec_warn_less ynh_install_app_dependencies $libreoffice_app_dependencies
fi fi
ynh_install_nodejs --nodejs_version=$nodejs_version ynh_install_nodejs --nodejs_version=$nodejs_version
ynh_use_nodejs ynh_use_nodejs
#=================================================
# CREATE DEDICATED USER
#=================================================
#REMOVEME? ynh_script_progression --message="Configuring system user..." --weight=3
# Create a system user
#REMOVEME? ynh_system_user_create --username=$app --home_dir="$install_dir"
#================================================= #=================================================
# CREATE A MYSQL DATABASE # CREATE A MYSQL DATABASE
#================================================= #=================================================
#REMOVEME? ynh_script_progression --message="Creating a MySQL database..." --weight=1 ynh_script_progression --message="Creating a MySQL database..." --weight=1
#REMOVEME? db_name=$(ynh_sanitize_dbid --db_name=$app)
#REMOVEME? db_user=$db_name
#REMOVEME? ynh_app_setting_set --app=$app --key=db_name --value=$db_name
#REMOVEME? ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name
echo "ALTER DATABASE $db_name CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci" | ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name echo "ALTER DATABASE $db_name CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci" | ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name
@ -123,7 +70,6 @@ echo "ALTER DATABASE $db_name CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci"
#================================================= #=================================================
ynh_script_progression --message="Setting up source files..." --weight=4 ynh_script_progression --message="Setting up source files..." --weight=4
#REMOVEME? ynh_app_setting_set --app=$app --key=install_dir --value=$install_dir
# Download, check integrity, uncompress and patch the source from app.src # Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir="$install_dir" ynh_setup_source --dest_dir="$install_dir"
@ -305,29 +251,6 @@ ynh_script_progression --message="Configuring Fail2Ban..." --weight=13
# Create a dedicated Fail2Ban config # Create a dedicated Fail2Ban config
ynh_add_fail2ban_config --logpath="/var/log/nginx/$domain-access.log" --failregex="<HOST> .* .POST /mypads/api/auth/login HTTP/1.1. 400" --max_retry=5 ynh_add_fail2ban_config --logpath="/var/log/nginx/$domain-access.log" --failregex="<HOST> .* .POST /mypads/api/auth/login HTTP/1.1. 400" --max_retry=5
#=================================================
# SETUP SSOWAT
#=================================================
#REMOVEME? ynh_script_progression --message="Configuring permissions..." --weight=2
# Make app public if necessary
#REMOVEME? if [ $is_public -eq 1 ]
then
# Everyone can access the app.
# The "main" permission is automatically created before the install script.
#REMOVEME? ynh_permission_update --permission="main" --add="visitors"
fi
# Only the admin can access the admin panel of the app (if the app has an admin panel)
#REMOVEME? ynh_permission_create --permission="admin" --url="/admin" --allowed=$admin --auth_header=false
#=================================================
# RELOAD NGINX
#=================================================
#REMOVEME? ynh_script_progression --message="Reloading NGINX web server..." --weight=1
#REMOVEME? ynh_systemd_action --service_name=nginx --action=reload
#================================================= #=================================================
# SEND A README FOR THE ADMIN # SEND A README FOR THE ADMIN
#================================================= #=================================================

View file

@ -12,16 +12,9 @@ source /usr/share/yunohost/helpers
#================================================= #=================================================
# LOAD SETTINGS # LOAD SETTINGS
#================================================= #=================================================
#REMOVEME? ynh_script_progression --message="Loading installation settings..." --weight=3 ynh_script_progression --message="Loading installation settings..." --weight=3
#REMOVEME? app=$YNH_APP_INSTANCE_NAME export=$(ynh_app_setting_get --app=$app --key=export)
#REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain)
#REMOVEME? port=$(ynh_app_setting_get --app=$app --key=port)
#REMOVEME? db_name=$(ynh_app_setting_get --app=$app --key=db_name)
#REMOVEME? db_user=$db_name
#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir)
#REMOVEME? export=$(ynh_app_setting_get --app=$app --key=export)
#================================================= #=================================================
# STANDARD REMOVE # STANDARD REMOVE
@ -52,22 +45,6 @@ ynh_script_progression --message="Removing logrotate configuration..." --weight=
# Remove the app-specific logrotate config # Remove the app-specific logrotate config
ynh_remove_logrotate ynh_remove_logrotate
#=================================================
# REMOVE THE MYSQL DATABASE
#=================================================
#REMOVEME? ynh_script_progression --message="Removing the MySQL database..." --weight=2
# Remove a database if it exists, along with the associated user
#REMOVEME? ynh_mysql_remove_db --db_user=$db_user --db_name=$db_name
#=================================================
# REMOVE APP MAIN DIR
#=================================================
#REMOVEME? ynh_script_progression --message="Removing app main directory..." --weight=1
# Remove the app directory securely
#REMOVEME? ynh_secure_remove --file="$install_dir"
#================================================= #=================================================
# REMOVE NGINX CONFIGURATION # REMOVE NGINX CONFIGURATION
#================================================= #=================================================
@ -84,7 +61,7 @@ ynh_remove_nginx_config
if [ "$export" != "none" ] if [ "$export" != "none" ]
then then
# Remove metapackage and its dependencies # Remove metapackage and its dependencies
#REMOVEME? ynh_exec_warn_less ynh_remove_app_dependencies ynh_exec_warn_less ynh_remove_app_dependencies
fi fi
ynh_remove_nodejs ynh_remove_nodejs
@ -107,16 +84,6 @@ ynh_script_progression --message="Removing various files..." --weight=1
# Remove the log files # Remove the log files
ynh_secure_remove --file="/var/log/$app" ynh_secure_remove --file="/var/log/$app"
#=================================================
# GENERIC FINALIZATION
#=================================================
# REMOVE DEDICATED USER
#=================================================
#REMOVEME? ynh_script_progression --message="Removing the dedicated system user..." --weight=2
# Delete a system user
#REMOVEME? ynh_system_user_delete --username=$app
#================================================= #=================================================
# END OF SCRIPT # END OF SCRIPT
#================================================= #=================================================

View file

@ -10,50 +10,14 @@
source ../settings/scripts/_common.sh source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
#=================================================
# MANAGE SCRIPT FAILURE
#=================================================
#REMOVEME? ynh_clean_setup () {
true
}
# Exit if an error occurs during the execution of the script
#REMOVEME? ynh_abort_if_errors
#================================================= #=================================================
# LOAD SETTINGS # LOAD SETTINGS
#================================================= #=================================================
#REMOVEME? ynh_script_progression --message="Loading installation settings..." --weight=3 ynh_script_progression --message="Loading installation settings..." --weight=3
#REMOVEME? app=$YNH_APP_INSTANCE_NAME export=$(ynh_app_setting_get --app=$app --key=export)
mypads=$(ynh_app_setting_get --app=$app --key=mypads)
#REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain) password=$(ynh_app_setting_get --app=$app --key=password)
#REMOVEME? path=$(ynh_app_setting_get --app=$app --key=path)
#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir)
#REMOVEME? db_name=$(ynh_app_setting_get --app=$app --key=db_name)
#REMOVEME? db_user=$db_name
#REMOVEME? export=$(ynh_app_setting_get --app=$app --key=export)
#REMOVEME? mypads=$(ynh_app_setting_get --app=$app --key=mypads)
#REMOVEME? admin=$(ynh_app_setting_get --app=$app --key=admin)
#REMOVEME? password=$(ynh_app_setting_get --app=$app --key=password)
#=================================================
# CHECK IF THE APP CAN BE RESTORED
#=================================================
#REMOVEME? ynh_script_progression --message="Validating restoration parameters..." --weight=1
#REMOVEME? test ! -d $install_dir \
|| ynh_die --message="There is already a directory: $install_dir "
#=================================================
# STANDARD RESTORATION STEPS
#=================================================
# RECREATE THE DEDICATED USER
#=================================================
#REMOVEME? ynh_script_progression --message="Recreating the dedicated system user..." --weight=2
# Create the dedicated user (if not existing)
#REMOVEME? ynh_system_user_create --username=$app --home_dir="$install_dir"
#================================================= #=================================================
# RESTORE THE APP MAIN DIR # RESTORE THE APP MAIN DIR
@ -86,12 +50,12 @@ ynh_systemd_action --action=restart --service_name=fail2ban
#================================================= #=================================================
# REINSTALL DEPENDENCIES # REINSTALL DEPENDENCIES
#================================================= #=================================================
#REMOVEME? ynh_script_progression --message="Reinstalling dependencies..." --weight=60 ynh_script_progression --message="Reinstalling dependencies..." --weight=60
if [ "$export" = "abiword" ]; then if [ "$export" = "abiword" ]; then
#REMOVEME? ynh_exec_warn_less ynh_install_app_dependencies $abiword_app_depencencies ynh_exec_warn_less ynh_install_app_dependencies $abiword_app_depencencies
elif [ "$export" = "libreoffice" ]; then elif [ "$export" = "libreoffice" ]; then
#REMOVEME? ynh_exec_warn_less ynh_install_app_dependencies $libreoffice_app_dependencies ynh_exec_warn_less ynh_install_app_dependencies $libreoffice_app_dependencies
fi fi
ynh_install_nodejs --nodejs_version=$nodejs_version ynh_install_nodejs --nodejs_version=$nodejs_version
ynh_use_nodejs ynh_use_nodejs
@ -106,10 +70,8 @@ ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
#================================================= #=================================================
# RESTORE THE MYSQL DATABASE # RESTORE THE MYSQL DATABASE
#================================================= #=================================================
#REMOVEME? ynh_script_progression --message="Restoring the MySQL database..." --weight=2 ynh_script_progression --message="Restoring the MySQL database..." --weight=2
#REMOVEME? db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd)
#REMOVEME? ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd
echo "ALTER DATABASE $db_name CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci" | ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name echo "ALTER DATABASE $db_name CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci" | ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name
ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./db.sql ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./db.sql

View file

@ -12,35 +12,24 @@ source /usr/share/yunohost/helpers
#================================================= #=================================================
# LOAD SETTINGS # LOAD SETTINGS
#================================================= #=================================================
#REMOVEME? ynh_script_progression --message="Loading installation settings..." --weight=20 ynh_script_progression --message="Loading installation settings..." --weight=20
#REMOVEME? app=$YNH_APP_INSTANCE_NAME export=$(ynh_app_setting_get --app=$app --key=export)
password=$(ynh_app_setting_get --app=$app --key=password)
#REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain) mypads=$(ynh_app_setting_get --app=$app --key=mypads)
#REMOVEME? path=$(ynh_app_setting_get --app=$app --key=path) useldap=$(ynh_app_setting_get --app=$app --key=useldap)
#REMOVEME? language=$(ynh_app_setting_get --app=$app --key=language) abiword=$(ynh_app_setting_get --app=$app --key=abiword)
#REMOVEME? admin=$(ynh_app_setting_get --app=$app --key=admin) overwrite_settings=$(ynh_app_setting_get --app=$app --key=overwrite_settings)
#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir) overwrite_credentials=$(ynh_app_setting_get --app=$app --key=overwrite_credentials)
#REMOVEME? port=$(ynh_app_setting_get --app=$app --key=port) overwrite_nginx=$(ynh_app_setting_get --app=$app --key=overwrite_nginx)
#REMOVEME? export=$(ynh_app_setting_get --app=$app --key=export) overwrite_systemd=$(ynh_app_setting_get --app=$app --key=overwrite_systemd)
#REMOVEME? db_name=$(ynh_app_setting_get --app=$app --key=db_name)
#REMOVEME? db_user=$db_name
#REMOVEME? db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd)
#REMOVEME? password=$(ynh_app_setting_get --app=$app --key=password)
#REMOVEME? mypads=$(ynh_app_setting_get --app=$app --key=mypads)
#REMOVEME? useldap=$(ynh_app_setting_get --app=$app --key=useldap)
#REMOVEME? abiword=$(ynh_app_setting_get --app=$app --key=abiword)
#REMOVEME? overwrite_settings=$(ynh_app_setting_get --app=$app --key=overwrite_settings)
#REMOVEME? overwrite_credentials=$(ynh_app_setting_get --app=$app --key=overwrite_credentials)
#REMOVEME? overwrite_nginx=$(ynh_app_setting_get --app=$app --key=overwrite_nginx)
#REMOVEME? overwrite_systemd=$(ynh_app_setting_get --app=$app --key=overwrite_systemd)
# Optional parameters from config-panel feature # Optional parameters from config-panel feature
#REMOVEME? pad_config_nocolors=$(ynh_app_setting_get --app=$app --key=pad_config_nocolors) pad_config_nocolors=$(ynh_app_setting_get --app=$app --key=pad_config_nocolors)
#REMOVEME? pad_config_showlinenumbers=$(ynh_app_setting_get --app=$app --key=pad_config_showlinenumbers) pad_config_showlinenumbers=$(ynh_app_setting_get --app=$app --key=pad_config_showlinenumbers)
#REMOVEME? pad_config_chatandusers=$(ynh_app_setting_get --app=$app --key=pad_config_chatandusers) pad_config_chatandusers=$(ynh_app_setting_get --app=$app --key=pad_config_chatandusers)
#REMOVEME? pad_config_alwaysshowchat=$(ynh_app_setting_get --app=$app --key=pad_config_alwaysshowchat) pad_config_alwaysshowchat=$(ynh_app_setting_get --app=$app --key=pad_config_alwaysshowchat)
#REMOVEME? pad_config_show_markdown=$(ynh_app_setting_get --app=$app --key=pad_config_show_markdown) pad_config_show_markdown=$(ynh_app_setting_get --app=$app --key=pad_config_show_markdown)
#================================================= #=================================================
# CHECK VERSION # CHECK VERSION
@ -52,20 +41,6 @@ ynh_systemd_action --action=restart --line_match="You can access your Etherpad i
upgrade_type=$(ynh_check_app_version_changed) upgrade_type=$(ynh_check_app_version_changed)
#=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
#=================================================
#REMOVEME? ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --weight=35
# Backup the current version of the app
#REMOVEME? ynh_backup_before_upgrade
#REMOVEME? ynh_clean_setup () {
# Restore it if the upgrade fails
#REMOVEME? ynh_restore_upgradebackup
}
# Exit if an error occurs during the execution of the script
#REMOVEME? ynh_abort_if_errors
#================================================= #=================================================
# ACTIVATE MAINTENANCE MODE # ACTIVATE MAINTENANCE MODE
#================================================= #=================================================
@ -111,7 +86,7 @@ fi
# If export setting doesn't exist # If export setting doesn't exist
if [ -z "$export" ]; then if [ -z "$export" ]; then
export=none export=none
#REMOVEME? ynh_app_setting_set --app=$app --key=export --value=$export ynh_app_setting_set --app=$app --key=export --value=$export
fi fi
# If mypads setting doesn't exist # If mypads setting doesn't exist
@ -129,7 +104,7 @@ fi
# If path setting doesn't exist # If path setting doesn't exist
if [ -z "$path" ]; then if [ -z "$path" ]; then
path="/" path="/"
#REMOVEME? ynh_app_setting_set --app=$app --key=path --value=$path ynh_app_setting_set --app=$app --key=path --value=$path
fi fi
# If overwrite_settings doesn't exist, create it # If overwrite_settings doesn't exist, create it
@ -156,34 +131,10 @@ if [ -z "$overwrite_systemd" ]; then
ynh_app_setting_set --app=$app --key=overwrite_systemd --value=$overwrite_systemd ynh_app_setting_set --app=$app --key=overwrite_systemd --value=$overwrite_systemd
fi fi
# Cleaning legacy permissions
#REMOVEME? if ynh_legacy_permissions_exists; then
#REMOVEME? ynh_legacy_permissions_delete_all
ynh_app_setting_delete --app=$app --key=is_public
fi
#REMOVEME? if ! ynh_permission_exists --permission="admin"; then
# Create the required permissions
#REMOVEME? ynh_permission_create --permission="admin" --url="/admin" --allowed=$admin
else
# Make sure the admin panel is not exposed to the SSO's authentication headers
# AFAIK there is no helper to check if that flag is up or not, so let's force it.
ynh_permission_url --permission="admin" --auth_header=false
fi
# Support full Unicode in MySQL databases # Support full Unicode in MySQL databases
ynh_mysql_connect_as --user=$db_user --password="$db_pwd" --database=$db_name \ ynh_mysql_connect_as --user=$db_user --password="$db_pwd" --database=$db_name \
<<< "ALTER DATABASE $db_name CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;" <<< "ALTER DATABASE $db_name CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;"
#=================================================
# CREATE DEDICATED USER
#=================================================
#REMOVEME? ynh_script_progression --message="Making sure dedicated system user exists..." --weight=1
# Create a dedicated user (if not existing)
#REMOVEME? ynh_system_user_create --username=$app --home_dir="$install_dir"
#================================================= #=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE # DOWNLOAD, CHECK AND UNPACK SOURCE
#================================================= #=================================================
@ -203,12 +154,12 @@ chown -R $app:$app "$install_dir"
#================================================= #=================================================
# UPGRADE DEPENDENCIES # UPGRADE DEPENDENCIES
#================================================= #=================================================
#REMOVEME? ynh_script_progression --message="Upgrading dependencies..." --weight=5 ynh_script_progression --message="Upgrading dependencies..." --weight=5
if [ "$export" = "abiword" ]; then if [ "$export" = "abiword" ]; then
#REMOVEME? ynh_exec_warn_less ynh_install_app_dependencies $abiword_app_depencencies ynh_exec_warn_less ynh_install_app_dependencies $abiword_app_depencencies
elif [ "$export" = "libreoffice" ]; then elif [ "$export" = "libreoffice" ]; then
#REMOVEME? ynh_exec_warn_less ynh_install_app_dependencies $libreoffice_app_dependencies ynh_exec_warn_less ynh_install_app_dependencies $libreoffice_app_dependencies
fi fi
ynh_install_nodejs --nodejs_version=$nodejs_version ynh_install_nodejs --nodejs_version=$nodejs_version
@ -410,13 +361,6 @@ ynh_script_progression --message="Reconfiguring Fail2Ban..." --weight=8
# Create a dedicated Fail2Ban config # Create a dedicated Fail2Ban config
ynh_add_fail2ban_config --logpath="/var/log/nginx/$domain-access.log" --failregex="<HOST> .* .POST /mypads/api/auth/login HTTP/1.1. 400" --max_retry=5 ynh_add_fail2ban_config --logpath="/var/log/nginx/$domain-access.log" --failregex="<HOST> .* .POST /mypads/api/auth/login HTTP/1.1. 400" --max_retry=5
#=================================================
# RELOAD NGINX
#=================================================
#REMOVEME? ynh_script_progression --message="Reloading NGINX web server..." --weight=1
#REMOVEME? ynh_systemd_action --service_name=nginx --action=reload
#================================================= #=================================================
# DEACTIVE MAINTENANCE MODE # DEACTIVE MAINTENANCE MODE
#================================================= #=================================================

35
tests.toml Normal file
View file

@ -0,0 +1,35 @@
test_format = 1.0
[default]
# -------------------------------
# Default args to use for install
# -------------------------------
args.export = "libreoffice"
args.mypads = 1
args.useldap = 1
# -------------------------------
# Commits to test upgrade from
# -------------------------------
test_upgrade_from.4d613658.name = "Upgrade from 1.8.17"
# This is an additional test suite
[sans_MyPads]
args.export = "libreoffice"
args.mypads = 0
args.useldap = 0
[Abiword]
args.export = "abiword"
args.mypads = 1
args.useldap = 1
[sans_export]
args.export = "none"
args.mypads = 1
args.useldap = 0