docs: Update 2 files
All checks were successful
Build-Test-Publish / build (linux/amd64) (push) Successful in 29s
Build-Test-Publish / build (linux/arm64) (push) Successful in 1m10s

This commit is contained in:
j
2026-02-27 11:13:46 +13:00
parent 58e54db592
commit 50f2a7029a
2 changed files with 74 additions and 18 deletions

View File

@@ -77,23 +77,17 @@ namespace dropshell
error << "Failed to install - service information not valid." << std::endl;
return false;
}
if (!server_env.is_valid())
return false; // should never hit this.
std::string user = service_info.user;
std::string remote_service_path = remotepath(server,user).service(service);
ASSERT(!remote_service_path.empty(), "Install_Service: Remote service path is empty for " + service + " on " + server);
ASSERT(!user.empty(), "Install_Service: User is empty for " + service + " on " + server);
if (server_env.check_remote_dir_exists(remote_service_path, user))
{ // uninstall the old service before we update the config or template!
info << "Service " << service << " is already installed on " << server << std::endl;
shared_commands::uninstall_service(server_env, service);
}
maketitle("Installing " + service + " (" + service_info.template_name + ") on " + server);
// Check if template exists
@@ -114,13 +108,6 @@ namespace dropshell
return false;
}
// Sync template and config files to remote
if (!shared_commands::rsync_service_config(server_env, service, false))
{
error << "Failed to sync service configuration to remote" << std::endl;
return false;
}
// Validate service.env matches template service.env
{
std::filesystem::path template_service_env = tinfo.local_template_service_env_path(); //tinfo.local_template_path() / "config" / "service.env";
@@ -157,6 +144,40 @@ namespace dropshell
}
}
// Run install-pre.sh if it exists in the local template cache (reduces downtime by e.g. pulling images before uninstall)
bool has_install_pre = std::filesystem::exists(tinfo.local_template_path() / "install-pre.sh");
if (has_install_pre && server_env.check_remote_dir_exists(remote_service_path, user))
{
info << "Running pre-install script to prepare for update..." << std::endl;
// Sync template and config so install-pre.sh is available on remote
if (!shared_commands::rsync_service_config(server_env, service, false))
{
error << "Failed to sync service configuration to remote for pre-install" << std::endl;
return false;
}
shared_commands::cRemoteTempFolder remote_temp_folder(server_env, user);
if (!server_env.run_remote_template_command(service, "install-pre", {}, false, {{"TEMP_DIR", remote_temp_folder.path()}}, NULL))
{
warning << "Pre-install script failed, continuing with install..." << std::endl;
}
}
// Uninstall the old service (this removes the remote service directory)
if (server_env.check_remote_dir_exists(remote_service_path, user))
{
info << "Service " << service << " is already installed on " << server << std::endl;
shared_commands::uninstall_service(server_env, service);
}
// Sync template and config files to remote
if (!shared_commands::rsync_service_config(server_env, service, false))
{
error << "Failed to sync service configuration to remote" << std::endl;
return false;
}
// Run install script
{
info << "Running " << service_info.template_name << " install script on " << server << "..." << std::endl;
@@ -184,7 +205,7 @@ namespace dropshell
// print health tick
info << "Health: " << shared_commands::healthtick(server, service) << std::endl;
return true;
}