Proof-of-Concept project. Don't use it in production!
Example video how you can start/stop services on remote nodes with agent from Moleculer CLI:
Bare node starter script
"use strict";
const { ServiceBroker } = require("moleculer");
const { Agent } = require("../");
// Create broker
const broker = new ServiceBroker({
nodeID: "node-" + require("os").hostname().toLowerCase() + process.pid,
transporter: "NATS",
logger: console
});
broker.createService(Agent);
broker.start();
broker.call("$agent.start", { service: "math", nodeID: "node-10" });
broker.call("$agent.stop", { service: "math", nodeID: "node-10" });
broker.call("$agent.services", { nodeID: "node-10" })
.then(services => console.log(services));
broker.call("$agent.startAll", { nodeID: "node-10" });
broker.call("$agent.stopAll", { nodeID: "node-10" });
The node forks itself to a new process with the same arguments & env.
broker.call("$agent.fork");
broker.call("$agent.quit");
Moleculer is available under the MIT license.
Copyright (c) 2016-2017 Ice Services