runner 0.1.1
Install from the command line:
Learn more about npm packages
$ npm install @into-cps-association/runner@0.1.1
Install via package.json:
"@into-cps-association/runner": "0.1.1"
About this version
A utility service to manage safe execution of remote commands. User launches this from commandline and let the utility manage the commands to be executed.
The runner utility runs as a service and provides REST API interface to safely execute remote commands. Multiple runners can be active simultaneously on one computer. The commands are sent via the REST API and are executed on the computer with active runner.
The package is available in Github packages registry.
Set the registry and install the package with the following commands
sudo npm config set @into-cps-association:registry https://npm.pkg.github.com
sudo npm install -g @into-cps-association/runner
The npm install command asks for username and password. The username is your Github username and the password is your Github personal access token. In order for the npm to download the package, your personal access token needs to have read:packages scope.
The microservices requires config specified in YAML format. The template configuration file is:
port: 5000
location: "lifecycle" #directory location of scripts
The file should be named as runner.yaml and placed in the directory in which the runner microservice is run.
The runner requires commands / scripts to be run.
These need to be placed in the location
specified in
runner.yaml file. The location must be relative to
the directory in which the runner microservice is being
run.
runner # launch the digital twin runner
Once launched, the utility runs at the port specified in runner.yaml file.
If launched on one computer,
you can access the same at http://localhost:<port>
.
Access to the service on network is available at http://<ip or hostname>:<port>/
.
Three REST API methods are active. The route paths and the responses given for these two sources are:
REST API Route | HTTP Method | Return Value | Comment |
---|---|---|---|
localhost:port | POST | Returns the execution status of command | Executes the command provided. Each invocation appends to array of commands executed so far. |
localhost:port | GET | Returns the execution status of the last command sent via POST request. | |
localhost:port/history | GET | Returns the array of POST requests received so far. |
Executes a command. The command name given here must exist in location directory.
{
"name": "<command name>"
}
If the command exists, a successful response will be
{
"status": "success"
}
If the does not exist, the response will be
{
"status": "invalid command name"
}
Shows the status of the command last executed. If the execution was successful, the status will be
{
"name": "<command-name>",
"status": "valid",
"logs": {
"stdout": "<output log of command>",
"stderr": "<error log of command>"
}
}
If the execution is unsuccessful, the status will be
{
"message": "Validation Failed",
"error": "Bad Request",
"statusCode": 400
}
Returns the array of POST requests received so far. Both valid and invalid commands are recorded in the history.
[
{
"name": "valid command"
},
{
"name": "valid command"
},
{
"name": "invalid command"
}
]
This software is owned by The INTO-CPS Association and is available under the INTO-CPS License.