Comparing version 0.4.7 to 0.5.0
var nodemiral = require('nodemiral'); | ||
var taskLists = require('./taskLists'); | ||
var path = require('path'); | ||
@@ -17,3 +16,3 @@ var fs = require('fs'); | ||
this.config = config; | ||
this.sessions = this._createSession(config); | ||
this.sessionsMap = this._createSessionsMap(config); | ||
@@ -27,4 +26,4 @@ //get settings.json into env | ||
Actions.prototype._createSession = function(config) { | ||
var sessions = []; | ||
Actions.prototype._createSessionsMap = function(config) { | ||
var sessionsMap = {}; | ||
var options = { | ||
@@ -49,11 +48,26 @@ ssh: {'StrictHostKeyChecking': 'no', 'UserKnownHostsFile': '/dev/null'} | ||
} | ||
sessions.push(nodemiral.session(host, auth, options)); | ||
if(!sessionsMap[server.os]) { | ||
sessionsMap[server.os] = { | ||
sessions: [], | ||
taskListsBuilder:require('./taskLists')(server.os) | ||
}; | ||
} | ||
var session = nodemiral.session(host, auth, options); | ||
sessionsMap[server.os].sessions.push(session); | ||
}); | ||
return sessions; | ||
return sessionsMap; | ||
}; | ||
Actions.prototype.setup = function() { | ||
var taskList = taskLists.setup(this.config.setupMongo, this.config.setupNode, this.config.nodeVersion, this.config.setupPhantom, this.config.appName); | ||
taskList.run(this.sessions); | ||
var self = this; | ||
for(var os in self.sessionsMap) { | ||
var sessionsInfo = self.sessionsMap[os]; | ||
var taskList = sessionsInfo.taskListsBuilder.setup( | ||
self.config.setupMongo, self.config.setupNode, self.config.nodeVersion, | ||
self.config.setupPhantom, self.config.appName); | ||
taskList.run(sessionsInfo.sessions); | ||
} | ||
}; | ||
@@ -97,5 +111,9 @@ | ||
} else { | ||
var taskList = taskLists.deploy(bundlePath, self.config.env, | ||
deployCheckWaitTime, appName, self.config.binaryNpmModules); | ||
taskList.run(self.sessions, afterCompleted); | ||
for(var os in self.sessionsMap) { | ||
var sessionsInfo = self.sessionsMap[os]; | ||
var taskList = sessionsInfo.taskListsBuilder.deploy( | ||
bundlePath, self.config.env, | ||
deployCheckWaitTime, appName, self.config.binaryNpmModules); | ||
taskList.run(sessionsInfo.sessions); | ||
} | ||
} | ||
@@ -119,23 +137,38 @@ }); | ||
Actions.prototype.reconfig = function() { | ||
var taskList = taskLists.reconfig(this.config.env, this.config.appName); | ||
taskList.run(this.sessions); | ||
var self = this; | ||
for(var os in self.sessionsMap) { | ||
var sessionsInfo = self.sessionsMap[os]; | ||
var taskList = sessionsInfo.taskListsBuilder.reconfig( | ||
this.config.env, this.config.appName); | ||
taskList.run(sessionsInfo.sessions); | ||
} | ||
}; | ||
Actions.prototype.logs = function() { | ||
var self = this; | ||
var tailOptions = process.argv.slice(3).join(" "); | ||
var command = 'sudo tail ' + tailOptions + ' /var/log/upstart/' + this.config.appName + '.log'; | ||
this.sessions.forEach(function(session) { | ||
var hostPrefix = '[' + session._host + '] '; | ||
var options = { | ||
onStdout: function(data) { | ||
process.stdout.write(hostPrefix + data.toString()); | ||
}, | ||
onStderr: function(data) { | ||
process.stderr.write(hostPrefix + data.toString()); | ||
for(var os in self.sessionsMap) { | ||
var sessionsInfo = self.sessionsMap[os]; | ||
sessionsInfo.sessions.forEach(function(session) { | ||
var hostPrefix = '[' + session._host + '] '; | ||
var options = { | ||
onStdout: function(data) { | ||
process.stdout.write(hostPrefix + data.toString()); | ||
}, | ||
onStderr: function(data) { | ||
process.stderr.write(hostPrefix + data.toString()); | ||
} | ||
}; | ||
if(os == 'linux') { | ||
var command = 'sudo tail ' + tailOptions + ' /var/log/upstart/' + self.config.appName + '.log'; | ||
} else if(os == 'sunos') { | ||
var command = 'sudo tail ' + tailOptions + | ||
' /var/svc/log/site-' + self.config.appName + '\\:default.log'; | ||
} | ||
}; | ||
session.execute(command, options); | ||
}); | ||
} | ||
session.execute(command, options); | ||
}); | ||
}; | ||
@@ -142,0 +175,0 @@ |
@@ -28,4 +28,4 @@ var cjson = require('cjson'); | ||
//rewrite ~ with $HOME | ||
mupJson.app = rewriteHome(mupJson.app); | ||
server.os = server.os || "linux"; | ||
if(server.pem) { | ||
@@ -40,2 +40,5 @@ server.pem = rewriteHome(server.pem); | ||
//rewrite ~ with $HOME | ||
mupJson.app = rewriteHome(mupJson.app); | ||
//initialize options | ||
@@ -42,0 +45,0 @@ mupJson.env = mupJson.env || {}; |
{ | ||
"name": "mup", | ||
"version": "0.4.7", | ||
"version": "0.5.0", | ||
"description": "Production Quality Meteor Deployments", | ||
@@ -5,0 +5,0 @@ "dependencies": { |
@@ -23,2 +23,3 @@ # Meteor Up | ||
- [Multiple Deployments](#multiple-deployments) | ||
- [Multiple OS Support](#multiple-os-support) | ||
- [Binary NPM Modules](#binary-npm-modules) | ||
@@ -125,7 +126,7 @@ - [Troubleshooting](#troubleshooting) | ||
sudo adduser *username* sudo | ||
And you also need to add NOPASSWD to the sudoers file: | ||
sudo visudo | ||
# replace this line | ||
@@ -166,5 +167,5 @@ %sudo ALL=(ALL) ALL | ||
You can use an array to deploy to multiple servers at once. | ||
You can use an array to deploy to multiple servers at once. | ||
To deploy to *different* environments (e.g. staging, production, etc.), use separate Meteor Up configurations in separate directories, with each directory containing separate `mup.json` and `settings.json` files, and the `mup.json` files' `app` field pointing back to your app's local directory. | ||
To deploy to *different* environments (e.g. staging, production, etc.), use separate Meteor Up configurations in separate directories, with each directory containing separate `mup.json` and `settings.json` files, and the `mup.json` files' `app` field pointing back to your app's local directory. | ||
@@ -203,3 +204,31 @@ #### Custom Meteor Binary | ||
### Multiple OS Support | ||
Meteor UP supports multiple operating systems. See the list of supported operation systems: | ||
* linux - Any Ubuntu/Debian based OS | ||
* sunos - Open Solaris based OS (i.e: SmartOS) | ||
All you've to do is, specify the type of `os` when defining the server info. See below: | ||
> If you've leave `os`as blank, `linux` will be set as the default value | ||
~~~js | ||
{ | ||
"servers": [ | ||
{ | ||
"host": "my-linux-box", | ||
"username": "root", | ||
"password": "password" | ||
}, | ||
{ | ||
"host": "my-solaris-box", | ||
"username": "root", | ||
"password": "password", | ||
"os": "sunos" | ||
} | ||
], | ||
} | ||
~~~ | ||
### Multiple Deployments | ||
@@ -229,3 +258,3 @@ | ||
"meteor-package-name": ["npm-module1", "npm-module2"] | ||
} | ||
} | ||
@@ -232,0 +261,0 @@ ... |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
35398
25
454
267
7