diff --git a/scripts/upgrade b/scripts/upgrade index cb3725a..bbea438 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -16,12 +16,21 @@ ynh_script_progression --message="Loading installation settings..." --time --wei app=$YNH_APP_INSTANCE_NAME -domain=$(ynh_app_setting_get --app=$app --key=domain) -path_url=$(ynh_app_setting_get --app=$app --key=path) -admin=$(ynh_app_setting_get --app=$app --key=admin) final_path=$(ynh_app_setting_get --app=$app --key=final_path) -language=$(ynh_app_setting_get --app=$app --key=language) +domain=$(ynh_app_setting_get --app=$app --key=domain) +path_url=$(ynh_app_setting_get --app=$app --key=path_url) db_name=$(ynh_app_setting_get --app=$app --key=db_name) +language_key=$(ynh_app_setting_get --app=$app --key=language_key) +slack_key=$(ynh_app_setting_get --app=$app --key=slack_key) +slack_secret=$(ynh_app_setting_get --app=$app --key=slack_secret) +secret_key=$(ynh_app_setting_get --app=$app --key=secret_key) +utils_secret=$(ynh_app_setting_get --app=$app --key=utils_secret) + + +minio_domain=$(ynh_app_setting_get --app="minio" --key=domain) +minio_id=$(ynh_app_setting_get --app="minio" --key=minio_id) +minio_key=$(ynh_app_setting_get --app="minio" --key=minio_key) +mc_path=$(ynh_app_setting_get --app="minio" --key=mc_path) #================================================= # CHECK VERSION @@ -97,15 +106,44 @@ ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version # Install Yarn ynh_install_extra_app_dependencies --repo="deb https://dl.yarnpkg.com/debian/ stable main" --package="yarn" --key="https://dl.yarnpkg.com/debian/pubkey.gpg" +#================================================= +# UPGRADE YARN DEPENDENCIES +#================================================= +ynh_script_progression --message="Building Yarn dependencies... This can be very long, be patient !" --time --weight=10 + +pushd "$final_path" + ynh_use_nodejs + ynh_script_progression --message="Fetching Yarn dev dependencies... This can be very long, be patient !" --time --weight=5 + ynh_exec_warn_less sudo -u $app env $ynh_node_load_PATH yarn install --no-optional --frozen-lockfile + ynh_script_progression --message="Cleaning cache... " --time --weight=1 + ynh_exec_warn_less sudo -u $app env $ynh_node_load_PATH yarn cache clean + ynh_script_progression --message="Building Yarn dev dependencies... This can be very long, be patient !" --time --weight=5 + ynh_exec_warn_less sudo -u $app env $ynh_node_load_PATH yarn build + ynh_script_progression --message="Fetching Yarn production dependencies... This can be very long, be patient !" --time --weight=5 + ynh_exec_warn_less sudo -u $app env $ynh_node_load_PATH yarn install --production=true --frozen-lockfile + ynh_script_progression --message="Cleaning cache... " --time --weight=1 + ynh_exec_warn_less sudo -u $app env $ynh_node_load_PATH yarn cache clean +popd + #================================================= # UPDATE A CONFIG FILE #================================================= -ynh_script_progression --message="Updating a configuration file..." --time --weight=1 +ynh_script_progression --message="Adding a configuration file..." --time --weight=1 -ynh_add_config --template="some_config_file" --destination="$final_path/some_config_file" +ynh_add_config --template="../conf/.env" --destination="$final_path/.env" -chmod 400 "$final_path/some_config_file" -chown $app:$app "$final_path/some_config_file" +chmod 400 "$final_path/.env" +chown $app:$app "$final_path/.env" + +#================================================= +# RUN DB MIGRATION +#================================================= +ynh_script_progression --message="Running DB initial migration..." + +pushd "$final_path" + ynh_use_nodejs + ynh_exec_warn_less sudo -u $app env $ynh_node_load_PATH yarn db:migrate +popd #================================================= # SETUP SYSTEMD