mirror of
https://github.com/YunoHost-Apps/etherpad_mypads_ynh.git
synced 2024-09-03 18:36:09 +02:00
Apply example_ynh
This commit is contained in:
parent
6f6f208092
commit
e5216fb63b
3 changed files with 46 additions and 54 deletions
|
@ -148,8 +148,6 @@ ynh_script_progression --message="Configuring log rotation..."
|
|||
# Create log directory
|
||||
mkdir -p /var/log/$app
|
||||
touch /var/log/$app/etherpad.log
|
||||
install_log=/var/log/$app/installation.log
|
||||
touch $install_log
|
||||
chown $app -R /var/log/$app
|
||||
|
||||
#=================================================
|
||||
|
@ -185,8 +183,12 @@ fi
|
|||
ynh_store_file_checksum --file="$final_path/settings.json"
|
||||
|
||||
ynh_add_config --template="../conf/credentials.json" --destination="$final_path/credentials.json"
|
||||
# Restrict access to credentials.json
|
||||
chmod 600 $final_path/credentials.json
|
||||
|
||||
chmod 600 "$final_path/settings.json"
|
||||
chown $app:$app "$final_path/settings.json"
|
||||
|
||||
chmod 600 "$final_path/credentials.json"
|
||||
chown $app:$app "$final_path/credentials.json"
|
||||
|
||||
#=================================================
|
||||
# SETUP SYSTEMD
|
||||
|
|
|
@ -45,22 +45,8 @@ ynh_script_progression --message="Validating restoration parameters..."
|
|||
test ! -d $final_path \
|
||||
|| ynh_die --message="There is already a directory: $final_path "
|
||||
|
||||
#=================================================
|
||||
# ACTIVATE MAINTENANCE MODE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Activating maintenance mode..." --weight=2
|
||||
|
||||
ynh_maintenance_mode_ON
|
||||
|
||||
#=================================================
|
||||
# STANDARD RESTORATION STEPS
|
||||
#=================================================
|
||||
# RESTORE THE NGINX CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restoring the NGINX web server configuration..."
|
||||
|
||||
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||
|
||||
#=================================================
|
||||
# RECREATE THE DEDICATED USER
|
||||
#=================================================
|
||||
|
@ -80,28 +66,21 @@ chmod 750 "$final_path"
|
|||
chmod -R o-rwx "$final_path"
|
||||
chown -R $app:$app "$final_path"
|
||||
|
||||
chmod 600 "$final_path/settings.json"
|
||||
chown $app:$app "$final_path/settings.json"
|
||||
|
||||
chmod 600 "$final_path/credentials.json"
|
||||
chown $app:$app "$final_path/credentials.json"
|
||||
|
||||
#=================================================
|
||||
# RESTORE FAIL2BAN CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restoring the Fail2Ban configuration..." --weight=6
|
||||
|
||||
ynh_restore_file "/etc/fail2ban/jail.d/$app.conf"
|
||||
ynh_restore_file "/etc/fail2ban/filter.d/$app.conf"
|
||||
ynh_restore_file --origin_path="/etc/fail2ban/jail.d/$app.conf"
|
||||
ynh_restore_file --origin_path="/etc/fail2ban/filter.d/$app.conf"
|
||||
ynh_systemd_action --action=restart --service_name=fail2ban
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC RESTORE
|
||||
#=================================================
|
||||
# HANDLE LOG FILES AND LOGROTATE
|
||||
#=================================================
|
||||
|
||||
mkdir -p /var/log/$app
|
||||
touch /var/log/$app/etherpad.log
|
||||
install_log=/var/log/$app/installation.log
|
||||
touch $install_log
|
||||
chown $app -R /var/log/$app
|
||||
chown admin -R $install_log
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC RESTORATION
|
||||
#=================================================
|
||||
|
@ -115,6 +94,14 @@ elif [ "$export" = "libreoffice" ]; then
|
|||
ynh_exec_warn_less ynh_install_app_dependencies $libreoffice_app_dependencies
|
||||
fi
|
||||
ynh_install_nodejs --nodejs_version=$nodejs_version
|
||||
ynh_use_nodejs
|
||||
|
||||
#=================================================
|
||||
# RESTORE THE NGINX CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restoring the NGINX web server configuration..."
|
||||
|
||||
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||
|
||||
#=================================================
|
||||
# RESTORE THE MYSQL DATABASE
|
||||
|
@ -126,6 +113,14 @@ 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
|
||||
ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./db.sql
|
||||
|
||||
#=================================================
|
||||
# HANDLE LOG FILES AND LOGROTATE
|
||||
#=================================================
|
||||
|
||||
mkdir -p /var/log/$app
|
||||
touch /var/log/$app/etherpad.log
|
||||
chown $app -R /var/log/$app
|
||||
|
||||
#=================================================
|
||||
# RESTORE SYSTEMD
|
||||
#=================================================
|
||||
|
@ -164,13 +159,6 @@ ynh_script_progression --message="Reloading NGINX web server..."
|
|||
|
||||
ynh_systemd_action --action=reload --service_name=nginx
|
||||
|
||||
#=================================================
|
||||
# DEACTIVE MAINTENANCE MODE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Disabling maintenance mode..." --weight=7
|
||||
|
||||
ynh_maintenance_mode_OFF
|
||||
|
||||
#=================================================
|
||||
# SEND A README FOR THE ADMIN
|
||||
#=================================================
|
||||
|
|
|
@ -44,7 +44,7 @@ pad_config_show_markdown=$(ynh_app_setting_get --app=$app --key=pad_config_show_
|
|||
#=================================================
|
||||
# CHECK VERSION
|
||||
#=================================================
|
||||
nh_script_progression --message="Checking version..."
|
||||
ynh_script_progression --message="Checking version..."
|
||||
|
||||
# Wait for etherpad to be fully started
|
||||
ynh_systemd_action --action=restart --line_match="You can access your Etherpad instance at" --log_path="/var/log/$app/etherpad.log" --timeout="120"
|
||||
|
@ -196,17 +196,6 @@ chmod 750 "$final_path"
|
|||
chmod -R o-rwx "$final_path"
|
||||
chown -R $app:$app "$final_path"
|
||||
|
||||
#=================================================
|
||||
# NGINX CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=2
|
||||
|
||||
# Overwrite the NGINX configuration only if it's allowed
|
||||
if [ $overwrite_nginx -eq 1 ]
|
||||
then
|
||||
ynh_add_nginx_config
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# UPGRADE DEPENDENCIES
|
||||
#=================================================
|
||||
|
@ -221,6 +210,17 @@ fi
|
|||
ynh_install_nodejs --nodejs_version=$nodejs_version
|
||||
ynh_use_nodejs
|
||||
|
||||
#=================================================
|
||||
# NGINX CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=2
|
||||
|
||||
# Overwrite the NGINX configuration only if it's allowed
|
||||
if [ $overwrite_nginx -eq 1 ]
|
||||
then
|
||||
ynh_add_nginx_config
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC UPGRADE
|
||||
#=================================================
|
||||
|
@ -229,8 +229,6 @@ ynh_use_nodejs
|
|||
ynh_script_progression --message="Configuring log rotation..." --weight=1
|
||||
|
||||
# Create log directory
|
||||
install_log=/var/log/$app/installation.log
|
||||
touch $install_log
|
||||
chown $app -R /var/log/$app
|
||||
|
||||
#=================================================
|
||||
|
@ -304,7 +302,11 @@ then
|
|||
fi
|
||||
fi
|
||||
|
||||
chmod 600 "$final_path/settings.json"
|
||||
chown $app:$app "$final_path/settings.json"
|
||||
|
||||
chmod 600 "$final_path/credentials.json"
|
||||
chown $app:$app "$final_path/credentials.json"
|
||||
|
||||
#=================================================
|
||||
# SETUP SYSTEMD
|
||||
|
|
Loading…
Add table
Reference in a new issue