From 185a8c7ad0ff664f02609de1890f8032446fc020 Mon Sep 17 00:00:00 2001 From: Augustin Trancart Date: Sun, 5 Jul 2020 19:14:29 +0200 Subject: [PATCH] Upgrade diaspora to v0.7.14.0 --- check_process | 1 + conf/nginx.conf | 1 - manifest.json | 4 +-- scripts/_common.sh | 2 ++ scripts/create_services | 27 +++++---------- scripts/install | 5 ++- scripts/restore | 5 ++- scripts/upgrade | 74 ++++++++++++++++++++++++++++++++++++++--- 8 files changed, 91 insertions(+), 28 deletions(-) diff --git a/check_process b/check_process index 3e7dc67..1537b65 100644 --- a/check_process +++ b/check_process @@ -11,6 +11,7 @@ setup_nourl=0 upgrade=1 upgrade=1 from_commit=0.7.13.0-ynh1 + upgrade=1 from_commit=0.7.13.0-ynh2 backup_restore=1 multi_instance=1 port_already_use=0 diff --git a/conf/nginx.conf b/conf/nginx.conf index 46e560a..79d3af4 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -17,7 +17,6 @@ location / { } # Include SSOWAT user panel. -# TODO check that include conf.d/yunohost_panel.conf.inc; } diff --git a/manifest.json b/manifest.json index 6153413..61d2445 100644 --- a/manifest.json +++ b/manifest.json @@ -8,13 +8,13 @@ "fr": "Service de réseau social distribué" }, "license": "AGPL-3.0", - "version": "0.7.13.0~ynh1", + "version": "0.7.14.0~ynh1", "maintainer": { "name": "rafi59", "email": "" }, "requirements": { - "yunohost": ">= 3.6.0" + "yunohost": ">= 3.7.0" }, "multi_instance": true, "services": [ diff --git a/scripts/_common.sh b/scripts/_common.sh index 01640c8..555fe3e 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -1,3 +1,5 @@ #!/bin/bash pkg_dependencies="build-essential cmake libssl-dev libcurl4-openssl-dev libxml2-dev libxslt-dev imagemagick ghostscript curl libmagickwand-dev git libpq-dev redis-server nodejs postgresql bison " ruby_build_dependencies="bison libffi-dev libgdbm-dev libncurses5-dev libsqlite3-dev libyaml-dev pkg-config sqlite3 zlib1g-dev libgmp-dev libreadline-dev libssl-dev libjemalloc-dev" + +current_tag="v0.7.14.0" diff --git a/scripts/create_services b/scripts/create_services index 5fb4d56..5b4255c 100644 --- a/scripts/create_services +++ b/scripts/create_services @@ -19,22 +19,11 @@ systemctl daemon-reload systemd-tmpfiles --create systemctl enable ${app}.target ${app}_sidekiq.service ${app}_web.service systemctl restart ${app}.target - -# wait for startup -timeout=100 -for i in $(seq 1 $timeout) -do - # Read the log until the sentence is found, that means the app finished to start. Or run until the timeout - if grep --extended-regexp --quiet "listening on addr" "$final_path/diaspora/log/unicorn-stderr.log" - then - ynh_print_info --message="Diaspora* is up and running\!" - break - fi - if [ $i -eq 3 ]; then - echo -n "Please wait, diaspora* is starting" >&2 - fi - if [ $i -ge 3 ]; then - echo -n "." >&2 - fi - sleep 1 -done +ynh_systemd_action --service_name=${app}_web.service \ + --action=restart\ + --log_path="$final_path/diaspora/log/production.log" \ + --line_match="Starting processing" +ynh_systemd_action --service_name=${app}_sidekiq.service \ + --action=restart\ + --log_path="$final_path/diaspora/log/unicorn-stderr.log" \ + --line_match="listening on addr" diff --git a/scripts/install b/scripts/install index 6f8b1b7..4cf1c6c 100755 --- a/scripts/install +++ b/scripts/install @@ -24,6 +24,9 @@ source /usr/share/yunohost/helpers # MANAGE SCRIPT FAILURE #================================================= # Exit if an error occurs during the execution of the script +ynh_clean_setup() { + ynh_clean_check_starting +} ynh_abort_if_errors #================================================= @@ -100,7 +103,7 @@ source ./install_ruby # Download, check integrity, unucompress and patch the source from app.src pushd $final_path ynh_script_progression --message="Download the sources..." --weight=16 -sudo -u $app git clone https://github.com/diaspora/diaspora.git -b v0.7.13.0 +sudo -u $app git clone https://github.com/diaspora/diaspora.git -b $current_tag popd #================================================= diff --git a/scripts/restore b/scripts/restore index 90551d1..be8a532 100644 --- a/scripts/restore +++ b/scripts/restore @@ -19,6 +19,9 @@ pushd $(readlink -f ../settings/scripts) #================================================= # Exit if an error occurs during the execution of the script +ynh_clean_setup() { + ynh_clean_check_starting +} ynh_abort_if_errors #================================================= @@ -77,7 +80,7 @@ source ./install_ruby # Download, check integrity, unucompress and patch the source from app.src pushd $final_path ynh_script_progression --message="Download the sources..." --weight=16 -sudo -u $app git clone https://github.com/diaspora/diaspora.git -b v0.7.13.0 +sudo -u $app git clone https://github.com/diaspora/diaspora.git -b $current_tag popd #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 9fb9430..0dbec14 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -7,6 +7,7 @@ #================================================= # IMPORT GENERIC HELPERS +source _common.sh source /usr/share/yunohost/helpers #================================================= @@ -20,17 +21,82 @@ domain=$(ynh_app_setting_get --app $app --key domain) admin=$(ynh_app_setting_get --app $app --key admin) final_path=$(ynh_app_setting_get --app $app --key final_path) +ynh_clean_setup() { + ynh_clean_check_starting +} ynh_abort_if_errors - #================================================= # Check upgrade type #================================================= ynh_script_progression --message="Check upgrade type..." upgrade_type=$(ynh_check_app_version_changed) -# nothing to do yet!! + +#================================================= +# Stop services +#================================================= +ynh_script_progression --message="Stop services..." +systemctl stop $app.target + +#================================================= +# INSTALL DEPENDENCIES +#================================================= +ynh_script_progression --message="Installing dependencies..." +ynh_install_app_dependencies $pkg_dependencies $ruby_build_dependencies + +#================================================= +# ENSURE DOWNWARD COMPATIBILITY +#================================================= +# migrate from rvm to rbenv +ynh_script_progression --message="Remove rvm..." +if [ -e "$final_path/.rvm" ]; then + sudo -u $app --login << EOF +rvm implode --force +EOF +fi +source ./install_ruby +# remove old gpg keys for rvm +ynh_script_progression --message="Remove old rvm keys..." +if gpg --list-keys mpapis@gmail.com >/dev/null 2>&1; then + ynh_print_info --message="Found mpapis key: deleting" + sudo -u $app gpg --delete-keys mpapis@gmail.com + ynh_secure_remove "$final_path/mpapis@gmail.com.pgp" +fi +if gpg --list-keys piotr.kuczynski@gmail.com >/dev/null 2>&1; then + ynh_print_info --message="Found piotr.kuczynski: deleting" + sudo -u $app gpg --delete-keys piotr.kuczynski@gmail.com + ynh_secure_remove "$final_path/piotr.kuczynski@gmail.com.pgp" +fi + +if [ "$upgrade_type" == "UPGRADE_APP" ]; +then + upgrade_message="Upgrading this app and upstream to $current_tag" +else + upgrade_message="Shallow upgrade of yunohost app" +fi +ynh_script_progression --message=$upgrade_message if [ "$upgrade_type" == "UPGRADE_APP" ] then - # do something! - echo "to be implemented" + # revert local change to .ruby-version + pushd $final_path/diaspora + git checkout -- .ruby-version + git fetch + git checkout $current_tag + popd + source ./bundle_app fi + +#================================================= +# restart services +#================================================= +ynh_script_progression --message="Recreate and start services..." +source ./create_services + +#================================================= +# NGINX CONFIGURATION +#================================================= +# Create a dedicated nginx config +ynh_script_progression --message="configure nginx..." --weight=1 +ynh_add_nginx_config + +