diff --git a/scripts/upgrade b/scripts/upgrade index fedd54b..3cba834 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -35,6 +35,14 @@ if [ -z "$redis_db" ]; then ynh_app_setting_set --app="$app" --key=redis_db --value="$redis_db" fi +#================================================= +# UPGRADE DEPENDENCIES +#================================================= +ynh_script_progression --message="Upgrading dependencies..." --weight=1 + +# Install Nodejs +ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version + #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= @@ -45,19 +53,20 @@ then # Download, check integrity, uncompress and patch the source from app.src ynh_setup_source --dest_dir="$install_dir" + chmod -R o-rwx "$install_dir" + chown -R $app:www-data "$install_dir" + pushd $install_dir + ynh_use_nodejs + corepack enable + corepack prepare pnpm@latest --activate + ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH pnpm install + ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH NODE_ENV=production pnpm build + popd fi chmod -R o-rwx "$install_dir" chown -R $app:www-data "$install_dir" -#================================================= -# UPGRADE DEPENDENCIES -#================================================= -ynh_script_progression --message="Upgrading dependencies..." --weight=1 - -# Install Nodejs -ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version - #================================================= # ADD A CONFIGURATION #=================================================