diff --git a/README.md b/README.md index ae3f6d3..1b655da 100644 --- a/README.md +++ b/README.md @@ -52,10 +52,6 @@ LDAP is supported but and HTTP auth is stil not supported * ARMv8-A - Not supported * Jessie x86-64b - [![Build Status](https://ci-stretch.nohost.me/ci/logs/wekan%20%28Community%29.svg)](https://ci-stretch.nohost.me/ci/apps/wekan/) -## Limitations - -* Any known limitations. - ## Links * Report a bug: https://github.com/YunoHost-Apps/wekan_ynh/issues diff --git a/scripts/install b/scripts/install index 78ea13f..a8afc96 100755 --- a/scripts/install +++ b/scripts/install @@ -25,22 +25,11 @@ ynh_abort_if_errors # RETRIEVE ARGUMENTS FROM THE MANIFEST #================================================= +app=$YNH_APP_INSTANCE_NAME domain=$YNH_APP_ARG_DOMAIN path_url=$YNH_APP_ARG_PATH is_public=$YNH_APP_ARG_IS_PUBLIC -### If it's a multi-instance app, meaning it can be installed several times independently -### The id of the app as stated in the manifest is available as $YNH_APP_ID -### The instance number is available as $YNH_APP_INSTANCE_NUMBER (equals "1", "2", ...) -### The app instance name is available as $YNH_APP_INSTANCE_NAME -### - the first time the app is installed, YNH_APP_INSTANCE_NAME = ynhexample -### - the second time the app is installed, YNH_APP_INSTANCE_NAME = ynhexample__2 -### - ynhexample__{N} for the subsequent installations, with N=3,4, ... -### The app instance name is probably what interests you most, since this is -### guaranteed to be unique. This is a good unique identifier to define installation path, -### db names, ... -app=$YNH_APP_INSTANCE_NAME - #================================================= # CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS #================================================= @@ -54,9 +43,6 @@ ynh_print_info "Validating installation parameters..." final_path=/var/www/$app test ! -e "$final_path" || ynh_die "This path already contains a folder" -# Normalize the url path syntax -path_url=$(ynh_normalize_url_path $path_url) - # Register (book) web path ynh_webpath_register $app $domain $path_url @@ -68,25 +54,16 @@ ynh_print_info "Storing installation settings..." ynh_app_setting_set $app domain $domain ynh_app_setting_set $app path $path_url ynh_app_setting_set $app is_public $is_public - -#================================================= -# STANDARD MODIFICATIONS -#================================================= -# FIND AND OPEN A PORT -#================================================= -ynh_print_info "Configuring firewall..." - -### Use these lines if you have to open a port for the application -### `ynh_find_port` will find the first available port starting from the given port. -### If you're not using these lines: -### - Remove the section "CLOSE A PORT" in the remove script +ynh_app_setting_set $app final_path $final_path # Find a free port port=$(ynh_find_port 8095) -# Open this port -#ynh_exec_warn_less yunohost firewall allow --no-upnp TCP $port ynh_app_setting_set $app port $port +# Registering db name +db_name=$(ynh_sanitize_dbid $app) +ynh_app_setting_set $app db_name $db_name + #================================================= # INSTALL DEPENDENCIES #================================================= @@ -113,34 +90,15 @@ ynh_print_info "Starting mongodb ..." systemctl enable mongodb systemctl restart mongodb -#================================================= -# CREATE A MONGODB DATABASE -#================================================= -ynh_print_info "Creating a MongoDB database..." - -### Use these lines if you need a database for the application. -### `ynh_mysql_setup_db` will create a database, an associated user and a ramdom password. -### The password will be stored as 'mysqlpwd' into the app settings, -### and will be available as $db_pwd -### If you're not using these lines: -### - Remove the section "BACKUP THE MYSQL DATABASE" in the backup script -### - Remove also the section "REMOVE THE MYSQL DATABASE" in the remove script -### - As well as the section "RESTORE THE MYSQL DATABASE" in the restore script - -db_name=$(ynh_sanitize_dbid $app) -ynh_app_setting_set $app db_name $db_name -#ynh_mysql_setup_db $db_name $db_name - #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= -ynh_print_info "Setting up source files..." +ynh_print_info "Setting up wekan source files..." ### `ynh_setup_source` is used to install an app from a zip or tar.gz file, ### downloaded from an upstream source, like a git repository. ### `ynh_setup_source` use the file conf/app.src -ynh_app_setting_set $app final_path $final_path # Download, check integrity, uncompress and patch the source from app.src ynh_setup_source "$final_path" @@ -213,7 +171,7 @@ ynh_store_file_checksum "$final_path/.env" #================================================= # SECURE FILES AND DIRECTORIES #================================================= -ynh_print_info "Fixing permissions ..." +ynh_print_info "Configuring file permissions ..." ### For security reason, any app should set the permissions to root: before anything else. ### Then, if write authorization is needed, any access should be given only to directories @@ -260,6 +218,7 @@ systemctl reload nginx #================================================= # START SERVICE #================================================= +ynh_print_info "Now starting Wekan service..." ynh_systemd_action --action=start --service_name=$app --log_path="systemd" --line_match="Kadira: completed instrumenting the app" sleep 10 diff --git a/scripts/remove b/scripts/remove index f08fad7..9e7b861 100755 --- a/scripts/remove +++ b/scripts/remove @@ -82,16 +82,6 @@ ynh_print_info "Removing nginx web server configuration" # Remove the dedicated nginx config ynh_remove_nginx_config -#================================================= -# CLOSE A PORT -#================================================= - -if yunohost firewall list | grep -q "\- $port$" -then - ynh_print_info "Closing port $port" - ynh_exec_warn_less yunohost firewall disallow TCP $port -fi - #================================================= # GENERIC FINALIZATION #================================================= diff --git a/scripts/restore b/scripts/restore index cccd9a3..9f0b9c1 100644 --- a/scripts/restore +++ b/scripts/restore @@ -106,6 +106,7 @@ mongorestore --db $db_name ./dump/$db_name ynh_print_info "Restoring the systemd configuration..." ynh_restore_file "/etc/systemd/system/$app.service" +systemctl daemon-reload systemctl enable $app.service #================================================= @@ -127,6 +128,7 @@ systemctl reload nginx #================================================= # START SERVICE #================================================= +ynh_print_info "Now starting Wekan service..." ynh_systemd_action --action=start --service_name=$app --log_path="systemd" --line_match="Kadira: completed instrumenting the app" sleep 10 diff --git a/scripts/upgrade b/scripts/upgrade index 3c9fbe0..c312b7b 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -25,6 +25,7 @@ final_path=$(ynh_app_setting_get $app final_path) db_name=$(ynh_app_setting_get $app db_name) port=$(ynh_app_setting_get $app port) +# Previous versions of the app did not have the db_name setting if [ -z "$db_name" ] then db_name=$app @@ -91,10 +92,10 @@ if ynh_version_gt "1.07~ynh2" "${previous_version}" ; then # Gotta regen the systemd config because mongodb service name changed ynh_use_nodejs - ynh_replace_string "__ENV_PATH__" "$nodejs_path" "../conf/systemd.service" - ynh_replace_string "__DB_NAME__" "$db_name" "../conf/systemd.service" - ynh_replace_string "__DOMAIN_URI__" "$domain$path_url" "../conf/systemd.service" - ynh_replace_string "__PORT__" "$port" "../conf/systemd.service" + ynh_replace_string "__ENV_PATH__" "$nodejs_path" "../conf/systemd.service" + ynh_replace_string "__DB_NAME__" "$db_name" "../conf/systemd.service" + ynh_replace_string "__DOMAIN_URI__" "$domain$path_url" "../conf/systemd.service" + ynh_replace_string "__PORT__" "$port" "../conf/systemd.service" ynh_add_systemd_config fi @@ -173,6 +174,7 @@ systemctl reload nginx #================================================= # START SERVICE #================================================= +ynh_print_info "Now restarting Wekan service..." ynh_systemd_action --action=restart --service_name=$app --log_path="systemd" --line_match="Kadira: completed instrumenting the app" diff --git a/scripts/ynh_package_version b/scripts/ynh_package_version index 816f97a..d6cdc4d 100644 --- a/scripts/ynh_package_version +++ b/scripts/ynh_package_version @@ -15,7 +15,7 @@ abort_if_up_to_date () { version=$(read_json "/etc/yunohost/apps/$YNH_APP_INSTANCE_NAME/manifest.json" 'version' 2> /dev/null || echo '20160501-7') last_version=$(read_manifest 'version') if [ "${version}" = "${last_version}" ]; then - info "Up-to-date, nothing to do" + ynh_print_info "Up-to-date, nothing to do" ynh_die "" 0 fi }