package
Grid control system for scalable micro service applications
npm install gridcontrolGitHub-flavored package documentation.
Across all versions.
Download trend unavailable.
Runtime metadata.
GridControl provisions and links multiple servers together to form a Grid.
Files are synchronized, Opinionated Pub/Sub system is implemented, Servers get linked together.
You develop, you play, in a scalable way. The more Servers you add to the Grid, the more calculation power you get.
5 minutes to get started. By the authors of PM2.
Behind the scenes: GridControl is a network layer built on top of PM2 allowing file synchronization, inter-process communication via an opionated PUB/SUB system and a wide-range system discovery
Install your Swiss Army Knife to manage a Grid:
$ npm install grid-cli -gNow the bin grid is available via the CLI.
1/ Generate a new Gridfile in the current path that contains grid name, grid password, host and SSH keys:
$ grid newThe Gridfile will look like this:
grid_name = 'grid-name'
grid_password = 'xxxx'
servers = [
'user@ip1',
'user@ip2',
'user@ip3'
]
ssh_key = '''
1024_PRIVATE_SSH_KEY
'''
ssh_public_key = '''
PUBLIC_SSH_KEY
'''Change each attribute to the desired value. Note that an SSH client should be running on the defaut port (22) on each remote machine
2/ Provision every host listed in the Gridfile:
$ grid provisionThis will copy the SSH pub key and install NVM, Node.js, PM2 and Gridcontrol This installation does not need ROOT access rights at any time
3/ Grid management
$ grid dash
Commands to manage your grid:
# List all nodes linked to the grid
$ grid ls
# Display Dashboard
$ grid dash
# Execute a command on each server
$ grid multissh <bash_command>
# Restart/Recover the current Grid
$ grid restart
# Upgrade Gridcontrol to latest version
$ grid upgrade
# Display realtime logs of all tasks
$ grid logs
# Monitor the whole Grid with Keymetrics
$ grid monitor <secret> <public>
$ grid unmonitor
# Interactively SSH into desired machine
Now let's play with the Grid. You can generate a sample project by typing:
$ grid sample [project-name]
$ cd [project-name]
$ npm installNow you'll have a project that looks like this:
.
├── index.js
├── package.json
└── tasks
└── get-ip.jsLet's look at the content of tasks/get-ip.js, this is a task that will be propagated in the grid:
var request = require('request');
module.exports = function(context, cb) {
request('https://api.ipify.org/?format=json', function (error, response, body) {
if (error)
return cb(error);
if (!error && response.statusCode == 200) {
return cb(null, body);
}
});
};To call this function, look at how it's done in index.js:
var grid = require('grid-api').init({
instances : 1,
env : {
NODE_ENV : 'development'
}
});
function triggerTask() {
// 'get-ip' is the filename
grid.exec('get-ip', function(err, data, server) {
if (err) {
console.log(err);
return false;
}
console.log('Got response from server pub_ip=(%s) priv_ip=(%s):',
server.public_ip,
server.private_ip);
console.log(data);
});
Start the main application:
$ node index.jsAt the beginning, only the local gridcontrol will respond. Once the other peers are synchronized they will also process the queries:
Got response from server pub_ip=(88.123.12.21) priv_ip=(10.2.2.1):
$HTML
Got response from server pub_ip=(88.123.12.22) priv_ip=(10.2.2.8):
$HTML
Got response from server pub_ip=(88.125.120.20) priv_ip=(10.2.2.10):
$HTML
Got response from server pub_ip=(88.123.23.42) priv_ip=(10.2.2.12):
$HTMLDistributed processing, on-premise!
If you find any issues please open an issue on Github
For Contributing please refer to docs/CONTRIBUTING.md
Apache V2 (see LICENSE.txt)
Estimated unpacked size across 63 packages.
11.0 MB+
Includes dependencies.
1.3.1
7.0.14
^2.6.1
6.1.4
3.1.3
1.1.0
5.3.0
0.1.2
2.88.2
^3.4.0
3.7.2
latest
10.0.0
^1.0.1
1.2.2
4.2.2
0.1.1
0.1.2
2.4.0
^1.4.2
1.4.2
0.1.1
^1.0.3
2.0.0
^5.6.0
6.2.3
^1.2.0
4.1.2
^3.0.3
3.0.4