From 3be837d749929112badf3f307ec98d2a94c5d54e Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Fri, 18 Dec 2020 22:56:28 +0100 Subject: [PATCH 1/5] Fix linter warnings --- README.md | 30 +++++++++++++++++++++--------- check_process | 3 --- manifest.json | 4 ++-- scripts/backup | 12 +++++++----- scripts/install | 1 + scripts/remove | 2 +- scripts/restore | 8 +++++++- scripts/upgrade | 16 ++++++++++++++++ 8 files changed, 55 insertions(+), 21 deletions(-) diff --git a/README.md b/README.md index ee29510..69dbede 100644 --- a/README.md +++ b/README.md @@ -1,19 +1,16 @@ -diaspora_ynh -========== +Diaspora for YunoHost -[![Integration level](https://dash.yunohost.org/integration/diaspora.svg)](https://dash.yunohost.org/appci/app/diaspora) ![](https://ci-apps.yunohost.org/ci/badges/diaspora.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/diaspora.maintain.svg)[![Shipped version](https://img.shields.io/github/v/release/yunohost-apps/diaspora_ynh)](https://github.com/yunohost-apps/diaspora_ynh/releases) - -[![Install diaspora with YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=diaspora) +[![Integration level](https://dash.yunohost.org/integration/diaspora.svg)](https://dash.yunohost.org/appci/app/diaspora) ![](https://ci-apps.yunohost.org/ci/badges/diaspora.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/diaspora.maintain.svg)[![Shipped version](https://img.shields.io/github/v/release/yunohost-apps/diaspora_ynh)](https://github.com/yunohost-apps/diaspora_ynh/releases) +[![Install Diaspora with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=diaspora) ## Overview -> *This package allow you to install diaspora* quickly and simply on a YunoHost server. +> *This package allow you to install Diaspora 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.* **Shipped version:** 0.7.13.0 -Notes --------------- +## Notes Before installing, you have to: @@ -25,5 +22,20 @@ Installation effects: - Thank you for being patient as deployment time can take up to about 1 hour (raspberry pi). - The installation directory can take up to 900MB and app start time can be take 5 minutes +## Links -Report a bug: https://github.com/YunoHost-Apps/diaspora_ynh/issues + * Report a bug: https://github.com/YunoHost-Apps/diaspora_ynh/issues + * YunoHost website: https://yunohost.org/ + +--- + +## Developer info + +Please send your pull request to the [testing branch](https://github.com/YunoHost-Apps/diaspora_ynh/tree/testing). + +To try the testing branch, please proceed like that. +``` +sudo yunohost app install https://github.com/YunoHost-Apps/diaspora_ynh/tree/testing --debug +or +sudo yunohost app upgrade diaspora -u https://github.com/YunoHost-Apps/diaspora_ynh/tree/testing --debug +``` diff --git a/check_process b/check_process index 1537b65..1efa13e 100644 --- a/check_process +++ b/check_process @@ -16,9 +16,6 @@ multi_instance=1 port_already_use=0 change_url=0 # not supported upstream -;;; Levels - # If the level 5 (Package linter) is forced to 1. Please add justifications here. - Level 5=auto ;;; Options Email= Notification=none diff --git a/manifest.json b/manifest.json index 61d2445..664777c 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.14.0~ynh1", + "version": "0.7.14.0~ynh2", "maintainer": { "name": "rafi59", "email": "" }, "requirements": { - "yunohost": ">= 3.7.0" + "yunohost": ">= 3.8.1" }, "multi_instance": true, "services": [ diff --git a/scripts/backup b/scripts/backup index ca58642..53991c7 100644 --- a/scripts/backup +++ b/scripts/backup @@ -18,7 +18,7 @@ ynh_abort_if_errors #================================================= # LOAD SETTINGS #================================================= -ynh_script_progression --message="Loading installation settings..." +ynh_print_info --message="Loading installation settings..." app=$YNH_APP_INSTANCE_NAME @@ -30,18 +30,20 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path) # clean folder ynh_secure_remove --file="$final_path/backup" mkdir -p $final_path/backup + #================================================= # BACKUP DIASPORA DATABASE #================================================= -ynh_script_progression --message="Backup Diaspora DB..." --weight=10 + db_pass=$(ynh_app_setting_get --app=$app --key=psqlpwd) dump_file="$final_path/backup/$app.dump" pg_dump -d "dbname=$app user=$app password=$db_pass host=localhost" -Fc -f $dump_file ynh_backup --src_path="$dump_file" + #================================================= # BACKUP DIASPORA UPLOADS #================================================= -ynh_script_progression --message="Backup uploads..." --weight=10 + if [ -x $final_path/diaspora/public/uploads ]; then ynh_backup --src_path="$final_path/diaspora/public/uploads" else @@ -51,11 +53,11 @@ fi #================================================= # BACKUP CONF FILES #================================================= -ynh_script_progression --message="Backup configuration files of Diaspora..." + ynh_backup --src_path="$final_path/diaspora/config/database.yml" ynh_backup --src_path="$final_path/diaspora/config/diaspora.yml" #================================================= # END OF SCRIPT #================================================= -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 4cf1c6c..b8d8e70 100755 --- a/scripts/install +++ b/scripts/install @@ -179,6 +179,7 @@ ynh_app_setting_set $app unprotected_uris "/" # CREATE AN ADMIN #================================================= ynh_script_progression --message="Create admin..." --weight=1 + pushd $final_path/diaspora sudo -u $app /bin/bash --login << EOF RAILS_ENV=production bundle exec rails console << END diff --git a/scripts/remove b/scripts/remove index 10c18b7..f107e3c 100644 --- a/scripts/remove +++ b/scripts/remove @@ -31,7 +31,7 @@ final_path=$(ynh_app_setting_get $app final_path) ynh_script_progression --message="Remove services" yunohost service remove $app.target systemctl stop ${app}.target ${app}_sidekiq.service ${app}_web.service -systemctl disable ${app}.target ${app}_sidekiq.service ${app}_web.service +systemctl disable ${app}.target ${app}_sidekiq.service ${app}_web.service --quiet ynh_secure_remove --file="/etc/systemd/system/${app}_web.service" ynh_secure_remove --file="/etc/systemd/system/${app}_sidekiq.service" ynh_secure_remove --file="/etc/tmpfiles.d/${app}.conf" diff --git a/scripts/restore b/scripts/restore index be8a532..3db15b8 100644 --- a/scripts/restore +++ b/scripts/restore @@ -51,6 +51,7 @@ can_remove_home=1 # Reinstall dependencies #================================================= ynh_script_progression --message="Reinstalling dependencies..." --weight=27 + ynh_install_app_dependencies $pkg_dependencies $ruby_build_dependencies # now that we have psql for sure, test db existence @@ -62,6 +63,7 @@ can_remove_db=1 # Restoring dedicated USER #================================================= ynh_script_progression --message="Restoring user..." --weight=1 + ynh_system_user_create --username=$app --home_dir=$final_path --use_shell can_remove_user=1 mkdir -p $final_path @@ -72,6 +74,7 @@ chown $app:www-data $final_path # INSTALL RVM AND RUBY FOR CURRENT USER #================================================= ynh_script_progression --message="Reinstalling rvm and ruby..." --weight=50 + source ./install_ruby #================================================= @@ -112,24 +115,27 @@ ynh_secure_remove --file=/tmp/diaspora.dump #================================================= # Bundle the ruby app #================================================= -ynh_script_progression --message="Precompile assets..." --weight=200 +ynh_script_progression --message="Precompile assets..." --weight=20 source ./bundle_app #================================================= # Restore nginx conf files #================================================= ynh_script_progression --message="Recreate nginx config from source" + ynh_add_nginx_config #================================================= # Restore services #================================================= ynh_script_progression --message="Restore services..." + source ./create_services #================================================= # ADVERTISE SERVICE IN ADMIN PANEL #================================================= + yunohost service add $app.target\ --log $final_path/diaspora/log/production.log \ $final_path/diaspora/log/unicorn-stderr.log\ diff --git a/scripts/upgrade b/scripts/upgrade index 0dbec14..ed8f224 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -14,6 +14,7 @@ source /usr/share/yunohost/helpers # LOAD SETTINGS #================================================= ynh_script_progression --message="Loading installation settings..." + app=$YNH_APP_INSTANCE_NAME # Retrieve arguments @@ -30,18 +31,21 @@ ynh_abort_if_errors # Check upgrade type #================================================= ynh_script_progression --message="Check upgrade type..." + upgrade_type=$(ynh_check_app_version_changed) #================================================= # 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 #================================================= @@ -86,10 +90,21 @@ then source ./bundle_app fi +#================================================= +# ADVERTISE SERVICE IN ADMIN PANEL +#================================================= +yunohost service add $app.target \ + --log $final_path/diaspora/log/production.log \ + $final_path/diaspora/log/unicorn-stderr.log\ + $final_path/diaspora/log/unicorn-stdout.log\ + $final_path/diaspora/log/sidekiq.log\ + --description "Diaspora service (unicorn web and sidekiq)" + #================================================= # restart services #================================================= ynh_script_progression --message="Recreate and start services..." + source ./create_services #================================================= @@ -97,6 +112,7 @@ source ./create_services #================================================= # Create a dedicated nginx config ynh_script_progression --message="configure nginx..." --weight=1 + ynh_add_nginx_config From e54d6277f94d86cda1dd20bcd5aa19e1c77e5b42 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sun, 20 Dec 2020 17:38:11 +0100 Subject: [PATCH 2/5] Fix typos --- README.md | 4 ++-- scripts/install | 1 - 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 69dbede..2efa34d 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,11 @@ -Diaspora for YunoHost +# Diaspora* for YunoHost [![Integration level](https://dash.yunohost.org/integration/diaspora.svg)](https://dash.yunohost.org/appci/app/diaspora) ![](https://ci-apps.yunohost.org/ci/badges/diaspora.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/diaspora.maintain.svg)[![Shipped version](https://img.shields.io/github/v/release/yunohost-apps/diaspora_ynh)](https://github.com/yunohost-apps/diaspora_ynh/releases) [![Install Diaspora with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=diaspora) ## Overview -> *This package allow you to install Diaspora quickly and simply on a YunoHost server. +> *This package allow you to install Diaspora* 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.* **Shipped version:** 0.7.13.0 diff --git a/scripts/install b/scripts/install index b8d8e70..4cf1c6c 100755 --- a/scripts/install +++ b/scripts/install @@ -179,7 +179,6 @@ ynh_app_setting_set $app unprotected_uris "/" # CREATE AN ADMIN #================================================= ynh_script_progression --message="Create admin..." --weight=1 - pushd $final_path/diaspora sudo -u $app /bin/bash --login << EOF RAILS_ENV=production bundle exec rails console << END From 0fdb415c45087a8f97e96f6c9625dbff5966eaae Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sun, 20 Dec 2020 17:45:47 +0100 Subject: [PATCH 3/5] Add ynh_print_info for DB backup --- scripts/backup | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/backup b/scripts/backup index 53991c7..6a77eaf 100644 --- a/scripts/backup +++ b/scripts/backup @@ -34,6 +34,7 @@ mkdir -p $final_path/backup #================================================= # BACKUP DIASPORA DATABASE #================================================= +ynh_print_info --message="Backup Diaspora DB..." db_pass=$(ynh_app_setting_get --app=$app --key=psqlpwd) dump_file="$final_path/backup/$app.dump" From 9a608e6d6c2bb584f0e6c8bc92caeafbd7c62f76 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Mon, 21 Dec 2020 18:53:57 +0100 Subject: [PATCH 4/5] Add escape to * --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 2efa34d..69bb8c1 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ ## Overview -> *This package allow you to install Diaspora* quickly and simply on a YunoHost server. +> *This package allow you to install Diaspora\* 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.* **Shipped version:** 0.7.13.0 From f45513f1ab7de996fe225f1405c53663c1ef8cd0 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Mon, 21 Dec 2020 18:58:18 +0100 Subject: [PATCH 5/5] Set --weight --- scripts/restore | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/scripts/restore b/scripts/restore index 3db15b8..1256e4e 100644 --- a/scripts/restore +++ b/scripts/restore @@ -50,7 +50,7 @@ can_remove_home=1 #================================================= # Reinstall dependencies #================================================= -ynh_script_progression --message="Reinstalling dependencies..." --weight=27 +ynh_script_progression --message="Reinstalling dependencies..." --weight=5 ynh_install_app_dependencies $pkg_dependencies $ruby_build_dependencies @@ -73,7 +73,7 @@ chown $app:www-data $final_path #================================================= # INSTALL RVM AND RUBY FOR CURRENT USER #================================================= -ynh_script_progression --message="Reinstalling rvm and ruby..." --weight=50 +ynh_script_progression --message="Reinstalling rbenv and ruby..." --weight=10 source ./install_ruby @@ -82,14 +82,14 @@ 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 +ynh_script_progression --message="Download the sources..." --weight=5 sudo -u $app git clone https://github.com/diaspora/diaspora.git -b $current_tag popd #================================================= # Restore files #================================================= -ynh_script_progression --message="Restore the files" --weight=16 +ynh_script_progression --message="Restore the files" --weight=5 ynh_restore_file --origin_path=/var/www/diaspora/diaspora/config/database.yml ynh_restore_file --origin_path=/var/www/diaspora/diaspora/config/diaspora.yml ynh_restore_file --not_mandatory --origin_path=/var/www/diaspora/diaspora/public/uploads/ @@ -100,7 +100,7 @@ ynh_restore_file --origin_path=/var/www/diaspora/backup/diaspora.dump --dest_pat #================================================= # Restore database #================================================= -ynh_script_progression --message="Recreating and restoring database..." --weight=16 +ynh_script_progression --message="Recreating and restoring database..." --weight=5 db_name=$(ynh_sanitize_dbid $app) ynh_psql_test_if_first_run db_pass=$(ynh_app_setting_get --app=$app --key=psqlpwd) @@ -115,7 +115,7 @@ ynh_secure_remove --file=/tmp/diaspora.dump #================================================= # Bundle the ruby app #================================================= -ynh_script_progression --message="Precompile assets..." --weight=20 +ynh_script_progression --message="Precompile assets..." --weight=5 source ./bundle_app #=================================================