Implement stop and restart of controller/hosts (#554)

Implement remotely initiated stopping and restarting of the controller
and hosts.  Restarting is implemented by exiting with a non-zero exit
code and relying on a process manager to start the procress again.  To
prevent accidentally trying to restart on a system that doesn't have a
process manager present the --can-restart command line option needs to
be passed to enable the restart operation.
This commit is contained in:
Hornwitser authored and GitHub committed 2024-01-18 16:10:42 +01:00
1 parent 885c18c0d4
commit 8884116ee9
15 files changed
+297 -25

No files matched your search

+12 -2
View File
@@ -94,7 +94,12 @@ async function startHost() {
})
.command("plugin", "Manage available plugins", lib.pluginCommand)
.command("config", "Manage Host config", lib.configCommand)
.command("run", "Run host")
.command("run", "Run host", yargs => {
yargs.option("can-restart", {
type: "boolean", nargs: 0, default: false,
describe: "Indicate that a process monitor will restart this host on failure",
});
})
.demandCommand(1, "You need to specify a command to run")
.strict()
.parseSync()
@@ -206,6 +211,7 @@ async function startHost() {
hostConfig,
tlsCa,
pluginInfos,
Boolean(args.canRestart),
...await Host.bootstrap(hostConfig)
);
@@ -295,7 +301,11 @@ ${err.stack}`
);
}
process.exitCode = 1;
if (err instanceof lib.AuthenticationFailed) {
process.exitCode = 8;
} else {
process.exitCode = 1;
}
});
}