mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-20 07:43:12 +09:00
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:
1 parent
885c18c0d4
commit
8884116ee9
15 files changed
+297
-25
No files matched your search
@@ -46,8 +46,9 @@ export default function HostViewPage() {
|
||||
</PageLayout>;
|
||||
}
|
||||
|
||||
let hostButtons = <Space> {
|
||||
account.hasPermission("core.host.revoke_access")
|
||||
let hostButtons = <Space>
|
||||
{
|
||||
account.hasPermission("core.host.revoke_access")
|
||||
&& <Popconfirm
|
||||
title={`Revoke tokens of ${host.name}?`}
|
||||
placement="bottomRight"
|
||||
@@ -63,7 +64,42 @@ export default function HostViewPage() {
|
||||
Revoke tokens
|
||||
</Button>
|
||||
</Popconfirm>
|
||||
}
|
||||
}
|
||||
{
|
||||
account.hasPermission("core.host.stop")
|
||||
&& <Popconfirm
|
||||
title={<>
|
||||
Stopping this host will leave it inaccessible until someone with
|
||||
access to the system it runs on manually starts it again.<br />
|
||||
Are you sure you want to stop the host?
|
||||
</>}
|
||||
placement="bottomRight"
|
||||
okText="Stop"
|
||||
okButtonProps={{ danger: true }}
|
||||
onConfirm={() => {
|
||||
control.sendTo(
|
||||
{ hostId },
|
||||
new lib.HostStopRequest()
|
||||
).catch(notifyErrorHandler("Error stopping host"));
|
||||
}}
|
||||
>
|
||||
<Button danger>Stop</Button>
|
||||
</Popconfirm>
|
||||
}
|
||||
{
|
||||
account.hasPermission("core.host.restart")
|
||||
&& <Button
|
||||
disabled={system?.canRestart === false}
|
||||
onClick={() => {
|
||||
control.sendTo(
|
||||
{ hostId },
|
||||
new lib.HostRestartRequest()
|
||||
).catch(notifyErrorHandler("Error restarting host"));
|
||||
}}
|
||||
>
|
||||
Restart
|
||||
</Button>
|
||||
}
|
||||
</Space>;
|
||||
|
||||
return <PageLayout nav={nav}>
|
||||
|
||||
Reference in new issue
Block a user