Distributed process manager. Listens on a hypercore feed for ndjson commands to execute on the host machine using psy.
Usage:
$ hyperlapse <command> [options]
Commands:
init Create a new hypercore in the current dir
listen <hypercore-public-key> Listen for commands and print a log key
start <package-name@version> Start a service on the host machine
stop <name> Stop a service on the host machine
remove <name> Remove a service on the host machine
restart <name> Restart a service on the host machine
list List all services on the host machine
Options:
-h, --help Print usage
-v, --version Print version
-n, --name Provide an explicit name when starting a service
-k, --key Pass a hypercore directory, assumes cwd if not passed
Examples:
$ hyperlapse init
$ hyperlapse listen <64 bit hypercore public key>
$ hyperlapse start \
hypercore-archiver-bot@^1.0.0 -n hypercore-archiver-bot \
-- hypercore-archiver-bot --channel=#dat --port=8080
$ hyperlapse list
var hyperlapse = require('hyperlapse')
var normcore = require('normcore')
var inFeed = normcore('in-feed')
var outFeed = normcore('out-feed')
hyperlapse(inFeed, outFeed)
outFeed.createReadStream().pipe(process.stdout)
var outKey = outFeed.key.toString('hex')
console.log('outFeed key is ' + outKey)
inFeed.append(JSON.stringify({
type: 'start',
name: 'hypercore-archiver-bot',
source: '[email protected]',
command: 'hypercore-archiver-bot --channel=#dat --port=8000'
}) + '\n')
Each command should be valid newline delimited json.
Start a new process on the machine.
{
"type": "start",
"name": "what the process should be named on the machine",
"source": "e.g. [email protected]",
"env": {
"a bunch": "of env vars"
}
}
Stop a process on the machine
{
"type": "stop",
"name": "my-cool-process"
}
Restart a process on the machine
{
"type": "restart",
"name": "my-cool-process"
}
Remove a process on the machine
{
"type": "remove",
"name": "my-cool-process"
}
List all processes on the machine
{
"type": "list"
}
Create a new agent that tails a hypercore
. Reads commands from the inFeed
and logs its output to the outFeed
.
$ npm install hyperlapse