aboutsummaryrefslogtreecommitdiff
path: root/scripts/restore
diff options
context:
space:
mode:
authoryalh76 <yalh@yahoo.com>2021-04-23 13:05:33 +0200
committerGitHub <noreply@github.com>2021-04-23 13:05:33 +0200
commit27e1471e45b09cbe188eab46ecbff2079a6ba4a0 (patch)
treeabd1fafb44d4830bb7e75da7f8a3e0fa3e19401f /scripts/restore
parenta7eb98db3fac0697b923072dcd78c1ca04bf0a12 (diff)
parente2a23d46f649505a9ece78e1b3e4f0fd73196539 (diff)
downloadmastodon_ynh-27e1471e45b09cbe188eab46ecbff2079a6ba4a0.tar.gz
mastodon_ynh-27e1471e45b09cbe188eab46ecbff2079a6ba4a0.tar.bz2
mastodon_ynh-27e1471e45b09cbe188eab46ecbff2079a6ba4a0.zip
Merge pull request #263 from YunoHost-Apps/testing
ynh_install_ruby__2
Diffstat (limited to 'scripts/restore')
-rw-r--r--scripts/restore57
1 files changed, 27 insertions, 30 deletions
diff --git a/scripts/restore b/scripts/restore
index 6744ddb..7a3808b 100644
--- a/scripts/restore
+++ b/scripts/restore
@@ -6,7 +6,7 @@
# IMPORT GENERIC HELPERS
#=================================================
-#Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
+# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
source ../settings/scripts/_common.sh
source ../settings/scripts/ynh_install_ruby__2
source ../settings/scripts/ynh_add_swap
@@ -25,7 +25,7 @@ ynh_abort_if_errors
#=================================================
# LOAD SETTINGS
#=================================================
-ynh_script_progression --message="Loading settings..."
+ynh_script_progression --message="Loading installation settings..."
app=$YNH_APP_INSTANCE_NAME
@@ -51,32 +51,28 @@ test ! -d $final_path \
#=================================================
# RESTORE THE NGINX CONFIGURATION
#=================================================
-ynh_script_progression --message="Restoring 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 APP MAIN DIR
-#=================================================
-ynh_script_progression --message="Restoring the app main directory..."
-
-ynh_restore_file --origin_path="$final_path"
-
-#=================================================
# RECREATE THE DEDICATED USER
#=================================================
ynh_script_progression --message="Recreating the dedicated system user..."
# Create the dedicated user (if not existing)
-ynh_system_user_create --username=$app --home_dir=$final_path
+ynh_system_user_create --username=$app --home_dir="$final_path"
#=================================================
-# RESTORE USER RIGHTS
+# RESTORE THE APP MAIN DIR
#=================================================
-ynh_script_progression --message="Restoring user rights..."
+ynh_script_progression --message="Restoring the app main directory..."
+
+ynh_restore_file --origin_path="$final_path"
-# Restore permissions on app files
-chown -R $app: $final_path
+chmod 750 "$final_path"
+chmod -R o-rwx "$final_path"
+chown -R $app:www-data "$final_path"
#=================================================
# SPECIFIC RESTORATION
@@ -97,23 +93,31 @@ ynh_script_progression --message="Adding $swap_needed Mo to swap..."
ynh_add_swap --size=$swap_needed
#=================================================
+# RESTORE THE CRON FILE
+#=================================================
+ynh_script_progression --message="Restoring the cron file..."
+
+ynh_restore_file --origin_path="/etc/cron.d/$app"
+
+#=================================================
# REINSTALL DEPENDENCIES
#=================================================
ynh_script_progression --message="Reinstalling dependencies..."
+ynh_install_app_dependencies $pkg_dependencies
ynh_install_nodejs --nodejs_version=$NODEJS_VERSION
-ynh_install_app_dependencies $pkg_dependencies
ynh_install_extra_app_dependencies --repo="deb https://dl.yarnpkg.com/debian/ stable main" --package="yarn" --key="https://dl.yarnpkg.com/debian/pubkey.gpg"
+ynh_install_ruby --ruby_version=$RUBY_VERSION
#=================================================
# INSTALLING RUBY AND BUNDLER
#=================================================
ynh_script_progression --message="Installing Ruby..."
-ynh_install_ruby --ruby_version=$RUBY_VERSION
pushd "$final_path/live"
- gem update --system
- gem install bundler:$BUNDLER_VERSION --no-document
+ ynh_use_ruby
+ ynh_gem update --system
+ ynh_gem install bundler --no-document
popd
#=================================================
@@ -141,27 +145,20 @@ systemctl enable "$app-web" "$app-sidekiq" "$app-streaming" --quiet
#=================================================
ynh_script_progression --message="Integrating service in YunoHost..."
-yunohost service add "$app-web" --description "$app web service"
-yunohost service add "$app-sidekiq" --description "$app sidekiq service"
-yunohost service add "$app-streaming" --description "$app streaming service"
+yunohost service add "$app-web" --description="$app web service"
+yunohost service add "$app-sidekiq" --description="$app sidekiq service"
+yunohost service add "$app-streaming" --description="$app streaming service"
#=================================================
# START SYSTEMD SERVICE
#=================================================
ynh_script_progression --message="Starting a systemd service..."
-ynh_systemd_action --service_name=${app}-web --action="start" --log_path=systemd --line_match="Listening on tcp"
+ynh_systemd_action --service_name=${app}-web --action="start" --log_path=systemd --line_match="Listening on"
ynh_systemd_action --service_name=${app}-sidekiq --action="start" --log_path=systemd --line_match="Schedules Loaded"
ynh_systemd_action --service_name=${app}-streaming --action="start" --log_path=systemd --line_match="Worker 1 now listening"
#=================================================
-# RESTORE THE CRON FILE
-#=================================================
-ynh_script_progression --message="Restoring the cron file..."
-
-ynh_restore_file --origin_path="/etc/cron.d/$app"
-
-#=================================================
# GENERIC FINALIZATION
#=================================================
# RELOAD NGINX