mirror of
https://github.com/YunoHost-Apps/wekan_ynh.git
synced 2024-09-03 20:36:09 +02:00
Apply example_ynh on restore
This commit is contained in:
parent
a72ab627ef
commit
b3eb74c766
1 changed files with 40 additions and 34 deletions
|
@ -15,6 +15,10 @@ source /usr/share/yunohost/helpers
|
||||||
# MANAGE SCRIPT FAILURE
|
# MANAGE SCRIPT FAILURE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
|
ynh_clean_setup () {
|
||||||
|
#### Remove this function if there's nothing to clean before calling the remove script.
|
||||||
|
true
|
||||||
|
}
|
||||||
# Exit if an error occurs during the execution of the script
|
# Exit if an error occurs during the execution of the script
|
||||||
ynh_abort_if_errors
|
ynh_abort_if_errors
|
||||||
|
|
||||||
|
@ -43,70 +47,72 @@ test ! -d $final_path \
|
||||||
#=================================================
|
#=================================================
|
||||||
# STANDARD RESTORE STEPS
|
# STANDARD RESTORE STEPS
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_restore
|
# RESTORE THE NGINX CONFIGURATION
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# CREATE DEDICATED USER
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
# Create a system user
|
ynh_restore_file "/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# RESTORE THE APP MAIN DIR
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
ynh_restore_file "$final_path"
|
||||||
|
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# RECREATE THE DEDICATED USER
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
# Create the dedicated user (if not existing)
|
||||||
ynh_system_user_create $app "$final_path"
|
ynh_system_user_create $app "$final_path"
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# RESTORE USER RIGHTS
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
# Restore permissions on app files
|
||||||
|
chown -R $app: "$final_path"
|
||||||
|
chmod -R 640 "$final_path"
|
||||||
|
find "$final_path" -type d -print0 | xargs -0 chmod 750
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# INSTALL DEPENDENCIES
|
# SPECIFIC RESTORATION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
# REINSTALL DEPENDENCIES
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
# Define and install dependencies
|
||||||
ynh_install_nodejs 8.9.3
|
ynh_install_nodejs 8.9.3
|
||||||
|
|
||||||
# Install mongodb
|
# Install mongodb
|
||||||
ynh_install_app_dependencies "mongodb mongodb-server"
|
ynh_install_app_dependencies "mongodb mongodb-server"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE DB
|
# RESTORE THE MONGODB DATABASE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
# Start mogodb
|
# Start mogodb
|
||||||
systemctl enable mongodb
|
systemctl enable mongodb
|
||||||
systemctl start mongodb
|
systemctl start mongodb
|
||||||
mongorestore --db $db_name ./dump/$app
|
mongorestore --db $db_name ./dump/$app
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SPECIFIC SETUP
|
# RESTORE SYSTEMD
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
# Install wekan dependencies
|
ynh_restore_file "/etc/systemd/system/$app.service"
|
||||||
#chown -R $app $final_path
|
systemctl enable $app.service
|
||||||
#pushd $final_path/programs/server
|
|
||||||
#ynh_use_nodejs
|
|
||||||
#npm install
|
|
||||||
#popd
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# GENERIC FINALIZATION
|
# ADVERTISE SERVICE IN ADMIN PANEL
|
||||||
#=================================================
|
#=================================================
|
||||||
# SECURE FILES AND DIRECTORIES
|
|
||||||
#=================================================
|
|
||||||
# Set strong right permissions to app files
|
|
||||||
chown -R $app: "$final_path"
|
|
||||||
chmod -R 640 "$final_path"
|
|
||||||
find "$final_path" -type d -print0 | xargs -0 chmod 750
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# ADD SERVICE IN ADMIN PANEL
|
|
||||||
#=================================================
|
|
||||||
yunohost service add mongodb --log "/var/log/mongodb/mongodb.log"
|
yunohost service add mongodb --log "/var/log/mongodb/mongodb.log"
|
||||||
yunohost service add $app
|
yunohost service add $app
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# SETUP SSOWAT
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
# Make app public if necessary or protect it
|
|
||||||
if [ $is_public -eq 1 ]
|
|
||||||
then
|
|
||||||
# unprotected_uris allows SSO credentials to be passed anyway.
|
|
||||||
ynh_app_setting_set "$app" unprotected_uris "/"
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# GENERIC FINALIZATION
|
||||||
#=================================================
|
#=================================================
|
||||||
# RELOAD NGINX
|
# RELOAD NGINX
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
Loading…
Add table
Reference in a new issue