strongloop/strong-cluster-control — pull request #36 by rmg (2014-02-21 01:41:32+00:00)
Title: PoC: remote cluster control using ssh2

Simple proof-of-concept for using `clusterctl` on a control socket located on a remote host.

Adds a `-r,--remote` argument to `clusterctl` command that accepts a user@host. When a remote is given, the communication to the control socket is tunnelled through an ssh connection using the remote user name and host provided.

More for sharing than actual merging...

Launching the example-master:
```sh
strong-cluster-control ryan$ cd bin && sl-run --cluster 2 example-master.js
strong-agent not profiling, configuration not found.
Generate configuration with:
npm install -g strong-cli
slc strongops
See http://docs.strongloop.com/strong-agent for more information.
supervisor starting (pid 54752)
supervisor size set to 2
supervisor listening on 'clusterctl'
supervisor started worker 1 (pid 54753)
supervisor started worker 2 (pid 54754)
supervisor resized to 2
cluster options: { clustered: 'worker', isMaster: false, isWorker: true }
worker id 1 pid 54753 example does no work... bye
cluster options: { clustered: 'worker', isMaster: false, isWorker: true }
worker id 2 pid 54754 example does no work... bye
```

Querying the cluster status on a "remote" host over ssh:
```sh
strong-cluster-control ryan$ clusterctl -r ryan@localhost -p `pwd`/bin/clusterctl status
master pid: 54752
worker count: 2
worker id 1: { pid: 54753 }
worker id 2: { pid: 54754 }
```

Shutting down the "remote" cluster:
```sh
Ryans-StrongMac:strong-cluster-control ryan$ clusterctl -r ryan@localhost -p `pwd`/bin/clusterctl stop
supervisor size set to 0
```

Meanwhile, back on the "server":
```sh
supervisor stopped worker 2 (pid 54754)
supervisor worker id 2 (pid 54754) expected exit with 143
supervisor stopped worker 1 (pid 54753)
supervisor resized to 0
supervisor worker id 1 (pid 54753) expected exit with 143
supervisor size set to undefined
supervisor stopped
supervisor exiting with code 0
strong-cluster-control/bin ryan$
```