From edcbed0ba4a29d404bd76689ec336b8920521d06 Mon Sep 17 00:00:00 2001 From: Raphael Jolivet Date: Mon, 25 Jun 2018 11:49:56 +0200 Subject: [PATCH 1/9] Update app.src --- conf/app.src | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/conf/app.src b/conf/app.src index ade633c..eae7103 100644 --- a/conf/app.src +++ b/conf/app.src @@ -1,6 +1,6 @@ -SOURCE_URL=https://releases.wekan.team/wekan-0.89.tar.gz -SOURCE_SUM=17b2ff34912794c02b41799000f64236d9c7a562546c234167332d56492f29ae +SOURCE_URL=https://releases.wekan.team/wekan-1.07.tar.gz +SOURCE_SUM=34105938c067b6ebcacaa3e2472061c919eb9e00aaa8e114c0e6b31a89772735 SOURCE_SUM_PRG=sha256sum ARCH_FORMAT=tar.gz SOURCE_IN_SUBDIR=true -SOURCE_FILENAME=wekan-0.89.tar.gz +SOURCE_FILENAME=wekan-1.07.tar.gz From 816c2c4334c653114e8586a9596d635d23e0ec78 Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Sun, 1 Jul 2018 15:35:52 +0200 Subject: [PATCH 2/9] Use a copy on yunohost's infra to avoid the file disappearing --- conf/app.src | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/conf/app.src b/conf/app.src index eae7103..2d2d562 100644 --- a/conf/app.src +++ b/conf/app.src @@ -1,4 +1,6 @@ -SOURCE_URL=https://releases.wekan.team/wekan-1.07.tar.gz +# This is on YunoHost server just to avoid the file from disappearing +# Original source is https://releases.wekan.team/ +SOURCE_URL=https://build.yunohost.org/apps/wekan-1.07.tar.gz SOURCE_SUM=34105938c067b6ebcacaa3e2472061c919eb9e00aaa8e114c0e6b31a89772735 SOURCE_SUM_PRG=sha256sum ARCH_FORMAT=tar.gz From 35f39f28328495f20237e29a28c803ae6deedb6e Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Sun, 1 Jul 2018 15:38:10 +0200 Subject: [PATCH 3/9] Update manifest.json --- manifest.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest.json b/manifest.json index 138fe37..b188bad 100644 --- a/manifest.json +++ b/manifest.json @@ -2,7 +2,7 @@ "name": "Wekan", "id": "wekan", "packaging_format": 1, - "version": "0.89~ynh1", + "version": "1.07~ynh1", "description": { "en": "Trello-like kanban", "fr": "Un kanban similaire à Trello" From 6e319a9f367121099e728412b065f43f4c4af2d7 Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Sun, 1 Jul 2018 17:04:35 +0000 Subject: [PATCH 4/9] Change way mongodb is installed (use official debian builds in stretch) --- conf/systemd.service | 4 ++-- manifest.json | 4 ++-- scripts/install | 13 ++++--------- scripts/remove | 11 ----------- scripts/restore | 11 ++++------- 5 files changed, 12 insertions(+), 31 deletions(-) diff --git a/conf/systemd.service b/conf/systemd.service index 70c3e2f..d60488e 100644 --- a/conf/systemd.service +++ b/conf/systemd.service @@ -1,7 +1,7 @@ [Unit] Description=Wekan, task board -Wants=mongod.service -After=network.target mongod.service +Wants=mongodb.service +After=network.target mongodb.service [Service] Type=simple diff --git a/manifest.json b/manifest.json index b188bad..98c2599 100644 --- a/manifest.json +++ b/manifest.json @@ -2,7 +2,7 @@ "name": "Wekan", "id": "wekan", "packaging_format": 1, - "version": "1.07~ynh1", + "version": "1.07~ynh2", "description": { "en": "Trello-like kanban", "fr": "Un kanban similaire à Trello" @@ -15,7 +15,7 @@ "url": "https://github.com/alexAubin/" }, "requirements": { - "yunohost": ">= 2.7.2" + "yunohost": ">= 3.0.0" }, "multi_instance": true, "services": [ diff --git a/scripts/install b/scripts/install index ff9bb84..b70bef8 100755 --- a/scripts/install +++ b/scripts/install @@ -50,12 +50,7 @@ ynh_app_setting_set $app port $port #================================================= ynh_install_nodejs 8.9.3 -# Install mongodb -wget https://www.mongodb.org/static/pgp/server-3.2.asc -O - | apt-key add - -echo "deb http://repo.mongodb.org/apt/debian jessie/mongodb-org/3.2 main" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.2.list - -ynh_install_app_dependencies "mongodb-org mongodb-org-server mongodb-org-shell mongodb-org-mongos mongodb-org-tools" - +ynh_install_app_dependencies "mongodb mongodb-server" #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE @@ -89,8 +84,8 @@ npm install popd # Start mogodb -systemctl enable mongod -systemctl restart mongod +systemctl enable mongodb +systemctl restart mongodb #================================================= # SETUP SYSTEMD @@ -117,7 +112,7 @@ find "$final_path" -type d -print0 | xargs -0 chmod 750 #================================================= # ADD SERVICE IN ADMIN PANEL #================================================= -yunohost service add mongod --log "/var/log/mongodb.log" +yunohost service add mongodb --log "/var/log/mongodb/mongodb.log" yunohost service add $app #================================================= diff --git a/scripts/remove b/scripts/remove index f032562..f0cfa95 100755 --- a/scripts/remove +++ b/scripts/remove @@ -49,23 +49,12 @@ ynh_remove_app_dependencies ynh_remove_nodejs - -#================================================= -# REMOVE MONGODB -#================================================= -# TODO / FIXME : remove the keys added ? -#apt-key del EA312927 -#apt-key del 0C49F3730359A14518585931BC711F9BA15703C6 - -#rm -f /etc/apt/sources.list.d/mongodb-org-3.2.list - #================================================= # REMOVE THE MAIN DIR OF THE APP #================================================= ynh_secure_remove "/var/www/$app" - #================================================= # REMOVE THE NGINX CONFIGURATION #================================================= diff --git a/scripts/restore b/scripts/restore index e986596..9649ae7 100644 --- a/scripts/restore +++ b/scripts/restore @@ -55,17 +55,14 @@ ynh_system_user_create $app "$final_path" ynh_install_nodejs 4.8.7 # Install mongodb -wget https://www.mongodb.org/static/pgp/server-3.2.asc -O - | apt-key add - -echo "deb http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.2 multiverse" > /etc/apt/sources.list.d/mongodb-org-3.2.list - -ynh_install_app_dependencies "mongodb-org mongodb-org-server mongodb-org-shell mongodb-org-mongos mongodb-org-tools" +ynh_install_app_dependencies "mongodb mongodb-server" #================================================= # RESTORE DB #================================================= # Start mogodb -systemctl enable mongod -systemctl start mongod +systemctl enable mongodb +systemctl start mongodb mongorestore --db $app ./dump #================================================= @@ -92,7 +89,7 @@ find "$final_path" -type d -print0 | xargs -0 chmod 750 #================================================= # ADD SERVICE IN ADMIN PANEL #================================================= -yunohost service add mongod --log "/var/log/mongodb.log" +yunohost service add mongodb --log "/var/log/mongodb/mongodb.log" yunohost service add $app #================================================= From 0ab0735570f34cbdd49149276181678728687d7e Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Sun, 1 Jul 2018 17:28:26 +0000 Subject: [PATCH 5/9] Propagate changes via the upgrade script --- scripts/upgrade | 40 ++++++++++++++++++++++++++-------------- 1 file changed, 26 insertions(+), 14 deletions(-) diff --git a/scripts/upgrade b/scripts/upgrade index ddf1327..e6b37f2 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -25,6 +25,8 @@ port=$(ynh_app_setting_get $app port) # Check version #================================================= abort_if_up_to_date +# previous function is what defines 'version', more precisely the 'previous version' +previous_version="${version}" #================================================= # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP @@ -40,25 +42,14 @@ ynh_abort_if_errors # Exit if an error occurs during the execution of the script # ENSURE DOWNWARD COMPATIBILITY #================================================= -if ynh_version_gt "0.45-2" "${version}" ; then +if ynh_version_gt "0.45-2" "${previous_version}" ; then ynh_replace_string "Environment=ROOT_URL=http://127.0.0.1:$port$path_url" "Environment=ROOT_URL=https://$domain$path_url/" "/etc/systemd/system/$app.service" systemctl daemon-reload fi -if ynh_version_gt "0.45-3" "${version}" ; then +if ynh_version_gt "0.45-3" "${previous_version}" ; then yunohost service add $app fi -if ynh_version_gt "0.54-2" "${version}" ; then - systemctl enable mongod - systemctl restart mongod -fi -if ynh_version_gt "0.54-3" "${version}" ; then - apt-key del EA312927 - wget https://www.mongodb.org/static/pgp/server-3.2.asc -O - | apt-key add - -fi -if ynh_version_gt "0.63-1" "${version}" ; then - ynh_install_nodejs 4.8.7 -fi -if ynh_version_gt "0.77-2" "${version}" ; then +if ynh_version_gt "0.77-2" "${previous_version}" ; then ynh_install_nodejs 8.9.3 # Create a dedicated systemd config ynh_replace_string "__NODEJS__" "$nodejs_use_version" "../conf/systemd.service" @@ -69,6 +60,27 @@ if ynh_version_gt "0.77-2" "${version}" ; then ynh_replace_string "__DOMAIN__" "$domain" "../conf/systemd.service" ynh_add_systemd_config fi +if ynh_version_gt "1.07~ynh2" "${previous_version}" ; then + + # Replace mongodb packages + # Assume no other app needs it >.> + rm -f /etc/apt/sources.list.d/mongodb-org-3.2.list + ynh_remove_app_dependencies + ynh_install_app_dependencies "mongodb mongodb-server" + yunohost service remove mongod + yunohost service add mongodb --log "/var/log/mongodb/mongodb.log" + + # Gotta regen the systemd config because mongodb service name changed + nodejs_version=$(ynh_app_setting_get $app nodejs_version) + nodejs_use_version="$n_install_dir/bin/n -q $nodejs_version" + ynh_replace_string "__NODEJS__" "$nodejs_use_version" "../conf/systemd.service" + ynh_replace_string "__ENV_PATH__" "$PATH" "../conf/systemd.service" + ynh_replace_string "__DB_NAME__" "$app" "../conf/systemd.service" + ynh_replace_string "__URI__" "$path_url/" "../conf/systemd.service" + ynh_replace_string "__PORT__" "$port" "../conf/systemd.service" + ynh_replace_string "__DOMAIN__" "$domain" "../conf/systemd.service" + ynh_add_systemd_config +fi #================================================= From 4f2edf131882915b3f38e0850b29109b55d343d5 Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Sun, 1 Jul 2018 17:29:26 +0000 Subject: [PATCH 6/9] Improve ynh_version_gt helper (it doesn't properly rank the part after ~) --- scripts/_future.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/_future.sh b/scripts/_future.sh index 83a5313..1fa0e09 100644 --- a/scripts/_future.sh +++ b/scripts/_future.sh @@ -210,4 +210,4 @@ EOF chmod +x "/etc/cron.daily/node_update" } -ynh_version_gt() { test "$(printf '%s\n' "$@" | sort -V | head -n 1)" != "$1"; } +ynh_version_gt() { dpkg --compare-versions "$1" gt "$2" } From 7fe0f4ad95416cfd76ed5dd08160f641aeb2f217 Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Sun, 1 Jul 2018 17:29:50 +0000 Subject: [PATCH 7/9] Fix #6 --- scripts/_future.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/_future.sh b/scripts/_future.sh index 1fa0e09..b67722a 100644 --- a/scripts/_future.sh +++ b/scripts/_future.sh @@ -160,6 +160,7 @@ ynh_remove_nodejs () { ynh_secure_remove "$n_install_dir" ynh_secure_remove "/usr/local/n" sed --in-place "/N_PREFIX/d" /root/.bashrc + rm -f /etc/cron.daily/node_update fi } From 016ff5bbe5424f0e4acebb3fbc23186690876987 Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Tue, 23 Oct 2018 15:25:22 +0200 Subject: [PATCH 8/9] [fix] Syntax issue in _future.sh D: --- scripts/_future.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/scripts/_future.sh b/scripts/_future.sh index b67722a..44bf9a9 100644 --- a/scripts/_future.sh +++ b/scripts/_future.sh @@ -211,4 +211,7 @@ EOF chmod +x "/etc/cron.daily/node_update" } -ynh_version_gt() { dpkg --compare-versions "$1" gt "$2" } +ynh_version_gt () +{ + dpkg --compare-versions "$1" gt "$2" +} From d2c3e666e912a1e95f744c3eb757ef63768b86bc Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Thu, 13 Dec 2018 22:50:15 +0100 Subject: [PATCH 9/9] Add info messages + add tempo to make sure wekan is started before finishing the install --- scripts/install | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/scripts/install b/scripts/install index b70bef8..d2d3064 100755 --- a/scripts/install +++ b/scripts/install @@ -48,13 +48,18 @@ ynh_app_setting_set $app port $port #================================================= # INSTALL DEPENDENCIES #================================================= + +ynh_print_info "Installing nodejs ..." ynh_install_nodejs 8.9.3 +ynh_print_info "Installing mongodb dependencies ..." ynh_install_app_dependencies "mongodb mongodb-server" #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= + +ynh_print_info "Setting up Wekan's sources ..." ynh_app_setting_set $app final_path $final_path # Download, check integrity, uncompress and patch the source from app.src # For this app sources are in app subdirectory @@ -63,7 +68,9 @@ ynh_setup_source "$final_path" #================================================= # NGINX CONFIGURATION #================================================= + # Create a dedicated nginx config +ynh_print_info "Configuring nginx ..." ynh_add_nginx_config #================================================= @@ -77,6 +84,7 @@ ynh_system_user_create $app "$final_path" # SPECIFIC SETUP #================================================= # Install wekan dependencies +ynh_print_info "Installing npm dependencies ..." chown -R $app $final_path pushd $final_path/programs/server ynh_use_nodejs @@ -84,6 +92,7 @@ npm install popd # Start mogodb +ynh_print_info "Starting mongodb ..." systemctl enable mongodb systemctl restart mongodb @@ -91,6 +100,7 @@ systemctl restart mongodb # SETUP SYSTEMD #================================================= # Create a dedicated systemd config +ynh_print_info "Adding wekan systemd service ..." ynh_replace_string "__NODEJS__" "$nodejs_use_version" "../conf/systemd.service" ynh_replace_string "__ENV_PATH__" "$PATH" "../conf/systemd.service" ynh_replace_string "__DB_NAME__" "$app" "../conf/systemd.service" @@ -104,6 +114,7 @@ ynh_add_systemd_config #================================================= # SECURE FILES AND DIRECTORIES #================================================= +ynh_print_info "Fixing permissions ..." # Set strong right permissions to app files chown -R $app: "$final_path" chmod -R 640 "$final_path" @@ -129,5 +140,9 @@ fi #================================================= # RELOAD NGINX #================================================= +ynh_print_info "Starting wekan ..." systemctl restart $app systemctl reload nginx + +ynh_print_info "Waiting for wekan to be up ..." +sleep 10