From 6e2975f4542d95b3bbf56d4cb56beed9545cc941 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Josu=C3=A9=20Tille?= Date: Tue, 28 Apr 2020 13:57:07 +0200 Subject: [PATCH 01/11] Upgrade to 7.1 and add support for memcached --- conf/create_admin.json | 1 + conf/x86-64.src | 4 +- manifest.json | 4 +- scripts/_common.sh | 15 ++++--- scripts/expect_scripts/install.exp | 4 +- scripts/expect_scripts/upgrade_7.1.exp | 11 ++++++ scripts/install | 54 ++++++++++++-------------- scripts/upgrade | 27 ++++++++++++- 8 files changed, 76 insertions(+), 44 deletions(-) create mode 100644 conf/create_admin.json create mode 100644 scripts/expect_scripts/upgrade_7.1.exp diff --git a/conf/create_admin.json b/conf/create_admin.json new file mode 100644 index 0000000..f38b55c --- /dev/null +++ b/conf/create_admin.json @@ -0,0 +1 @@ +{"email": "__ADMIN__", "password": "__PASSWORD__"} diff --git a/conf/x86-64.src b/conf/x86-64.src index 4bd9e8a..631524b 100644 --- a/conf/x86-64.src +++ b/conf/x86-64.src @@ -1,5 +1,5 @@ -SOURCE_URL=https://download.seadrive.org/seafile-server_7.0.5_x86-64.tar.gz -SOURCE_SUM=7eb8814f1bc8ee78c80741fa08cbdce2b5ea8895a87730bde2a1b32d031e8f53 +SOURCE_URL=https://s3.eu-central-1.amazonaws.com/download.seadrive.org/seafile-server_7.1.3_x86-64.tar.gz +SOURCE_SUM=41e1042984c923636e6bb7c2249bb9b784e42d796303450fe60d05855abce15f # (Optional) Program to check the integrity (sha256sum, md5sum...) # default: sha256 SOURCE_SUM_PRG=sha256sum diff --git a/manifest.json b/manifest.json index e4ce82a..7707bba 100644 --- a/manifest.json +++ b/manifest.json @@ -4,7 +4,7 @@ "packaging_format": 1, "license": "AGPL-3.0,Apache-2.0,MIT,GPL-2.0", "url": "https://www.seafile.com", - "version": "7.0.5~ynh1", + "version": "7.1.3~ynh1", "description": { "en": "Open Source Cloud Storage", "fr": "Stockage Cloud Open Source" @@ -23,7 +23,7 @@ "mysql" ], "requirements": { - "yunohost": ">= 3.5.2.2" + "yunohost": ">= 4.0" }, "arguments": { "install": [ diff --git a/scripts/_common.sh b/scripts/_common.sh index 11167cd..0db2dde 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -20,18 +20,17 @@ install_source() { } install_dependance() { - if [ "$(lsb_release --codename --short)" == "stretch" ]; then - ynh_install_app_dependencies python2.7 python-pip libpython2.7 python-setuptools python-ldap python-urllib3 python-simplejson python-imaging python-mysqldb python-flup expect python-requests python-dev ffmpeg python-memcache \ - libjpeg62-turbo-dev zlib1g-dev # For building pillow - else - ynh_install_app_dependencies python2.7 python-pip libpython2.7 python-setuptools python-ldap python-urllib3 python-simplejson python-pil python-mysqldb python-flup expect python-requests python-dev ffmpeg python-memcache \ - libjpeg62-turbo-dev zlib1g-dev # For building pillow - fi + ynh_install_app_dependencies python3 python3-setuptools python3-pip python3-requests python3-dev \ + expect ffmpeg \ + memcached libmemcached-dev \ + libjpeg62-turbo-dev zlib1g-dev # For building pillow ynh_add_swap 2000 # We need to do that because we can have some issue about the permission access to the pip cache without this set_permission # Note that we install imageio to force the dependance, without this imageio 2.8 is installed and it need python3.5 - sudo -u $seafile_user pip install --user --upgrade Pillow 'moviepy<1.0' 'imageio<2.8' certifi idna + sudo -u $seafile_user pip3 install --user --upgrade Pillow pylibmc captcha jinja2 sqlalchemy psd-tools \ + django-pylibmc django-simple-captcha python3-ldap \ + pylibmc django-pylibmc # Memcached support ynh_del_swap } diff --git a/scripts/expect_scripts/install.exp b/scripts/expect_scripts/install.exp index 03db5eb..b2d25d5 100644 --- a/scripts/expect_scripts/install.exp +++ b/scripts/expect_scripts/install.exp @@ -19,8 +19,8 @@ send "$server_name\r"; expect "What is the ip or domain of the server?" send "$domain\r"; -expect "Where do you want to put your seafile data?" -send "$seafile_data\r"; +# expect "Where do you want to put your seafile data?" +# send "$seafile_data\r"; expect "Which port do you want to use for the seafile fileserver?" send "$fileserver_port\r"; diff --git a/scripts/expect_scripts/upgrade_7.1.exp b/scripts/expect_scripts/upgrade_7.1.exp new file mode 100644 index 0000000..c0fe127 --- /dev/null +++ b/scripts/expect_scripts/upgrade_7.1.exp @@ -0,0 +1,11 @@ +#!/usr/bin/expect +set timeout 5 + +set seafile_dir [lindex $argv 0] + +spawn $seafile_dir/upgrade/upgrade_7.0_7.1.sh + +expect "to contiune" +send "\r"; + +interact diff --git a/scripts/install b/scripts/install index c00c158..2a21040 100644 --- a/scripts/install +++ b/scripts/install @@ -71,7 +71,7 @@ ynh_script_progression --message="Creating base directory..." mkdir -p $final_path mkdir -p $final_path/installed mkdir -p $final_path/logs -mkdir -p $final_path/seafile-data +mkdir -p $seafile_data # Create User ynh_script_progression --message="Configuring system user..." @@ -81,10 +81,6 @@ ynh_system_user_create --username $seafile_user --home_dir $final_path ynh_script_progression --message="Installing dependencies..." --weight=7 install_dependance -# Clean data directory -ynh_script_progression --message="Cleaning data directory..." -test -e $seafile_data && ynh_secure_remove --file="$seafile_data" - # Download new version from sources ynh_script_progression --message="Installing sources files..." --weight=7 install_source @@ -102,6 +98,7 @@ ynh_script_progression --message="Configuring application..." --weight=3 chmod +x expect_scripts/install.exp chmod +x $final_path/seafile-server-$seafile_version/setup-seafile-mysql.sh expect_scripts/install.exp "$final_path/seafile-server-$seafile_version" "$server_name" "$domain" "$seafile_data" "$fileserver_port" "$db_pwd" +echo $seafile_data > $final_path/ccnet/seafile.ini # Update seafile config ynh_replace_string --match_string http:// --replace_string https:// --target_file $final_path/conf/ccnet.conf @@ -140,11 +137,28 @@ echo 'LOGIN_ATTR = mail' | tee -a $final_path/conf/ccnet.conf # Enable manually wiki echo 'ENABLE_WIKI = True' | tee -a $final_path/conf/seahub_settings.py +# Enable memcached +cat >> $final_path/conf/seahub_settings.py <= 7.0. If not install and upgrade to 7.0 before !! + + # Enable memcached + cat > $final_path/conf/seahub_settings.py < Date: Thu, 30 Apr 2020 17:59:45 +0200 Subject: [PATCH 02/11] Use symbolic link for seafile_data path --- scripts/install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/install b/scripts/install index 2a21040..460b122 100644 --- a/scripts/install +++ b/scripts/install @@ -72,6 +72,7 @@ mkdir -p $final_path mkdir -p $final_path/installed mkdir -p $final_path/logs mkdir -p $seafile_data +ln -s $seafile_data $final_path/seafile_data # Create User ynh_script_progression --message="Configuring system user..." @@ -98,7 +99,6 @@ ynh_script_progression --message="Configuring application..." --weight=3 chmod +x expect_scripts/install.exp chmod +x $final_path/seafile-server-$seafile_version/setup-seafile-mysql.sh expect_scripts/install.exp "$final_path/seafile-server-$seafile_version" "$server_name" "$domain" "$seafile_data" "$fileserver_port" "$db_pwd" -echo $seafile_data > $final_path/ccnet/seafile.ini # Update seafile config ynh_replace_string --match_string http:// --replace_string https:// --target_file $final_path/conf/ccnet.conf From 7d8129b24449d5e8e7958d2772aa8a763f4d99fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Josu=C3=A9=20Tille?= Date: Fri, 1 May 2020 15:39:29 +0200 Subject: [PATCH 03/11] Improve upgrade management --- conf/arm_7_0.src | 11 +++++++++++ conf/x86-64_7_0.src | 11 +++++++++++ scripts/_common.sh | 11 +++++++++++ scripts/upgrade | 13 ++++++++++--- 4 files changed, 43 insertions(+), 3 deletions(-) create mode 100644 conf/arm_7_0.src create mode 100644 conf/x86-64_7_0.src diff --git a/conf/arm_7_0.src b/conf/arm_7_0.src new file mode 100644 index 0000000..7cb9b0d --- /dev/null +++ b/conf/arm_7_0.src @@ -0,0 +1,11 @@ +SOURCE_URL=https://github.com/haiwen/seafile-rpi/releases/download/v7.0.5/seafile-server_7.0.5_stable_pi.tar.gz +SOURCE_SUM=dae9ab5d232a2b56f129aa29e7e54d2de05d838f0479955543cebcb14c9417db +# (Optional) Program to check the integrity (sha256sum, md5sum...) +# default: sha256 +SOURCE_SUM_PRG=sha256sum +# (Optional) Archive format +# default: tar.gz +SOURCE_FORMAT=tar.gz +# (Optional) Put false if sources are directly in the archive root +# default: true +SOURCE_IN_SUBDIR=true diff --git a/conf/x86-64_7_0.src b/conf/x86-64_7_0.src new file mode 100644 index 0000000..4bd9e8a --- /dev/null +++ b/conf/x86-64_7_0.src @@ -0,0 +1,11 @@ +SOURCE_URL=https://download.seadrive.org/seafile-server_7.0.5_x86-64.tar.gz +SOURCE_SUM=7eb8814f1bc8ee78c80741fa08cbdce2b5ea8895a87730bde2a1b32d031e8f53 +# (Optional) Program to check the integrity (sha256sum, md5sum...) +# default: sha256 +SOURCE_SUM_PRG=sha256sum +# (Optional) Archive format +# default: tar.gz +SOURCE_FORMAT=tar.gz +# (Optional) Put false if sources are directly in the archive root +# default: true +SOURCE_IN_SUBDIR=true diff --git a/scripts/_common.sh b/scripts/_common.sh index 0db2dde..14044ed 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -19,6 +19,17 @@ install_source() { ynh_setup_source "$final_path/seafile-server-$seafile_version" "$architecture" } +install_source_7_0() { + if ! [ -e $final_path/seafile-server-7.0.5 ]; then + mkdir "$final_path/seafile-server-7.0.5" + if [[ $architecture == "i386" ]] + then + ynh_die --message "Error : this architecture is no longer supported by the upstream. Please create en issue here : https://github.com/YunoHost-Apps/seafile_ynh/issues to ask to discuss about a support of this architecture" + fi + ynh_setup_source "$final_path/seafile-server-7.0.5" "$architecture"_7_0 + fi +} + install_dependance() { ynh_install_app_dependencies python3 python3-setuptools python3-pip python3-requests python3-dev \ expect ffmpeg \ diff --git a/scripts/upgrade b/scripts/upgrade index 3dd3543..a612e9a 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -106,25 +106,31 @@ case $installed_version in ;& "4.1."* ) # Update seafile by script + install_source_7_0 expect_scripts/upgrade_4.2.1.exp $final_path/seafile-server-$seafile_version ;& "4.3."* ) # Update seafile by script + install_source_7_0 expect_scripts/upgrade_4.4.3.exp $final_path/seafile-server-$seafile_version ;& "4.4."* ) # Update seafile by script + install_source_7_0 expect_scripts/upgrade_5.0.3.exp $final_path/seafile-server-$seafile_version ;& "5.0."* ) # Update seafile by script + install_source_7_0 expect_scripts/upgrade_5.1.exp $final_path/seafile-server-$seafile_version ;& "5.1."* ) # Update seafile by script + install_source_7_0 expect_scripts/upgrade_6.0.exp $final_path/seafile-server-$seafile_version ;& "6.0."* ) + install_source_7_0 python3 ../conf/update_sso_conf.py || true # Update seafile by script @@ -135,10 +141,12 @@ case $installed_version in ;& "6.1."* ) # Update seafile by script + install_source_7_0 expect_scripts/upgrade_6.2.exp $final_path/seafile-server-$seafile_version ;& "6.2."* ) # Update seafile by script + install_source_7_0 expect_scripts/upgrade_6.3.exp $final_path/seafile-server-$seafile_version # Update logrotate to have the last version @@ -146,6 +154,7 @@ case $installed_version in ;& "6.3."* ) # Update seafile by script + install_source_7_0 expect_scripts/upgrade_7.0.exp $final_path/seafile-server-$seafile_version # SSO authentication echo 'ENABLE_REMOTE_USER_AUTHENTICATION = True' | tee -a $final_path/conf/seahub_settings.py @@ -157,14 +166,12 @@ case $installed_version in ynh_mysql_execute_as_root --sql "DELETE FROM \`django_session\`" --database seahubdb ynh_print_warn --message "To be able to continue to use the SSO you probybly need to migrate your account. You can use the command 'yunohost app action run seafile migrate_user_email_to_mail_email' to migrate all of theses account. Note that after this migratation you need to reconfigure all your client with the official email of the user." + ynh_secure_remove --file="$final_path/seafile-server-7.0.5" ;& "7.0"* ) # Fix file comment $final_path/seafile-server-$seafile_version/seahub.sh python-env seahub/manage.py migrate_file_comment - # TODO - # Check that last version >= 7.0. If not install and upgrade to 7.0 before !! - # Enable memcached cat > $final_path/conf/seahub_settings.py < Date: Mon, 25 May 2020 10:59:00 +0200 Subject: [PATCH 04/11] Upgrade to seafile 7.1.4 --- README.md | 2 +- conf/arm.src | 4 ++-- conf/x86-64.src | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 8cad858..6989004 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ Seafile is an open Source Cloud Storage application. It's a Enterprise file sync and share platform with high reliability and performance. It's a file hosting platform with high reliability and performance. Put files on your own server. Sync and share files across different devices, or access all the files as a virtual disk. -**Shipped version:** 7.0.4 +**Shipped version:** 7.1.4 Screenshots ----------- diff --git a/conf/arm.src b/conf/arm.src index 7cb9b0d..b786c3f 100644 --- a/conf/arm.src +++ b/conf/arm.src @@ -1,5 +1,5 @@ -SOURCE_URL=https://github.com/haiwen/seafile-rpi/releases/download/v7.0.5/seafile-server_7.0.5_stable_pi.tar.gz -SOURCE_SUM=dae9ab5d232a2b56f129aa29e7e54d2de05d838f0479955543cebcb14c9417db +SOURCE_URL=https://github.com/haiwen/seafile-rpi/releases/download/v7.1.4/seafile-server_7.1.4_pi-buster-stable.tar.gz +SOURCE_SUM=979c946fa9bd28fdd670fb9fc5ff20c38ab3f125eb82a4047626afa325b68023 # (Optional) Program to check the integrity (sha256sum, md5sum...) # default: sha256 SOURCE_SUM_PRG=sha256sum diff --git a/conf/x86-64.src b/conf/x86-64.src index 631524b..5011e40 100644 --- a/conf/x86-64.src +++ b/conf/x86-64.src @@ -1,5 +1,5 @@ -SOURCE_URL=https://s3.eu-central-1.amazonaws.com/download.seadrive.org/seafile-server_7.1.3_x86-64.tar.gz -SOURCE_SUM=41e1042984c923636e6bb7c2249bb9b784e42d796303450fe60d05855abce15f +SOURCE_URL=https://s3.eu-central-1.amazonaws.com/download.seadrive.org/seafile-server_7.1.4_x86-64.tar.gz +SOURCE_SUM=22fd6a1b4889713ed9a83a69bf4240e3af4559037187cdf00f0fbe8a91a14dea # (Optional) Program to check the integrity (sha256sum, md5sum...) # default: sha256 SOURCE_SUM_PRG=sha256sum From d64ca6fb43db688ff9beefb2e03455d3dd38cd32 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Josu=C3=A9=20Tille?= Date: Tue, 20 Oct 2020 22:22:06 +0200 Subject: [PATCH 05/11] Upgrade to 7.1.5 --- README.md | 2 +- conf/arm.src | 4 ++-- conf/x86-64.src | 4 ++-- manifest.json | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 6989004..ce43553 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ Seafile is an open Source Cloud Storage application. It's a Enterprise file sync and share platform with high reliability and performance. It's a file hosting platform with high reliability and performance. Put files on your own server. Sync and share files across different devices, or access all the files as a virtual disk. -**Shipped version:** 7.1.4 +**Shipped version:** 7.1.5 Screenshots ----------- diff --git a/conf/arm.src b/conf/arm.src index b786c3f..cc50123 100644 --- a/conf/arm.src +++ b/conf/arm.src @@ -1,5 +1,5 @@ -SOURCE_URL=https://github.com/haiwen/seafile-rpi/releases/download/v7.1.4/seafile-server_7.1.4_pi-buster-stable.tar.gz -SOURCE_SUM=979c946fa9bd28fdd670fb9fc5ff20c38ab3f125eb82a4047626afa325b68023 +SOURCE_URL=https://github.com/haiwen/seafile-rpi/releases/download/v7.1.5/seafile-server-7.1.5-buster-armv7.tar.gz +SOURCE_SUM=4baec21c1acaec6f50c7a1b229a728417d8fbf87fe3be98f128bc9d2ad399681 # (Optional) Program to check the integrity (sha256sum, md5sum...) # default: sha256 SOURCE_SUM_PRG=sha256sum diff --git a/conf/x86-64.src b/conf/x86-64.src index 5011e40..5efd091 100644 --- a/conf/x86-64.src +++ b/conf/x86-64.src @@ -1,5 +1,5 @@ -SOURCE_URL=https://s3.eu-central-1.amazonaws.com/download.seadrive.org/seafile-server_7.1.4_x86-64.tar.gz -SOURCE_SUM=22fd6a1b4889713ed9a83a69bf4240e3af4559037187cdf00f0fbe8a91a14dea +SOURCE_URL=https://s3.eu-central-1.amazonaws.com/download.seadrive.org/seafile-server_7.1.5_x86-64.tar.gz +SOURCE_SUM=edf020de2324be33df3f6854c6383affca088807bfc1e27a375fbb0f44af0cb0 # (Optional) Program to check the integrity (sha256sum, md5sum...) # default: sha256 SOURCE_SUM_PRG=sha256sum diff --git a/manifest.json b/manifest.json index 7707bba..73b386f 100644 --- a/manifest.json +++ b/manifest.json @@ -4,7 +4,7 @@ "packaging_format": 1, "license": "AGPL-3.0,Apache-2.0,MIT,GPL-2.0", "url": "https://www.seafile.com", - "version": "7.1.3~ynh1", + "version": "7.1.5~ynh1", "description": { "en": "Open Source Cloud Storage", "fr": "Stockage Cloud Open Source" From c6b4402161ad7825aa253f8ab1483aac900361e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Josu=C3=A9=20Tille?= Date: Tue, 17 Nov 2020 23:49:06 +0100 Subject: [PATCH 06/11] Fix package linter --- check_process | 12 ------------ scripts/actions | 8 ++++---- scripts/backup | 8 ++++---- scripts/change_url | 8 ++++---- scripts/install | 8 ++++---- scripts/remove | 8 ++++---- scripts/restore | 8 ++++---- scripts/upgrade | 8 ++++---- 8 files changed, 28 insertions(+), 40 deletions(-) diff --git a/check_process b/check_process index b1c9453..43bed43 100644 --- a/check_process +++ b/check_process @@ -30,18 +30,6 @@ port_already_use=1 (8000) final_path_already_use=1 change_url=1 -;;; Levels - Level 1=auto - Level 2=auto - Level 3=auto - # https://github.com/YunoHost-Apps/seafile_ynh/issues/1 - Level 4=1 - Level 5=auto - Level 6=auto - Level 7=auto - Level 8=0 - Level 9=0 - Level 10=0 ;;; Upgrade options ; commit=db11d890922564dfdcb7937a3a682957082fbb31 diff --git a/scripts/actions b/scripts/actions index 7f6b60c..69b5a4e 100644 --- a/scripts/actions +++ b/scripts/actions @@ -4,16 +4,16 @@ # GENERIC START #================================================= +# Import common cmd +source scripts/experimental_helper.sh +source scripts/_common.sh + # Source YunoHost helpers source /usr/share/yunohost/helpers # Stop script if errors ynh_abort_if_errors -# Import common cmd -source scripts/experimental_helper.sh -source scripts/_common.sh - ynh_print_info --message="Loading installation settings..." # Retrive arguments diff --git a/scripts/backup b/scripts/backup index f081cdb..6357471 100644 --- a/scripts/backup +++ b/scripts/backup @@ -4,16 +4,16 @@ # GENERIC START #================================================= +# Import common cmd +source ../settings/scripts/experimental_helper.sh +source ../settings/scripts/_common.sh + # Source YunoHost helpers source /usr/share/yunohost/helpers # Stop script if errors ynh_abort_if_errors -# Import common cmd -source ../settings/scripts/experimental_helper.sh -source ../settings/scripts/_common.sh - ynh_script_progression --message="Loading installation settings..." # retrieve useful param diff --git a/scripts/change_url b/scripts/change_url index a3b98b1..60023cf 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -4,16 +4,16 @@ # GENERIC START #================================================= +# Import common cmd +source ./experimental_helper.sh +source ./_common.sh + # Source YunoHost helpers source /usr/share/yunohost/helpers # Stop script if errors ynh_abort_if_errors -# Import common cmd -source ./experimental_helper.sh -source ./_common.sh - ynh_script_progression --message="Loading installation settings..." # Retrive arguments diff --git a/scripts/install b/scripts/install index 7d84c69..980665b 100644 --- a/scripts/install +++ b/scripts/install @@ -4,16 +4,16 @@ # GENERIC START #================================================= +# Import common cmd +source ./experimental_helper.sh +source ./_common.sh + # Source YunoHost helpers source /usr/share/yunohost/helpers # Stop script if errors ynh_abort_if_errors -# Import common cmd -source ./experimental_helper.sh -source ./_common.sh - ynh_script_progression --message="Validating installation parameters..." # Retrieve arguments diff --git a/scripts/remove b/scripts/remove index 296cc2c..9ec4ae7 100644 --- a/scripts/remove +++ b/scripts/remove @@ -4,16 +4,16 @@ # GENERIC START #================================================= +# Import common cmd +source ./experimental_helper.sh +source ./_common.sh + # Source YunoHost helpers source /usr/share/yunohost/helpers # Stop script if errors set -u -# Import common cmd -source ./experimental_helper.sh -source ./_common.sh - ynh_script_progression --message="Loading installation settings..." # Retrieve arguments diff --git a/scripts/restore b/scripts/restore index cadfc30..a7c1bf2 100644 --- a/scripts/restore +++ b/scripts/restore @@ -4,16 +4,16 @@ # GENERIC START #================================================= +# Import common cmd +source ../settings/scripts/experimental_helper.sh +source ../settings/scripts/_common.sh + # Source YunoHost helpers source /usr/share/yunohost/helpers # Stop script if errors ynh_abort_if_errors -# Import common cmd -source ../settings/scripts/experimental_helper.sh -source ../settings/scripts/_common.sh - ynh_script_progression --message="Loading settings..." # Retrieve arguments diff --git a/scripts/upgrade b/scripts/upgrade index e7a1860..b19617f 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -4,16 +4,16 @@ # GENERIC START #================================================= +# Import common cmd +source ./experimental_helper.sh +source ./_common.sh + # Source YunoHost helpers source /usr/share/yunohost/helpers # Stop script if errors ynh_abort_if_errors -# Import common cmd -source ./experimental_helper.sh -source ./_common.sh - ynh_script_progression --message="Loading installation settings..." # Retrieve arguments From e5b722e7e51d6876973f00edec538762802b0720 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Josu=C3=A9=20Tille?= Date: Sun, 29 Nov 2020 17:29:51 +0100 Subject: [PATCH 07/11] Add backup core only feature --- README.md | 24 ++++++++++++++++++++++++ scripts/backup | 6 +++++- scripts/remove | 4 ++-- 3 files changed, 31 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 8301328..1cfa695 100644 --- a/README.md +++ b/README.md @@ -101,6 +101,30 @@ From command line: `sudo yunohost app upgrade seafile -u https://github.com/YunoHost-Apps/seafile_ynh` +Backup +------ + +This app use now the core-only feature of the backup. To keep the integrity of the data and to have a better guarantee of the restoration is recommended to proceed like this: + +- Stop seafile service with theses following command: +``` +systemctl stop seafile.service seahub.service +``` +- Launch the backup of seafile with this following command: +``` +yunohost backup create --app seafile +``` +- Do a backup of your data with your specific strategy (could be with rsync, borg backup or just cp). +- Restart the seafile service with theses command: +``` +systemctl start seafile.service seahub.service +``` + +Remove +------ + +Due of the backup core only feature the data directory in `/home/yunohost.app/seafile-data` **is not removed**. It need to be removed manually to purge app user data. + Developers infos ---------------- diff --git a/scripts/backup b/scripts/backup index 6357471..8230271 100644 --- a/scripts/backup +++ b/scripts/backup @@ -22,6 +22,10 @@ db_pwd=$(ynh_app_setting_get --app $app --key mysqlpwd) final_path=$(ynh_app_setting_get --app $app --key final_path) seafile_user=$app +if [ ! "$(systemctl status seafile)" =~ "Active: stoped" ] || [ ! "$(systemctl status seahub)" =~ "Active: stoped" ]; then + ynh_print_warn --message="It's hightly recommended to make your backup when the service is stoped. Please seafile service and seahub service with this command before to run the backup 'systemctl stop seafile.service seahub.service'" +fi + #================================================= # STANDARD BACKUP STEPS #================================================= @@ -30,7 +34,7 @@ seafile_user=$app ynh_script_progression --message="Backing up code..." --weight=3 ynh_backup --src_path $final_path ynh_script_progression --message="Backing up user data..." --weight=10 -ynh_backup --src_path /home/yunohost.app/seafile-data --dest_path "data" +ynh_backup --src_path /home/yunohost.app/seafile-data --dest_path "data" --is_big 1 ynh_script_progression --message="Backing up configuration..." ynh_backup --src_path /etc/nginx/conf.d/$domain.d/${app}.conf ynh_backup --src_path /etc/systemd/system/seafile.service diff --git a/scripts/remove b/scripts/remove index 9ec4ae7..84e632b 100644 --- a/scripts/remove +++ b/scripts/remove @@ -44,8 +44,6 @@ ynh_secure_remove --file=/var/log/seafile ynh_script_progression --message="Removing code..." ynh_secure_remove --file=/var/www/$app ynh_secure_remove --file=/opt/yunohost/$app -ynh_script_progression --message="Removing user data..." -ynh_secure_remove --file=/home/yunohost.app/seafile-data ynh_secure_remove --file=/tmp/seahub_cache # Remove databases @@ -82,4 +80,6 @@ ynh_script_progression --message="Removing seafile service..." yunohost service remove seafile yunohost service remove seahub +ynh_print_info --message="Due of the backup core only feature the data directory in '/home/yunohost.app/seafile-data' was not removed. It need to be removed manually to purge app user data." + ynh_script_progression --message="Removal of $app completed" --last From d8ee358d7f6123de4f2519a3242b02cb3daf7ba7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Josu=C3=A9=20Tille?= Date: Sun, 29 Nov 2020 17:30:05 +0100 Subject: [PATCH 08/11] Add backup_before_upgrade feature --- scripts/upgrade | 3 +++ 1 file changed, 3 insertions(+) diff --git a/scripts/upgrade b/scripts/upgrade index b19617f..67eb756 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -46,6 +46,9 @@ pkill -f seaf-server || true pkill -f ccnet-server || true pkill -f seahub || true +if [ ] +ynh_backup_before_upgrade + #================================================= # MIGRATION FROM OLD VERSION #================================================= From ac336efea4f451b3fcf78c4bee0c36aa12c00c22 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Josu=C3=A9=20Tille?= Date: Sat, 12 Dec 2020 15:03:12 +0100 Subject: [PATCH 09/11] Fix package linter and update install badge --- README.md | 2 +- scripts/backup | 12 ++++++------ scripts/install | 2 +- scripts/restore | 4 ++-- scripts/upgrade | 4 ++-- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 856112f..f7f4270 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ Seafile For yunohost ================= [![Integration level](https://dash.yunohost.org/integration/seafile.svg)](https://dash.yunohost.org/appci/app/seafile) ![](https://ci-apps.yunohost.org/ci/badges/seafile.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/seafile.maintain.svg) -[![Install seafile with YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=seafile) +[![Install seafile with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=seafile) > *This package allow you to install seafile quickly and simply on a YunoHost server. If you don't have YunoHost, please see [here](https://yunohost.org/#/install) to know how to install and enjoy it.* diff --git a/scripts/backup b/scripts/backup index 4d1c304..431f089 100644 --- a/scripts/backup +++ b/scripts/backup @@ -14,7 +14,7 @@ source /usr/share/yunohost/helpers # Stop script if errors ynh_abort_if_errors -ynh_script_progression --message="Loading installation settings..." +ynh_print_info --message="Loading installation settings..." # retrieve useful param domain=$(ynh_app_setting_get --app $app --key domain) @@ -31,11 +31,11 @@ fi #================================================= # # Backup app files -ynh_script_progression --message="Backing up code..." --weight=3 +ynh_print_info --message="Backing up code..." ynh_backup --src_path $final_path -ynh_script_progression --message="Backing up user data..." --weight=10 +ynh_print_info --message="Backing up user data..." ynh_backup --src_path=/home/yunohost.app/seafile-data --dest_path="data" --is_big=1 -ynh_script_progression --message="Backing up configuration..." +ynh_print_info --message="Backing up configuration..." ynh_backup --src_path /etc/nginx/conf.d/$domain.d/${app}.conf ynh_backup --src_path /etc/systemd/system/seafile.service ynh_backup --src_path /etc/systemd/system/seahub.service @@ -43,9 +43,9 @@ ynh_backup --src_path /etc/fail2ban/jail.d/$app.conf ynh_backup --src_path /etc/fail2ban/filter.d/$app.conf # Backup mysql -ynh_script_progression --message="Backing up database" +ynh_print_info --message="Backing up database" ynh_mysql_dump_db --database ccnetdb > ${YNH_CWD}/ccnetdb.dmp ynh_mysql_dump_db --database seafiledb > ${YNH_CWD}/seafiledb.dmp ynh_mysql_dump_db --database seahubdb > ${YNH_CWD}/seahubdb.dmp -ynh_script_progression --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)." --last +ynh_print_info --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)." diff --git a/scripts/install b/scripts/install index 5b41999..dcdd44d 100644 --- a/scripts/install +++ b/scripts/install @@ -18,7 +18,7 @@ ynh_script_progression --message="Validating installation parameters..." # Retrieve arguments domain=$YNH_APP_ARG_DOMAIN -path_url=$(ynh_normalize_url_path --path_url $YNH_APP_ARG_PATH) +path_url=$YNH_APP_ARG_PATH server_name="$YNH_APP_ARG_SERVER_NAME" admin=$YNH_APP_ARG_ADMIN is_public=$YNH_APP_ARG_IS_PUBLIC diff --git a/scripts/restore b/scripts/restore index a7c1bf2..b585e4f 100644 --- a/scripts/restore +++ b/scripts/restore @@ -73,8 +73,8 @@ set_permission # Enable service and start seafile ynh_script_progression --message="Reconfiguring application..." systemctl daemon-reload -systemctl enable seafile -systemctl enable seahub +systemctl enable seafile --quiet +systemctl enable seahub --quiet # Add Seafile to YunoHost's monitored services ynh_script_progression --message="Register seafile service..." diff --git a/scripts/upgrade b/scripts/upgrade index 67eb756..7ef2ed1 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -32,8 +32,8 @@ ynh_script_progression --message="Stoping services..." if [ -e /etc/init.d/seafile-server ] then # Old init script support - systemctl stop seafile-server - systemctl disable seafile-server + systemctl stop seafile-server --quiet + systemctl disable seafile-server --quiet ynh_secure_remove --file=/etc/init.d/seafile-server yunohost service remove seafile-server else From a2f13e12e8fb235cff00e3120dd909f1b2448977 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Josu=C3=A9=20Tille?= Date: Mon, 14 Dec 2020 16:35:22 +0100 Subject: [PATCH 10/11] Fix upgrade to 7.1 --- README.md | 8 ++++++++ scripts/_common.sh | 2 -- scripts/install | 2 ++ scripts/upgrade | 21 +++++++++++++-------- 4 files changed, 23 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index f7f4270..be24031 100644 --- a/README.md +++ b/README.md @@ -88,6 +88,14 @@ From command line: ### Upgrade +By default a backup is made before the upgrade. To avoid this you have theses following possibilites: +- Pass the `NO_BACKUP_UPGRADE` env variable with `1` at each upgrade. By example `NO_BACKUP_UPGRADE=1 yunohost app upgrade synapse`. +- Set the settings `disable_backup_before_upgrade` to `1`. You can set this with this command: + +`yunohost app setting synapse disable_backup_before_upgrade -v 1` + +After this settings will be applied for **all** next upgrade. + From command line: `yunohost app upgrade seafile` diff --git a/scripts/_common.sh b/scripts/_common.sh index 14044ed..637aa3b 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -3,8 +3,6 @@ #================================================= app=$YNH_APP_INSTANCE_NAME -[[ -e "../settings/manifest.json" ]] || [[ -e "../manifest.json" ]] && \ - seafile_version=$(ynh_app_upstream_version) #================================================= # DEFINE ALL COMMON FONCTIONS diff --git a/scripts/install b/scripts/install index dcdd44d..30fadb4 100644 --- a/scripts/install +++ b/scripts/install @@ -26,6 +26,8 @@ seafile_data=/home/yunohost.app/seafile-data final_path=/opt/yunohost/$app seafile_user=$app admin_password=$YNH_APP_ARG_ADMIN_PASSWORD +# TODO User env variable in 4.1 +seafile_version=$(ynh_app_upstream_version) # Create special path with / at the end if [[ $path_url == '/' ]] diff --git a/scripts/upgrade b/scripts/upgrade index 7ef2ed1..cca4f5b 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -25,6 +25,8 @@ fileserver_port=$(ynh_app_setting_get --app $app --key fileserver_port) webdav_port=$(ynh_app_setting_get --app $app --key webdav_port) final_path=$(ynh_app_setting_get --app $app --key final_path) seafile_user=$app +# TODO User env variable in 4.1 +seafile_version=$(ynh_app_upstream_version) ynh_script_progression --message="Stoping services..." @@ -46,8 +48,16 @@ pkill -f seaf-server || true pkill -f ccnet-server || true pkill -f seahub || true -if [ ] -ynh_backup_before_upgrade +# Backup the current version of the app +if [ "0$(ynh_app_setting_get --app=$app --key=disable_backup_before_upgrade)" -ne 1 ] +then + ynh_backup_before_upgrade + ynh_clean_setup () { + # Clean installation remainings that are not handled by the remove script. + ynh_clean_check_starting + ynh_restore_upgradebackup + } +fi #================================================= # MIGRATION FROM OLD VERSION @@ -176,17 +186,12 @@ case $installed_version in $final_path/seafile-server-$seafile_version/seahub.sh python-env seahub/manage.py migrate_file_comment # Enable memcached - cat > $final_path/conf/seahub_settings.py <> $final_path/conf/seahub_settings.py < Date: Tue, 15 Dec 2020 22:09:09 +0100 Subject: [PATCH 11/11] Fix small issues --- scripts/backup | 2 +- scripts/install | 2 +- scripts/upgrade | 27 ++++++++++++++++++--------- 3 files changed, 20 insertions(+), 11 deletions(-) diff --git a/scripts/backup b/scripts/backup index 431f089..4492a2d 100644 --- a/scripts/backup +++ b/scripts/backup @@ -22,7 +22,7 @@ db_pwd=$(ynh_app_setting_get --app $app --key mysqlpwd) final_path=$(ynh_app_setting_get --app $app --key final_path) seafile_user=$app -if [[ ! "$(systemctl status seafile)" =~ "Active: inactive (dead)" ]] || [[ ! "$(systemctl status seahub)" =~ "Active: inactive (dead)" ]]; then +if [[ ! "$(systemctl status seafile)" =~ "Active: inactive (dead)" ]] || [[ ! "$(systemctl status seahub)" =~ "Active: failed (Result: signal)" ]]; then ynh_print_warn --message="It's hightly recommended to make your backup when the service is stopped. Please stop seafile service and seahub service with this command before to run the backup 'systemctl stop seafile.service seahub.service'" fi diff --git a/scripts/install b/scripts/install index 30fadb4..a1e2464 100644 --- a/scripts/install +++ b/scripts/install @@ -79,7 +79,7 @@ mkdir -p $final_path mkdir -p $final_path/installed mkdir -p $final_path/logs mkdir -p $seafile_data -ln -s $seafile_data $final_path/seafile_data +ln -s $seafile_data $final_path/seafile-data # Create User ynh_script_progression --message="Configuring system user..." diff --git a/scripts/upgrade b/scripts/upgrade index cca4f5b..beac386 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -25,6 +25,7 @@ fileserver_port=$(ynh_app_setting_get --app $app --key fileserver_port) webdav_port=$(ynh_app_setting_get --app $app --key webdav_port) final_path=$(ynh_app_setting_get --app $app --key final_path) seafile_user=$app +seafile_data=/home/yunohost.app/seafile-data # TODO User env variable in 4.1 seafile_version=$(ynh_app_upstream_version) @@ -42,12 +43,13 @@ else ynh_systemd_action --service_name seafile --action stop ynh_systemd_action --service_name seahub --action stop fi -sleep 2 +sleep 5 pkill -f seafile-controller || true pkill -f seaf-server || true pkill -f ccnet-server || true pkill -f seahub || true +ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --weight=30 # Backup the current version of the app if [ "0$(ynh_app_setting_get --app=$app --key=disable_backup_before_upgrade)" -ne 1 ] then @@ -145,10 +147,10 @@ case $installed_version in "6.0."* ) install_source_7_0 python3 ../conf/update_sso_conf.py || true - + # Update seafile by script expect_scripts/upgrade_6.1.exp $final_path/seafile-server-$seafile_version - + # Enable manually wiki echo 'ENABLE_WIKI = True' | tee -a $final_path/conf/seahub_settings.py ;& @@ -161,7 +163,7 @@ case $installed_version in # Update seafile by script install_source_7_0 expect_scripts/upgrade_6.3.exp $final_path/seafile-server-$seafile_version - + # Update logrotate to have the last version ynh_use_logrotate --logfile $final_path/logs --nonappend ;& @@ -177,13 +179,13 @@ case $installed_version in # Clean connexion from the SSO. If we don't do this we could have some when the user was loged by the old SSO auth mecanisme ynh_mysql_execute_as_root --sql "DELETE FROM \`django_session\`" --database seahubdb - + ynh_print_warn --message "To be able to continue to use the SSO you probybly need to migrate your account. You can use the command 'yunohost app action run seafile migrate_user_email_to_mail_email' to migrate all of theses account. Note that after this migratation you need to reconfigure all your client with the official email of the user." ynh_secure_remove --file="$final_path/seafile-server-7.0.5" ;& "7.0"* ) - # Fix file comment - $final_path/seafile-server-$seafile_version/seahub.sh python-env seahub/manage.py migrate_file_comment + # Fix file comment + $final_path/seafile-server-$seafile_version/seahub.sh python-env seahub/manage.py migrate_file_comment # Enable memcached cat >> $final_path/conf/seahub_settings.py <