From 21f1d0b509baeafc7cd22ee04c5472812c297291 Mon Sep 17 00:00:00 2001 From: Yunohost-Bot <> Date: Sat, 31 Aug 2024 01:07:18 +0200 Subject: [PATCH 1/6] [autopatch] Automatic patch attempt for helpers 2.1 --- .gitignore | 1 + conf/systemd.service | 2 +- manifest.toml | 3 ++- scripts/_common.sh | 17 +++--------- scripts/backup | 25 ++++++------------ scripts/change_url | 32 ++++++++-------------- scripts/install | 55 ++++++++++++++++++-------------------- scripts/remove | 24 +++++++---------- scripts/restore | 44 ++++++++++++------------------- scripts/upgrade | 63 ++++++++++++++++++++------------------------ 10 files changed, 105 insertions(+), 161 deletions(-) diff --git a/.gitignore b/.gitignore index 783a4ae..8f144f3 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ *~ *.sw[op] +.DS_Store diff --git a/conf/systemd.service b/conf/systemd.service index ca99d58..e967e61 100644 --- a/conf/systemd.service +++ b/conf/systemd.service @@ -9,7 +9,7 @@ User=__APP__ Group=__APP__ EnvironmentFile=__INSTALL_DIR__/.env WorkingDirectory=__INSTALL_DIR__/ -ExecStart=__YNH_NODE__ __INSTALL_DIR__/app.js +ExecStart=__NODEJS_DIR__/node __INSTALL_DIR__/app.js StandardOutput=append:/var/log/__APP__/__APP__.log StandardError=inherit diff --git a/manifest.toml b/manifest.toml index de0d775..4187c94 100644 --- a/manifest.toml +++ b/manifest.toml @@ -17,7 +17,8 @@ code = "https://github.com/mongo-express/mongo-express" cpe = "cpe:2.3:a:mongo-express_project:mongo-express" [integration] -yunohost = ">= 11.2.12" +yunohost = ">= 11.2.18" +helpers_version = "2.1" architectures = ["amd64"] multi_instance = false diff --git a/scripts/_common.sh b/scripts/_common.sh index dbc7431..4792ef0 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -1,25 +1,14 @@ #!/bin/bash #================================================= -# COMMON VARIABLES +# COMMON VARIABLES AND CUSTOM HELPERS #================================================= nodejs_version=16 -YNH_MONGO_VERSION=6.0 +mongo_version=6.0 -#================================================= -# PERSONAL HELPERS -#================================================= - -#================================================= -# EXPERIMENTAL HELPERS -#================================================= _install_yarn () { - ynh_exec_as "$app" "$ynh_node_load_PATH" $ynh_npm install yarn + ynh_exec_as_app node_load_PATH" npm install yarn ynh_yarn="$install_dir/node_modules/.bin/yarn" alias ynh_yarn="$ynh_yarn" } - -#================================================= -# FUTURE OFFICIAL HELPERS -#================================================= diff --git a/scripts/backup b/scripts/backup index fefb54c..f05af5a 100755 --- a/scripts/backup +++ b/scripts/backup @@ -1,48 +1,39 @@ #!/bin/bash -#================================================= -# GENERIC START -#================================================= -# IMPORT GENERIC HELPERS -#================================================= - # Keep this path for calling _common.sh inside the execution's context of backup and restore scripts source ../settings/scripts/_common.sh source /usr/share/yunohost/helpers -#================================================= -# DECLARE DATA AND CONF FILES TO BACKUP -#================================================= -ynh_print_info --message="Declaring files to be backed up..." +ynh_print_info "Declaring files to be backed up..." #================================================= # BACKUP THE APP MAIN DIR #================================================= -ynh_backup --src_path="$install_dir" +ynh_backup "$install_dir" #================================================= # SYSTEM CONFIGURATION #================================================= # Backup the nginx configuration -ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf" +ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf" # Backup the systemd service unit -ynh_backup --src_path="/etc/systemd/system/$app.service" +ynh_backup "/etc/systemd/system/$app.service" # Backup the logrotate configuration -ynh_backup --src_path="/etc/logrotate.d/$app" +ynh_backup "/etc/logrotate.d/$app" -ynh_backup --src_path="/var/log/$app/" +ynh_backup "/var/log/$app/" #================================================= # DONT BACKUP THE MONGO DATABASE #================================================= -ynh_print_warn --message="Mongo data is NOT backed up by this application. Each application using it is backing up its own database..." +ynh_print_warn "Mongo data is NOT backed up by this application. Each application using it is backing up its own database..." #================================================= # END OF SCRIPT #================================================= -ynh_print_info --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)." +ynh_print_info "Backup script completed for $app. (YunoHost will then actually copy those files to the archive)." diff --git a/scripts/change_url b/scripts/change_url index 6b862f6..1f14e20 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -1,50 +1,40 @@ #!/bin/bash -#================================================= -# GENERIC STARTING -#================================================= -# IMPORT GENERIC HELPERS -#================================================= - source _common.sh source /usr/share/yunohost/helpers -#================================================= -# STANDARD MODIFICATIONS #================================================= # STOP SYSTEMD SERVICE #================================================= -ynh_script_progression --message="Stopping a systemd service..." --weight=1 +ynh_script_progression "Stopping $app's systemd service..." -ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app/$app.log" +ynh_systemctl --service=$app --action="stop" #================================================= # MODIFY URL IN NGINX CONF #================================================= -ynh_script_progression --message="Updating NGINX web server configuration..." --weight=1 +ynh_script_progression "Updating NGINX web server configuration..." -ynh_change_url_nginx_config +ynh_config_change_url_nginx #================================================= # SPECIFIC MODIFICATIONS #================================================= -ynh_script_progression --message="Updating .env configuration..." +ynh_script_progression "Updating .env configuration..." -ynh_backup_if_checksum_is_different --file="$install_dir/.env" -ynh_replace_string --match_string="$old_path" --replace_string="$new_path" --target_file="$install_dir/.env" -ynh_store_file_checksum --file="$install_dir/.env" +ynh_backup_if_checksum_is_different "$install_dir/.env" +ynh_replace --match="$old_path" --replace="$new_path" --file="$install_dir/.env" +ynh_store_file_checksum "$install_dir/.env" -#================================================= -# GENERIC FINALISATION #================================================= # START SYSTEMD SERVICE #================================================= -ynh_script_progression --message="Starting a systemd service..." --weight=1 +ynh_script_progression "Starting $app's systemd service..." -ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" +ynh_systemctl --service=$app --action="start" #================================================= # END OF SCRIPT #================================================= -ynh_script_progression --message="Change of URL completed for $app" --last +ynh_script_progression "Change of URL completed for $app" diff --git a/scripts/install b/scripts/install index 5649ceb..230d74a 100755 --- a/scripts/install +++ b/scripts/install @@ -1,25 +1,19 @@ #!/bin/bash -#================================================= -# GENERIC START -#================================================= -# IMPORT GENERIC HELPERS -#================================================= - source _common.sh source /usr/share/yunohost/helpers #================================================= # INSTALL DEPENDENCIES #================================================= -ynh_script_progression --message="Installing NodeJS & Yarn..." --weight=3 +ynh_script_progression "Installing NodeJS & Yarn..." -ynh_install_nodejs --nodejs_version="$nodejs_version" +ynh_nodejs_install # Install mongo server only if asked to if [ "$mongo_version" != "None" ]; then - ynh_script_progression --message="Installing MongoDB..." --weight=3 - ynh_install_mongo --mongo_version="$mongo_version" + ynh_script_progression "Installing MongoDB..." + ynh_install_mongo else # gives the mongo service name for the rest of installation mongodb_servicename=mongod @@ -28,65 +22,66 @@ fi #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= -ynh_script_progression --message="Setting up source files..." --weight=1 +ynh_script_progression "Setting up source files..." # Download, check integrity, uncompress and patch the source from amd64.src ynh_setup_source --dest_dir="$install_dir" cp "$install_dir/config.default.js" "$install_dir/config.js" -chmod -R o-rwx "$install_dir" -chown -R "$app:$app" "$install_dir" - -ynh_add_config --template=".env" --destination="$install_dir/.env" -chmod 400 "$install_dir/.env" -chown "$app:$app" "$install_dir/.env" +#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod -R o-rwx "$install_dir" +#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown -R "$app:$app" "$install_dir" +ynh_config_add --template=".env" --destination="$install_dir/.env" +#REMOVEME? Assuming the file is setup using ynh_config_add, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod 400 "$install_dir/.env" +#REMOVEME? Assuming the file is setup using ynh_config_add, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown "$app:$app" "$install_dir/.env" #================================================= # BUILD NODEJS CODE #================================================= -ynh_script_progression --message="Building NodeJS code ..." --weight=6 +ynh_script_progression "Building NodeJS code ..." # Build using Yarn pushd "$install_dir" - ynh_use_nodejs + # We must use npm to install yarn but without installing other dependencies as npm fails with them if [ -f "package.json" ]; then - mv package.json package.json.mov + mv package.json package.json.mov + fi _install_yarn if [ -f "package.json.mov" ]; then - mv package.json.mov package.json + mv package.json.mov package.json + fi - ynh_exec_as "$app" "$ynh_node_load_PATH" "$ynh_yarn" install - ynh_exec_as "$app" "$ynh_node_load_PATH" "$ynh_npm" run build + ynh_exec_as_app node_load_PATH" "$ynh_yarn" install + ynh_exec_as_app node_load_PATH" npm run build popd #================================================= # SYSTEM CONFIGURATION #================================================= -ynh_script_progression --message="Adding system configurations related to $app..." --weight=1 +ynh_script_progression "Adding system configurations related to $app..." # Create a dedicated NGINX config -ynh_add_nginx_config +ynh_config_add_nginx # Create a dedicated systemd config -ynh_add_systemd_config +ynh_config_add_systemd yunohost service add "$app" --description="Mongo Express to easily administer your Mongo databases" --log="/var/log/$app/$app.log" # Use logrotate to manage application logfile(s) -ynh_use_logrotate +ynh_config_add_logrotate #================================================= # START SYSTEMD SERVICE #================================================= -ynh_script_progression --message="Starting a systemd service..." --weight=1 +ynh_script_progression "Starting $app's systemd service..." # Start a systemd service -ynh_systemd_action --service_name="$app" --action="start" --log_path="/var/log/$app/$app.log" +ynh_systemctl --service="$app" --action="start" #================================================= # END OF SCRIPT #================================================= -ynh_script_progression --message="Installation of $app completed" --last +ynh_script_progression "Installation of $app completed" diff --git a/scripts/remove b/scripts/remove index 5f63d66..ca3a950 100755 --- a/scripts/remove +++ b/scripts/remove @@ -1,11 +1,5 @@ #!/bin/bash -#================================================= -# GENERIC START -#================================================= -# IMPORT GENERIC HELPERS -#================================================= - source _common.sh source /usr/share/yunohost/helpers @@ -16,30 +10,30 @@ source /usr/share/yunohost/helpers #================================================= # 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_script_progression --message="Removing $app service integration..." --weight=1 +if ynh_hide_warnings yunohost service status $app >/dev/null; then + ynh_script_progression "Removing $app service integration..." yunohost service remove "$app" fi # Remove the dedicated systemd config -ynh_remove_systemd_config +ynh_config_remove_systemd # Remove the app-specific logrotate config -ynh_remove_logrotate +ynh_config_remove_logrotate # Remove the dedicated NGINX config -ynh_remove_nginx_config +ynh_config_remove_nginx #================================================= # REMOVE DEPENDENCIES #================================================= -ynh_script_progression --message="Removing NodeJS..." --weight=1 +ynh_script_progression "Removing NodeJS..." # Remove the version of Nodejs used if needed -ynh_remove_nodejs +ynh_nodejs_remove if [ "$mongo_version" != "None" ]; then - ynh_script_progression --message="Removing the MongoDB database..." + ynh_script_progression "Removing the MongoDB database..." ynh_remove_mongo fi @@ -47,4 +41,4 @@ fi # END OF SCRIPT #================================================= -ynh_script_progression --message="Removal of $app completed" --last +ynh_script_progression "Removal of $app completed" diff --git a/scripts/restore b/scripts/restore index 8675f95..faf5ee7 100755 --- a/scripts/restore +++ b/scripts/restore @@ -1,11 +1,5 @@ #!/bin/bash -#================================================= -# GENERIC START -#================================================= -# IMPORT GENERIC HELPERS -#================================================= - # Keep this path for calling _common.sh inside the execution's context of backup and restore scripts source ../settings/scripts/_common.sh source /usr/share/yunohost/helpers @@ -13,25 +7,23 @@ source /usr/share/yunohost/helpers #================================================= # RESTORE THE APP MAIN DIR #================================================= -ynh_script_progression --message="Restoring the app main directory..." --weight=1 +ynh_script_progression "Restoring the app main directory..." -ynh_restore_file --origin_path="$install_dir" - -chmod -R o-rwx "$install_dir" -chown -R $app:$app "$install_dir" +ynh_restore "$install_dir" +#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod -R o-rwx "$install_dir" +#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown -R $app:$app "$install_dir" #================================================= # REINSTALL DEPENDENCIES #================================================= -ynh_script_progression --message="Reinstalling NodeJS..." --weight=3 +ynh_script_progression "Reinstalling NodeJS..." -ynh_install_nodejs --nodejs_version="$nodejs_version" -ynh_use_nodejs +ynh_nodejs_install # Install mongo server only if asked to if [ "$mongo_version" != "None" ]; then - ynh_script_progression --message="Reinstalling MongoDB..." --weight=3 - ynh_install_mongo --mongo_version="$mongo_version" + ynh_script_progression "Reinstalling MongoDB..." + ynh_install_mongo else # gives the mongo service name for the rest of installation mongodb_servicename=mongod @@ -40,35 +32,33 @@ fi #================================================= # RESTORE SYSTEM CONFIGURATIONS #================================================= -ynh_script_progression --message="Restoring system configurations related to $app..." --weight=1 +ynh_script_progression "Restoring system configurations related to $app..." -ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" +ynh_restore "/etc/nginx/conf.d/$domain.d/$app.conf" -ynh_restore_file --origin_path="/etc/systemd/system/$app.service" +ynh_restore "/etc/systemd/system/$app.service" systemctl enable "$app.service" --quiet yunohost service add "$app" --description="Mongo Express to easily administer your Mongo databases" --log="/var/log/$app/$app.log" -ynh_restore_file --origin_path="/etc/logrotate.d/$app" +ynh_restore "/etc/logrotate.d/$app" mkdir --parents /var/log/$app #================================================= # DONT RESTORE THE MONGO DATABASE #================================================= -ynh_print_warn --message="This application is NOT restoring Mongo Database!" +ynh_print_warn "This application is NOT restoring Mongo Database!" -#================================================= -# GENERIC FINALIZATION #================================================= # RELOAD NGINX AND PHP-FPM #================================================= -ynh_script_progression --message="Reloading NGINX web server and $app's service..." --weight=1 +ynh_script_progression "Reloading NGINX web server and $app's service..." -ynh_systemd_action --service_name="$app" --action="start" --log_path="/var/log/$app/$app.log" +ynh_systemctl --service="$app" --action="start" -ynh_systemd_action --service_name=nginx --action=reload +ynh_systemctl --service=nginx --action=reload #================================================= # END OF SCRIPT #================================================= -ynh_script_progression --message="Restoration completed for $app" --last +ynh_script_progression "Restoration completed for $app" diff --git a/scripts/upgrade b/scripts/upgrade index 2e29395..87b57f0 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -1,34 +1,26 @@ #!/bin/bash -#================================================= -# GENERIC START -#================================================= -# IMPORT GENERIC HELPERS -#================================================= - source _common.sh source /usr/share/yunohost/helpers -#================================================= -# STANDARD UPGRADE STEPS #================================================= # STOP SYSTEMD SERVICE #================================================= -ynh_script_progression --message="Stopping a systemd service..." --weight=1 +ynh_script_progression "Stopping $app's systemd service..." -ynh_systemd_action --service_name="$app" --action="stop" --log_path="/var/log/$app/$app.log" +ynh_systemctl --service="$app" --action="stop" #================================================= # INSTALL DEPENDENCIES #================================================= -ynh_script_progression --message="Installing NodeJS & Yarn" --weight=3 +ynh_script_progression "Installing NodeJS & Yarn" -ynh_install_nodejs --nodejs_version="$nodejs_version" +ynh_nodejs_install # Install mongo server only if asked to if [ "$mongo_version" != "None" ]; then - ynh_script_progression --message="Installing MongoDB..." --weight=3 - ynh_install_mongo --mongo_version="$mongo_version" + ynh_script_progression "Installing MongoDB..." + ynh_install_mongo else # gives the mongo service name for the rest of installation mongodb_servicename=mongod @@ -37,64 +29,65 @@ fi #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= -ynh_script_progression --message="Upgrading source files..." --weight=6 +ynh_script_progression "Upgrading source files..." # Download, check integrity, uncompress and patch the source from amd64.src -ynh_setup_source --full_replace=1 --dest_dir="$install_dir" +ynh_setup_source --full_replace --dest_dir="$install_dir" cp "$install_dir/config.default.js" "$install_dir/config.js" -chmod -R o-rwx "$install_dir" -chown -R "$app:$app" "$install_dir" - -ynh_add_config --template=".env" --destination="$install_dir/.env" -chmod 400 "$install_dir/.env" -chown "$app:$app" "$install_dir/.env" +#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod -R o-rwx "$install_dir" +#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown -R "$app:$app" "$install_dir" +ynh_config_add --template=".env" --destination="$install_dir/.env" +#REMOVEME? Assuming the file is setup using ynh_config_add, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod 400 "$install_dir/.env" +#REMOVEME? Assuming the file is setup using ynh_config_add, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown "$app:$app" "$install_dir/.env" #================================================= # BUILD NODEJS CODE #================================================= -ynh_script_progression --message="Installing Yarn and Buuilding application..." --weight=6 +ynh_script_progression "Installing Yarn and Buuilding application..." # Build using Yarn pushd "$install_dir" - ynh_use_nodejs + # We must use npm to install yarn but without installing other dependencies as npm fails with them if [ -f "package.json" ]; then - mv package.json package.json.mov + mv package.json package.json.mov + fi _install_yarn if [ -f "package.json.mov" ]; then - mv package.json.mov package.json + mv package.json.mov package.json + fi - ynh_exec_as "$app" "$ynh_node_load_PATH" "$ynh_yarn" install - ynh_exec_as "$app" "$ynh_node_load_PATH" "$ynh_npm" run build + ynh_exec_as_app node_load_PATH" "$ynh_yarn" install + ynh_exec_as_app node_load_PATH" npm run build popd #================================================= # REAPPLY SYSTEM CONFIGURATIONS #================================================= -ynh_script_progression --message="Upgrading system configurations related to $app..." --weight=1 +ynh_script_progression "Upgrading system configurations related to $app..." # Create a dedicated NGINX config -ynh_add_nginx_config +ynh_config_add_nginx # Create a dedicated systemd config -ynh_add_systemd_config +ynh_config_add_systemd yunohost service add "$app" --description="Mongo Express to easily administer your Mongo databases" --log="/var/log/$app/$app.log" # Use logrotate to manage app-specific logfile(s) -ynh_use_logrotate --non-append +ynh_config_add_logrotate #================================================= # START SYSTEMD SERVICE #================================================= -ynh_script_progression --message="Starting a systemd service..." --weight=1 +ynh_script_progression "Starting $app's systemd service..." -ynh_systemd_action --service_name="$app" --action="start" --log_path="/var/log/$app/$app.log" +ynh_systemctl --service="$app" --action="start" #================================================= # END OF SCRIPT #================================================= -ynh_script_progression --message="Upgrade of $app completed" --last +ynh_script_progression "Upgrade of $app completed" From d82ba6b37d9cafb1a086a36c1e0eaf3637eae87b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Mon, 2 Sep 2024 13:39:30 +0200 Subject: [PATCH 2/6] cleaning --- manifest.toml | 2 +- scripts/_common.sh | 2 +- scripts/install | 4 ---- scripts/restore | 2 -- scripts/upgrade | 4 ---- 5 files changed, 2 insertions(+), 12 deletions(-) diff --git a/manifest.toml b/manifest.toml index 4187c94..19e1a38 100644 --- a/manifest.toml +++ b/manifest.toml @@ -17,7 +17,7 @@ code = "https://github.com/mongo-express/mongo-express" cpe = "cpe:2.3:a:mongo-express_project:mongo-express" [integration] -yunohost = ">= 11.2.18" +yunohost = ">= 11.2.29" helpers_version = "2.1" architectures = ["amd64"] multi_instance = false diff --git a/scripts/_common.sh b/scripts/_common.sh index 4792ef0..2d4d5fd 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -8,7 +8,7 @@ nodejs_version=16 mongo_version=6.0 _install_yarn () { - ynh_exec_as_app node_load_PATH" npm install yarn + ynh_exec_as_app npm install yarn ynh_yarn="$install_dir/node_modules/.bin/yarn" alias ynh_yarn="$ynh_yarn" } diff --git a/scripts/install b/scripts/install index 230d74a..78bfbde 100755 --- a/scripts/install +++ b/scripts/install @@ -29,11 +29,7 @@ ynh_setup_source --dest_dir="$install_dir" cp "$install_dir/config.default.js" "$install_dir/config.js" -#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod -R o-rwx "$install_dir" -#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown -R "$app:$app" "$install_dir" ynh_config_add --template=".env" --destination="$install_dir/.env" -#REMOVEME? Assuming the file is setup using ynh_config_add, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod 400 "$install_dir/.env" -#REMOVEME? Assuming the file is setup using ynh_config_add, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown "$app:$app" "$install_dir/.env" #================================================= # BUILD NODEJS CODE diff --git a/scripts/restore b/scripts/restore index faf5ee7..655f02b 100755 --- a/scripts/restore +++ b/scripts/restore @@ -11,8 +11,6 @@ ynh_script_progression "Restoring the app main directory..." ynh_restore "$install_dir" -#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod -R o-rwx "$install_dir" -#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown -R $app:$app "$install_dir" #================================================= # REINSTALL DEPENDENCIES #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 87b57f0..1dd0c83 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -36,11 +36,7 @@ ynh_setup_source --full_replace --dest_dir="$install_dir" cp "$install_dir/config.default.js" "$install_dir/config.js" -#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod -R o-rwx "$install_dir" -#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown -R "$app:$app" "$install_dir" ynh_config_add --template=".env" --destination="$install_dir/.env" -#REMOVEME? Assuming the file is setup using ynh_config_add, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod 400 "$install_dir/.env" -#REMOVEME? Assuming the file is setup using ynh_config_add, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown "$app:$app" "$install_dir/.env" #================================================= # BUILD NODEJS CODE From 5223143304a5ecf0952d8d8191db69fe5df962f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Mon, 2 Sep 2024 13:40:05 +0200 Subject: [PATCH 3/6] Update install --- scripts/install | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/install b/scripts/install index 78bfbde..8b58785 100755 --- a/scripts/install +++ b/scripts/install @@ -49,8 +49,8 @@ pushd "$install_dir" mv package.json.mov package.json fi - ynh_exec_as_app node_load_PATH" "$ynh_yarn" install - ynh_exec_as_app node_load_PATH" npm run build + ynh_exec_as_app "$ynh_yarn" install + ynh_exec_as_app npm run build popd #================================================= From 2c800e51af6678587e2f99859e07d6c430c5a02e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Mon, 2 Sep 2024 13:40:16 +0200 Subject: [PATCH 4/6] Update upgrade --- scripts/upgrade | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/upgrade b/scripts/upgrade index 1dd0c83..512422c 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -56,8 +56,8 @@ pushd "$install_dir" mv package.json.mov package.json fi - ynh_exec_as_app node_load_PATH" "$ynh_yarn" install - ynh_exec_as_app node_load_PATH" npm run build + ynh_exec_as_app "$ynh_yarn" install + ynh_exec_as_app npm run build popd #================================================= From 264546c815f59adc7891d928c774688e0eac3f95 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Mon, 2 Sep 2024 13:41:06 +0200 Subject: [PATCH 5/6] Update upgrade --- scripts/upgrade | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/scripts/upgrade b/scripts/upgrade index 512422c..4b5e8f0 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -46,15 +46,13 @@ ynh_script_progression "Installing Yarn and Buuilding application..." # Build using Yarn pushd "$install_dir" - # We must use npm to install yarn but without installing other dependencies as npm fails with them + # We must use npm to install yarn but without installing other dependencies as npm fails with them if [ -f "package.json" ]; then mv package.json package.json.mov - fi _install_yarn if [ -f "package.json.mov" ]; then mv package.json.mov package.json - fi ynh_exec_as_app "$ynh_yarn" install ynh_exec_as_app npm run build From 8c0f44330425a5d420fd9631d37994189a57c957 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A9rard=20Collin?= Date: Tue, 3 Sep 2024 08:42:50 +0200 Subject: [PATCH 6/6] fixed bad auto-update --- manifest.toml | 2 +- scripts/_common.sh | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/manifest.toml b/manifest.toml index 19e1a38..d4ae843 100644 --- a/manifest.toml +++ b/manifest.toml @@ -47,7 +47,7 @@ ram.runtime = "50M" ask.fr = "Choisissez la version de Mongo a installer ou 'None' si Mongo est déjà installé" type = "select" choices = ["None", "4.4", "5.0", "6.0", "7.0"] - default = "6.0" + default = "7.0" [resources] [resources.sources.main] diff --git a/scripts/_common.sh b/scripts/_common.sh index 2d4d5fd..cf7e7a0 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -4,8 +4,8 @@ # COMMON VARIABLES AND CUSTOM HELPERS #================================================= -nodejs_version=16 -mongo_version=6.0 +nodejs_version=20 +mongo_version=7.0 _install_yarn () { ynh_exec_as_app npm install yarn