shepard

Client:

Client:

 
//load shepard as the main entry point, and point to the application index file. 
var shepard = require("shepard").client(__dirname + "/index.js").listen();

Server:

var shepard = require("shepard").server().listen();
 
shepard.insert({
  name: "my server",
  address: "127.0.0.1",
  tags: {
    type: "app-name"
  }
});
 
 
//invoke a soft-restart against the application.  
shepard.findOne({ tags: { type: "app-name" }}).sync().restart();
var ectwo = require("ectwo")(config),
shepard = require("shepard").server();
 
//synchronize all ec2 instances to shepard 
ectwo.instances.syncTo(shepard);
 
//you can also synchronize very specific instances 
ectwo.instances.syncTo({ "tags": { key: "type", value: "red5" } }, shepard);
 
 
shepard.findAll(function(errclients) {
  client.restart();
});
 

Returns a new server instance

  • options
    • clientPort - the client

Listens on the particular port

finds multiple clients

finds all clients

finds one client

restarts a client

stops a client

starts a client

sends a client message

receives a message from a client

Default is restarting the cluster, but this can be overridden like so:

var client = require("shepard").client();
client.restart = function(messagecallback) {
  //do something 
}