Rename clusterctl to clusterioctl

Rename the clusterctl command line utility to clusterioctl in order to
be consistent with the naming of the commands for master and slave.
This commit is contained in:
Hornwitser committed 2020-09-21 18:00:07 +02:00
1 parent bf5a4a8a9c
commit 3485c9ac68
15 files changed
+46 -46

No files matched your search

+1 -1
View File
@@ -15,7 +15,7 @@ Version 2.0.0
- Daemonized slaves. Slaves now have the ability to run multiple Factorio
instances, starting and stopping them individually. To manage this the
local command line interface has been replaced with a remote interface on
the master server that can be accessed through the clusterctl cli tool.
the master server that can be accessed through the clusterioctl cli tool.
- Rewritten the communication between slaves and the master from scratch. The
new system is based on a WebSocket connection between the slaves and the
master server and provides efficient validated bi-directonal communication.
+9 -9
View File
@@ -193,7 +193,7 @@ up a new username here).
The first command creates a user account with the given name and
promotes it to a cluster admin. The second one sets up a
`config-control.json` config for clusterctl to connect to the master
`config-control.json` config for clusterioctl to connect to the master
server under the given user account.
@@ -213,7 +213,7 @@ master server. In order for slaves to connect to the master server they
need a valid authentication token, you can create a slave config with
a valid token with the following command.
npx clusterctl slave create-config --name Local --generate-token
npx clusterioctl slave create-config --name Local --generate-token
This will write a new `config-slave.json` file in the current directory
(you can change the location with the `--output` option) with the name,
@@ -234,18 +234,18 @@ Once the config is set up run the slave with
### Instances
Instances are created, managed and started from the master server. For
now the only interface available is the `clusterctl` command line tool
now the only interface available is the `clusterioctl` command line tool
included in Clusterio. You can run this tool from any slave, or the
master server without having to set up a config, if you want to manage
the cluster from somewhere else you will need to set the
`control.master_url` and `control.master_token` options with the `node
clusterctl control-config set` command:
clusterioctl control-config set` command:
The basic operations to start a new instance is the following
npx clusterctl instance create "My instance"
npx clusterctl instance assign "My instance" "Local"
npx clusterctl instance start "My instance"
npx clusterioctl instance create "My instance"
npx clusterioctl instance assign "My instance" "Local"
npx clusterioctl instance start "My instance"
The first line creates the instance configuration on the master server.
The second assigns the instance to a slave which creates the instance
@@ -253,8 +253,8 @@ directory and files needed to run the instance on the given slave. The
third line starts the instance, which creates a new save if there are no
save games present.
There are many more commands available with clusterctl. See
`npx clusterctl --help` for a full list of them.
There are many more commands available with clusterioctl. See
`npx clusterioctl --help` for a full list of them.
## Plugins
+1 -1
View File
@@ -6,7 +6,7 @@ configuration system in Clusterio, and unless you're developing
Clusterio it's probably not going to be very useful for you.</sub>
Clusterio uses a group based configuration system to manage settings for
the master server, instances, slaves, and the clusterctl utility.
the master server, instances, slaves, and the clusterioctl utility.
Plugins get their own config group for the master server and instances
which they can add their own fields to. The fields are defined early in
the startup, and the groups and their fields for disabled plugins will
+1 -1
View File
@@ -14,7 +14,7 @@
"packages/master/src/",
"packages/master/master.js",
"packages/slave/slave.js",
"packages/ctl/clusterctl.js",
"packages/ctl/ctl.js",
"packages/lib/",
"plugins/"
],
+4 -4
View File
@@ -2,13 +2,13 @@ Managing a Cluster
==================
Clusterio clusers are managed through the master server by using the
`clusterctl` command line interface which is invoked by running
`npx clusterctl <command>` in the clusterio directory. This document
uses the shorthand `ctl> foo` to indicate `npx clusterctl foo` should
`clusterioctl` command line interface which is invoked by running
`npx clusterioctl <command>` in the clusterio directory. This document
uses the shorthand `ctl> foo` to indicate `npx clusterioctl foo` should
be executed. Mandatory parameters are shown in `<angles bracket>` and
optional pameters are in `[square brackets]`.
Before `clusterctl` can be used it needs to be configured for the
Before `clusterioctl` can be used it needs to be configured for the
cluster it will connect to. The easiest way to do this is to run
`npx clusteriomaster bootstrap create-ctl-config <username>` on the
master server, which creates the necessary `config-control.json` for
+8 -8
View File
@@ -19,7 +19,7 @@ Contents
- [Sending Link Messages](#sending-link-messages)
- [Handling connection events](#handling-connection-events)
- [Collecting Statistics](#collecting-statistics)
- [Adding Custom Commands to clusterctl](#adding-custom-commands-to-clusterctl)
- [Adding Custom Commands to clusterioctl](#adding-custom-commands-to-clusterioctl)
Plugin Structure
@@ -100,7 +100,7 @@ The following properties are recognized:
Path to a Node.js module relative to the plugin directory which
contains the ControlPlugin class definition for this plugin. This
is an optional paramater. A plugin can be made that only runs on
the clusterctl side.
the clusterioctl side.
**messages**:
Object with link messages definitions for this plugin. See guide
@@ -145,7 +145,7 @@ code can be used:
}
For the instance plugin it's exactly the same except "Master" is
replaced with "Instance", and for the clusterctl plugin "Control" is
replaced with "Instance", and for the clusterioctl plugin "Control" is
used. The available hooks that you can override are documented in the
base class [in lib/plugin.js](/packages/lib/plugin.js).
@@ -591,8 +591,8 @@ hook on both master and instance plugins that is run before the
metrics in the default registry are collected.
Adding Custom Commands to clusterctl
------------------------------------
Adding Custom Commands to clusterioctl
--------------------------------------
The control entrypoint for plugins allows you to extend clustectl with
your own commands. The creation of custom commands typically starts
@@ -630,15 +630,15 @@ and
for setting up positional and optional arguments to commands). The
`handler` is an async function that's invoked when the command is
executed and it's passed the parsed command line arguments and a
reference to the `Control` class of clusterctl. It's possible to optain
reference to the `Control` class of clusterioctl. It's possible to optain
a reference to the plugin class with `control.plugins.get(info.name)`.
Note that messages sent from clusterctl needs to have
Note that messages sent from clusterioctl needs to have
`"control-master"` as a part of the links array for it to be accepted by
the master server, see [Defining Link Messages](#defining-link-messages)
for how to define the messages that can be sent to the master.
To have the command tree become part of clusterctl it needs to be added
To have the command tree become part of clusterioctl it needs to be added
to the rootCommand tree in `addCommands` callback of the Control plugin:
const plugin = require("@clusterio/lib/plugin");
@@ -522,7 +522,7 @@ class ControlConnector extends link.WebSocketClientConnector {
console.log("SOCKET | registering control");
this.sendHandshake("register_control", {
token: this._token,
agent: "clusterctl",
agent: "clusterioctl",
version: version,
});
}
@@ -577,7 +577,7 @@ class Control extends link.Link {
async function startControl() {
yargs
.scriptName("clusterctl")
.scriptName("clusterioctl")
.usage("$0 <command> [options]")
.option("config", {
nargs: 1,
@@ -591,7 +591,7 @@ async function startControl() {
.strict()
;
const rootCommands = new command.CommandTree({ name: "clusterctl", description: "Manage cluster" });
const rootCommands = new command.CommandTree({ name: "clusterioctl", description: "Manage cluster" });
rootCommands.add(slaveCommands);
rootCommands.add(instanceCommands);
rootCommands.add(permissionCommands);
@@ -741,9 +741,9 @@ I version of clusterio. Expect things to break. I
);
} else {
console.error(`
+-------------------------------+
| Unable to to start clusterctl |
+-------------------------------+`
+---------------------------------+
| Unable to to start clusterioctl |
+---------------------------------+`
);
}
+2 -2
View File
@@ -4,12 +4,12 @@
"author": "Hornwitser",
"license": "MIT",
"version": "2.0.0-alpha0",
"main": "clusterctl.js",
"main": "ctl.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"bin": {
"clusterctl": "./clusterctl.js"
"clusterioctl": "./ctl.js"
},
"keywords": [
"factorio"
+3 -3
View File
@@ -1,7 +1,7 @@
/**
* Command library
*
* Data types and utilites for commands to clusterctl's CLI.
* Data types and utilites for commands to clusterioctl's CLI.
*
* @author Hornwitser
* @module
@@ -11,7 +11,7 @@ const link = require("@clusterio/lib/link");
const errors = require("@clusterio/lib/errors");
/**
* Represents a command that can be runned by clusterctl
* Represents a command that can be runned by clusterioctl
* @static
*/
class Command {
@@ -52,7 +52,7 @@ class Command {
* A node in the command tree that can hold commands and sub trees
*
* Container which can contain {@link module:lib/command.Command}s and other
* CommandTrees. This is used by clusterctl to hold the full tree of
* CommandTrees. This is used by clusterioctl to hold the full tree of
* available commands, you may extend this tree by using a control plugin,
* see {@link module:lib/plugin.BaseControlPlugin#addCommands}
*
+3 -3
View File
@@ -339,10 +339,10 @@ class BaseMasterPlugin {
}
/**
* Base class for clusterctl plugins
* Base class for clusterioctl plugins
*
* Control plugins are subclasses of this class which get instantiated by
* clusterctl in order to extend its functionallity. To be discovered the
* clusterioctl in order to extend its functionallity. To be discovered the
* class must be exported under the name `ControlPlugin` in the module
* specified by the `controlEntrypoint` in the plugin's info.js file.
*
@@ -364,7 +364,7 @@ class BaseControlPlugin {
/**
* Called to add commands to the command line interface.
*
* Invoked by clusterctl to let plugins add commands. `rootCommand` is
* Invoked by clusterioctl to let plugins add commands. `rootCommand` is
* the top level command node which the plugin should add its own {@link
* module:lib/command.CommandTree} to.
*
+2 -2
View File
@@ -6,7 +6,7 @@
* Facilitates communication between slaves and control of the cluster
* through WebSocet connections, and hosts a webserver for browser
* interfaces and Prometheus statistics export. It is remotely controlled
* by {@link module:clusterctl}.
* by {@link module:@clusterio/ctl/ctl}.
*
* @module
* @author Danielv123, Hornwitser
@@ -1582,7 +1582,7 @@ async function startServer() {
.command("bootstrap", "Bootstrap access to cluster", yargs => {
yargs
.command("create-admin <name>", "Create a cluster admin")
.command("create-ctl-config <name>", "Create clusterctl config for the given user", yargs => {
.command("create-ctl-config <name>", "Create clusterioctl config for the given user", yargs => {
yargs.option("output", {
describe: "Path to output config (- for stdout)", type: "string",
nargs: 1, default: "config-control.json",
+1 -1
View File
@@ -1429,7 +1429,7 @@ async function startSlave() {
"Master server requires an access token for socket operations. As clusterio\n"+
"slaves depends upon this, please set your token using the command npx\n"+
"clusterioslave config set slave.master_token <token>. You can generate an\n"+
"auth token using npx clusterctl generate-slave-token."
"auth token using npx clusterioctl generate-slave-token."
);
process.exitCode = 1;
return;
+3 -3
View File
@@ -2,14 +2,14 @@
const assert = require("assert").strict;
const { testLines } = require("./lib/factorio/lines");
const clusterctl = require("@clusterio/ctl/clusterctl.js");
const clusterioctl = require("@clusterio/ctl/ctl.js");
describe("clusterctl", function() {
describe("clusterioctl", function() {
describe("formatOutputColored()", function() {
it("should pass the test lines", function() {
for (let [reference, output] of testLines) {
let line = clusterctl._formatOutputColored(output);
let line = clusterioctl._formatOutputColored(output);
// Strip colours
line = line.replace(/\x1B\[\d+m/g, "");
assert.deepEqual(line, reference);
+1 -1
View File
@@ -29,7 +29,7 @@ describe("Integration of Clusterio", function() {
});
describe("clusterctl", function() {
describe("clusterioctl", function() {
describe("slave list", function() {
it("runs", async function() {
await execCtl("slave list");
+1 -1
View File
@@ -29,7 +29,7 @@ class TestControl extends link.Link {
class TestControlConnector extends link.WebSocketClientConnector {
register() {
this.sendHandshake("register_control", { token: this.token, agent: "clusterctl", version: "test" });
this.sendHandshake("register_control", { token: this.token, agent: "clusterioctl", version: "test" });
}
}