diff --git a/README.md b/README.md index 88aae51..c82db23 100644 --- a/README.md +++ b/README.md @@ -49,7 +49,6 @@ LDAP is supported but HTTP auth is still not supported * x86-64b - [![Build Status](https://ci-apps.yunohost.org/ci/logs/wekan%20%28Apps%29.svg)](https://ci-apps.yunohost.org/ci/apps/wekan/) * ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/wekan%20%28Apps%29.svg)](https://ci-apps-arm.yunohost.org/ci/apps/wekan/) -* Jessie x86-64b - [![Build Status](https://ci-stretch.nohost.me/ci/logs/wekan%20%28Apps%29.svg)](https://ci-stretch.nohost.me/ci/apps/wekan/) ## Links diff --git a/scripts/backup b/scripts/backup index e4cd62a..92585fb 100644 --- a/scripts/backup +++ b/scripts/backup @@ -13,6 +13,7 @@ source /usr/share/yunohost/helpers #================================================= # MANAGE SCRIPT FAILURE #================================================= +ynh_print_info --message="Managing script failure..." ynh_clean_setup () { ynh_clean_check_starting @@ -36,9 +37,9 @@ db_name=$(ynh_app_setting_get --app=$app --key=db_name) #================================================= # STOP SYSTEMD SERVICE #================================================= -ynh_print_info --message="Stopping $app service..." +ynh_print_info --message="Stopping a systemd service..." -ynh_systemd_action --service_name=$app --action="stop" --log_path="systemd" +ynh_systemd_action --service_name=$app --action="stop" --log_path=systemd #================================================= # BACKUP THE APP MAIN DIR @@ -73,10 +74,12 @@ ynh_backup --src_path="/etc/systemd/system/$app.service" #================================================= # START SYSTEMD SERVICE #================================================= -ynh_print_info --message="Starting $app service..." +ynh_print_info --message="Starting a systemd service..." -ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="Started Wekan, task board" -sleep 30 +ynh_systemd_action --service_name=$app --action="start" --log_path=systemd --line_match="Started Wekan, task board" +if [ ${PACKAGE_CHECK_EXEC:-0} -eq 1 ]; then + sleep 60 +fi #================================================= # END OF SCRIPT diff --git a/scripts/change_url b/scripts/change_url index 08a8537..3e51575 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -30,9 +30,29 @@ ynh_print_info --message="Loading installation settings..." final_path=$(ynh_app_setting_get --app=$app --key=final_path) # Add settings here as needed by your application +#db_name=$(ynh_app_setting_get --app=$app --key=db_name) +#db_user=$db_name +#db_pwd=$(ynh_app_setting_get --app=$app --key=db_pwd) port=$(ynh_app_setting_get --app=$app --key=port) +#================================================= +# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP +#================================================= +ynh_print_info --message="Backing up the app before changing its url (may take a while)..." + +# Backup the current version of the app +ynh_backup_before_upgrade +ynh_clean_setup () { + # Remove the new domain config file, the remove script won't do it as it doesn't know yet its location. + ynh_secure_remove --file="/etc/nginx/conf.d/$new_domain.d/$app.conf" + + # restore it if the upgrade fails + ynh_restore_upgradebackup +} +# Exit if an error occurs during the execution of the script +ynh_abort_if_errors + #================================================= # CHECK WHICH PARTS SHOULD BE CHANGED #================================================= @@ -54,9 +74,9 @@ fi #================================================= # STOP SYSTEMD SERVICE #================================================= -ynh_print_info --message="Stopping $app service..." +ynh_print_info --message="Stopping a systemd service..." -ynh_systemd_action --service_name=$app --action="stop" --log_path="systemd" +ynh_systemd_action --service_name=$app --action="stop" --log_path=systemd #================================================= # MODIFY URL IN NGINX CONF @@ -101,10 +121,12 @@ ynh_replace_string --match_string="$old_domain$old_path" --replace_string="$new_ #================================================= # START SYSTEMD SERVICE #================================================= -ynh_print_info --message="Starting $app service..." +ynh_print_info --message="Starting a systemd service..." -ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="Started Wekan, task board" -sleep 30 +ynh_systemd_action --service_name=$app --action="start" --log_path=systemd --line_match="Started Wekan, task board" +if [ ${PACKAGE_CHECK_EXEC:-0} -eq 1 ]; then + sleep 60 +fi #================================================= # RELOAD NGINX diff --git a/scripts/install b/scripts/install index fff17ad..4c7e1e3 100755 --- a/scripts/install +++ b/scripts/install @@ -13,6 +13,7 @@ source /usr/share/yunohost/helpers #================================================= # MANAGE SCRIPT FAILURE #================================================= +ynh_print_info --message="Managing script failure..." ynh_clean_setup () { ynh_clean_check_starting @@ -23,6 +24,7 @@ ynh_abort_if_errors #================================================= # RETRIEVE ARGUMENTS FROM THE MANIFEST #================================================= +ynh_print_info --message="Retrieving arguments from the manifest..." domain=$YNH_APP_ARG_DOMAIN path_url=$YNH_APP_ARG_PATH @@ -64,7 +66,7 @@ ynh_app_setting_set --app=$app --key=is_public --value=$is_public #================================================= ynh_print_info --message="Configuring firewall..." -# Find a free port +# Find an available port port=$(ynh_find_port --port=8095) ynh_app_setting_set --app=$app --key=port --value=$port @@ -79,9 +81,9 @@ ynh_use_nodejs ynh_install_app_dependencies $pkg_dependencies #================================================= -# START MONGODB +# CREATE A MONGODB DATABASE #================================================= -ynh_print_info --message="Starting mongodb ..." +ynh_print_info --message="Creating a MongoDB database..." # Start mongodb systemctl enable mongodb @@ -130,6 +132,7 @@ ynh_add_systemd_config #================================================= # MODIFY A CONFIG FILE #================================================= +ynh_print_info --message="Modifying a config file..." config_file="$final_path/.env" cp "../conf/.env" $config_file @@ -143,6 +146,7 @@ ynh_replace_string --match_string="__PORT__" --replace_string="$port" --target_f #================================================= # STORE THE CONFIG FILE CHECKSUM #================================================= +ynh_print_info --message="Storing the config file checksum..." # Calculate and store the config file checksum into the app settings ynh_store_file_checksum --file="$config_file" @@ -152,7 +156,7 @@ ynh_store_file_checksum --file="$config_file" #================================================= # SECURE FILES AND DIRECTORIES #================================================= -ynh_print_info --message="Configuring file permissions ..." +ynh_print_info --message="Securing files and directories..." # Set strong right permissions to app files chown -R $app: "$final_path" @@ -160,20 +164,24 @@ chmod -R 640 "$final_path" find "$final_path" -type d -print0 | xargs -0 chmod 750 #================================================= -# ADVERTISE SERVICE IN ADMIN PANEL +# INTEGRATE SERVICE IN YUNOHOST #================================================= +ynh_print_info --message="Integrating service in YunoHost..." + +yunohost service add $app --description "Wekan daemon" +yunohost service add mongodb --description "MongoDB daemon" --log "/var/log/mongodb/mongodb.log" -yunohost service add mongodb --log "/var/log/mongodb/mongodb.log" -yunohost service add $app #================================================= # START SYSTEMD SERVICE #================================================= -ynh_print_info --message="Starting $app service..." +ynh_print_info --message="Starting a systemd service..." # Start a systemd service -ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="Meteor APM: completed instrumenting the app" -sleep 30 +ynh_systemd_action --service_name=$app --action="start" --log_path=systemd --line_match="Meteor APM: completed instrumenting the app" +if [ ${PACKAGE_CHECK_EXEC:-0} -eq 1 ]; then + sleep 60 +fi #================================================= # SETUP SSOWAT diff --git a/scripts/remove b/scripts/remove index 17a7906..f29331b 100755 --- a/scripts/remove +++ b/scripts/remove @@ -19,16 +19,17 @@ app=$YNH_APP_INSTANCE_NAME domain=$(ynh_app_setting_get --app=$app --key=domain) port=$(ynh_app_setting_get --app=$app --key=port) db_name=$(ynh_app_setting_get --app=$app --key=db_name) - +db_user=$db_name final_path=$(ynh_app_setting_get --app=$app --key=final_path) #================================================= # STANDARD REMOVE #================================================= -# REMOVE SERVICE FROM ADMIN PANEL +# REMOVE SERVICE INTEGRATION IN YUNOHOST #================================================= +ynh_print_info --message="Removing service integration in YunoHost..." -# Remove a service from the admin panel, added by `yunohost service add` +# Remove the service from the list of services known by Yunohost (added from `yunohost service add`) if ynh_exec_warn_less yunohost service status $app >/dev/null then ynh_print_info --message="Removing $app service..." @@ -63,7 +64,7 @@ ynh_remove_nodejs #================================================= # REMOVE APP MAIN DIR #================================================= -ynh_print_info --message="Removing app main directory" +ynh_print_info --message="Removing app main directory..." # Remove the app directory securely ynh_secure_remove --file="$final_path" diff --git a/scripts/restore b/scripts/restore index b74cb0c..0eb0e07 100644 --- a/scripts/restore +++ b/scripts/restore @@ -13,6 +13,7 @@ source /usr/share/yunohost/helpers #================================================= # MANAGE SCRIPT FAILURE #================================================= +ynh_print_info --message="Managing script failure..." ynh_clean_setup () { ynh_clean_check_starting @@ -68,6 +69,7 @@ ynh_system_user_create --username=$app --home_dir="$final_path" #================================================= # RESTORE USER RIGHTS #================================================= +ynh_print_info --message="Restoring user rights..." # Restore permissions on app files chown -R $app: "$final_path" @@ -106,19 +108,23 @@ ynh_restore_file --origin_path="/etc/systemd/system/$app.service" systemctl enable $app.service #================================================= -# ADVERTISE SERVICE IN ADMIN PANEL +# INTEGRATE SERVICE IN YUNOHOST #================================================= +ynh_print_info --message="Integrating service in YunoHost..." +yunohost service add $app --description "Wekan daemon" yunohost service add mongodb --log "/var/log/mongodb/mongodb.log" -yunohost service add $app + #================================================= # START SYSTEMD SERVICE #================================================= -ynh_print_info --message="Starting $app service..." +ynh_print_info --message="Starting a systemd service..." -ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="Started Wekan, task board" -sleep 30 +ynh_systemd_action --service_name=$app --action="start" --log_path=systemd --line_match="Started Wekan, task board" +if [ ${PACKAGE_CHECK_EXEC:-0} -eq 1 ]; then + sleep 60 +fi #================================================= # GENERIC FINALIZATION diff --git a/scripts/upgrade b/scripts/upgrade index 2ae33eb..4880de0 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -46,6 +46,9 @@ fi # CHECK VERSION NUMBER #================================================= +if [ ${PACKAGE_CHECK_EXEC:-0} -eq 1 ]; then + sleep 60 +fi abort_if_up_to_date # previous function is what defines 'version', more precisely the 'previous version' previous_version="${version}" @@ -166,9 +169,9 @@ path_url=$(ynh_normalize_url_path --path_url=$path_url) #================================================= # STOP SYSTEMD SERVICE #================================================= -ynh_print_info --message="Stopping $app service..." +ynh_print_info --message="Stopping a systemd service..." -ynh_systemd_action --service_name=$app --action="stop" --log_path="systemd" +ynh_systemd_action --service_name=$app --action="stop" --log_path=systemd #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE @@ -238,6 +241,7 @@ ynh_add_systemd_config #================================================= # SECURE FILES AND DIRECTORIES #================================================= +ynh_print_info --message="Securing files and directories..." # Set permissions on app files chown -R $app: "$final_path" @@ -261,8 +265,10 @@ fi #================================================= ynh_print_info --message="Starting a systemd service..." -ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="Started Wekan, task board" -sleep 30 +ynh_systemd_action --service_name=$app --action="start" --log_path=systemd --line_match="Started Wekan, task board" +if [ ${PACKAGE_CHECK_EXEC:-0} -eq 1 ]; then + sleep 60 +fi #================================================= # RELOAD NGINX