From 6cc6d083885eeb65db68dca06d73aaafaa2e0832 Mon Sep 17 00:00:00 2001 From: tituspijean Date: Sun, 30 Apr 2023 17:01:00 +0200 Subject: [PATCH] Ensure proper upgrade --- scripts/install | 8 +++++++- scripts/upgrade | 21 +++++++++++++++------ 2 files changed, 22 insertions(+), 7 deletions(-) diff --git a/scripts/install b/scripts/install index 462868a..cfdf894 100644 --- a/scripts/install +++ b/scripts/install @@ -33,7 +33,7 @@ chown -R $app:$app "$install_dir" pushd $install_dir ynh_script_progression --message="Installing and configuring Ghost..." ynh_exec_as $app $ynh_node_load_PATH $ynh_npm install ghost-cli@latest - ynh_exec_as $app $ynh_node_load_PATH ./node_modules/ghost-cli/bin/ghost install $(ynh_app_upstream_version) \ + ynh_exec_as $app $ynh_node_load_PATH $install_dir/node_modules/ghost-cli/bin/ghost install $(ynh_app_upstream_version) \ --no-prompt --no-setup-systemd --no-start \ --dir ghost --no-setup-linux-user \ --no-setup-nginx --no-setup-ssl --url http://$domain$path --port $port \ @@ -44,6 +44,12 @@ pushd $install_dir ynh_secure_remove --file=".cache/yarn" popd +# Make sure the configuration is correct +pushd $install_dir/ghost + ynh_exec_as $app $ynh_node_load_PATH $install_dir/node_modules/ghost-cli/bin/ghost config \ + --port $port --process local +popd + #================================================= # NGINX CONFIGURATION #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 187d33c..d1f1c3d 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -79,7 +79,7 @@ then pushd $install_dir ynh_exec_as $app $ynh_node_load_PATH $ynh_npm install ghost-cli@latest - ynh_exec_as $app $ynh_node_load_PATH ./node_modules/ghost-cli/bin/ghost install $(ynh_app_upstream_version) \ + ynh_exec_as $app $ynh_node_load_PATH $install_dir/node_modules/ghost-cli/bin/ghost install $(ynh_app_upstream_version) \ --no-prompt --no-setup-systemd --no-start \ --dir ghost --no-setup-linux-user \ --no-setup-nginx --no-setup-ssl --url http://$domain$path --port $port \ @@ -95,15 +95,24 @@ then else - # Upgrade Ghost CLI and Ghost itself - pushd $install_dir - ynh_exec_as $app $ynh_node_load_PATH $ynh_npm install ghost-cli@latest - ynh_exec_as $app $ynh_node_load_PATH ./node_modules/ghost-cli/bin/ghost update $(ynh_app_upstream_version) \ + # Upgrade Ghost CLI + pushd $install_dir + ynh_exec_as $app $ynh_node_load_PATH $ynh_npm install ghost-cli@latest + popd + + # Upgrade Ghost itself + pushd $install_dir/ghost + ynh_exec_as $app $ynh_node_load_PATH $install_dir/node_modules/ghost-cli/bin/ghost update $(ynh_app_upstream_version) \ --no-prompt --no-auto-rollback --no-restart - popd + popd fi +# Make sure the configuration is correct +pushd $install_dir/ghost + ynh_exec_as $app $ynh_node_load_PATH $install_dir/node_modules/ghost-cli/bin/ghost config \ + --port $port --process local +popd # Cleanup cache ynh_secure_remove --file="$install_dir/.cache/yarn"