nodemiral
Server Automation for NodeJS over SSH
Last updated 4 years ago by arunoda .
Original npm · Tarball · package.json
$ cnpm install nodemiral 
SYNC missed versions from official npm registry.

nodemiral (node + admiral) Build Status

Server Automation for NodeJS over SSH

Install

npm install nodemiral

Features

  • Support connecting to any unix remote server
  • Authenticate with password(using sshpass) or with a pem file
  • Can work with multiple servers at once
  • Supports, copy, execute and executeScript at core methods
  • Familiar NodeJS API

Example

var nodemiral = require('nodemiral');
var session = nodemiral.session('hostname', {username: 'root', password: 'password'});

session.execute('uname -a', function(err, code, logs) {
  console.log(logs.stdout);
});

API

Session

Create a session to a remote server. You can invoke following methods after created a session

@param hostname - hostname or ip addess
@param auth - object containing following fields: `username` and (`password` or `pem`)
@param options - object of options described below
nodemiral.session(hostname, auth, options);

options:

  • ejs - ejs options with ejs fields
  • ssh - object whose key and value will be passed as -o key:value to any ssh session. For example { 'StrictHostKeyChecking': 'no', 'UserKnownHostsFile': '/dev/null' }

Session Methods

execute

execute given shell command on the remote server

@param shellCommand - shellCommand
@param options - {onStdout, onStderr}
@param callback - callback containing following parameters
  err - err if exists
  code - status code of the ssh process
  logs - {stdout: 'stdout logs', stderr: 'stderr logs'}
session.execute(shellCommand, callback);

executeScript

execute a local shell script in the remote server. You can template shell script with EJS.

@param localScriptFile - localScriptFile
@param options.vars - variables to the template if uses ejs in the script
@param callback - callback containing following parameters
  err - err if exists
  code - status code of the ssh process
  logs - {stdout: 'stdout logs', stderr: 'stderr logs'}
session.executeScript(localScriptFile, options, callback);

copy

copy a file from local machine to the remote machine. Supports binary files too. Support EJS templating with non-binary files

@param localFile - localFile
@param remoteFileLocation - remoteFileLocation
@param options.vars - templateVars
@param optiosn.progressBar - show progress bar
@param callback - callback containing following parameters
  err - err if exists
  code - status code of the ssh process
  logs - {stdout: 'stdout logs', stderr: 'stderr logs'}
session.copy(localFile, remoteFileLocation, options, callback)

Current Tags

  • 1.1.1                                ...           latest (4 years ago)

37 Versions

  • 1.1.1                                ...           4 years ago
  • 1.1.0                                ...           5 years ago
  • 0.5.0                                ...           5 years ago
  • 0.4.1                                ...           5 years ago
  • 1.0.3                                ...           5 years ago
  • 1.0.2                                ...           5 years ago
  • 0.4.0                                ...           5 years ago
  • 1.0.1                                ...           5 years ago
  • 1.0.0                                ...           5 years ago
  • 0.3.11                                ...           6 years ago
  • 0.3.10                                ...           6 years ago
  • 0.3.9                                ...           6 years ago
  • 0.3.8                                ...           6 years ago
  • 0.3.7                                ...           6 years ago
  • 0.3.6                                ...           6 years ago
  • 0.3.5                                ...           6 years ago
  • 0.3.4                                ...           6 years ago
  • 0.3.3                                ...           6 years ago
  • 0.3.2                                ...           6 years ago
  • 0.3.1                                ...           6 years ago
  • 0.3.0                                ...           6 years ago
  • 0.2.6                                ...           6 years ago
  • 0.2.5                                ...           6 years ago
  • 0.2.4                                ...           6 years ago
  • 0.2.3                                ...           6 years ago
  • 0.2.2                                ...           6 years ago
  • 0.2.1                                ...           6 years ago
  • 0.2.0                                ...           6 years ago
  • 0.1.10                                ...           6 years ago
  • 0.1.9                                ...           6 years ago
  • 0.1.8                                ...           6 years ago
  • 0.1.7                                ...           6 years ago
  • 0.1.6                                ...           6 years ago
  • 0.1.5                                ...           6 years ago
  • 0.1.4                                ...           6 years ago
  • 0.1.3                                ...           6 years ago
  • 0.1.2                                ...           6 years ago

Copyright 2014 - 2016 © taobao.org |