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
|
||||
#=================================================
|
||||
|
||||
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
|
||||
ynh_abort_if_errors
|
||||
|
||||
|
@ -43,70 +47,72 @@ test ! -d $final_path \
|
|||
#=================================================
|
||||
# STANDARD RESTORE STEPS
|
||||
#=================================================
|
||||
ynh_restore
|
||||
|
||||
#=================================================
|
||||
# CREATE DEDICATED USER
|
||||
# RESTORE THE NGINX CONFIGURATION
|
||||
#=================================================
|
||||
|
||||
# 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"
|
||||
|
||||
#=================================================
|
||||
# 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
|
||||
|
||||
# Install mongodb
|
||||
ynh_install_app_dependencies "mongodb mongodb-server"
|
||||
|
||||
#=================================================
|
||||
# RESTORE DB
|
||||
# RESTORE THE MONGODB DATABASE
|
||||
#=================================================
|
||||
|
||||
# Start mogodb
|
||||
systemctl enable mongodb
|
||||
systemctl start mongodb
|
||||
mongorestore --db $db_name ./dump/$app
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC SETUP
|
||||
# RESTORE SYSTEMD
|
||||
#=================================================
|
||||
|
||||
# Install wekan dependencies
|
||||
#chown -R $app $final_path
|
||||
#pushd $final_path/programs/server
|
||||
#ynh_use_nodejs
|
||||
#npm install
|
||||
#popd
|
||||
ynh_restore_file "/etc/systemd/system/$app.service"
|
||||
systemctl enable $app.service
|
||||
|
||||
#=================================================
|
||||
# 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 $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
|
||||
#=================================================
|
||||
|
|
Loading…
Add table
Reference in a new issue