Browse files

up

  • Loading branch information...
2 parents 30b144e + 9473141 commit 0b053668a65bf166e279ff1d908df1c2aa4abee8 @contra contra committed Sep 5, 2011
Showing with 37 additions and 19 deletions.
  1. +13 −10 LICENSE.txt
  2. +6 −8 bin/top
  3. +1 −0 install.txt
  4. +1 −1 scripts/chroot_runner.js
  5. +16 −0 scripts/start_hosted_apps.js
View
23 LICENSE.txt
@@ -1,13 +1,16 @@
-Copyright 2011 Chris Matthieu, Dav Glass, Daniel Bartlett, Marcos Oliveira
+Nodester (http://nodester.com) is a Node.JS Hosting Platform-as-a-Service (PaaS)
+Copyright (C) 2011 Chris Matthieu (contact info: chris@nodester.com)
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU Affero General Public License as
+published by the Free Software Foundation, Version 3, 19 November 2007.
- http://www.apache.org/licenses/LICENSE-2.0
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU Affero General Public License for more details.
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+You should have received a copy of the GNU Affero General Public License
+along with this program. If not, see http://www.gnu.org/licenses/agpl-3.0.html.
+
+http://www.gnu.org/licenses/why-affero-gpl.html
View
14 bin/top
@@ -1,36 +1,34 @@
#!/usr/bin/env node
var exec = require('child_process').exec;
-var cmd = "ps aux | awk '/launch_chroot/ && !/awk/ {print $3,$4,$2,$5,$6,$10,$13}' | sort -r | head -n 20";
+//$13 should be name?
+var cmd = "ps aux | awk '/chroot_runner/ && !/awk/ {print $3,$4,$2,$5,$6,$10,$9}' | sort -r | head -n 50";
require('colors');
var top = function() {
- console.log('cpu\tmem\tvsz\trss\tpid\ttime\tapp'.magenta.bold);
+ console.log('cpu\tmem\tvsz\trss\tpid\ttime\tdate'.magenta.bold);
exec(cmd, function(err, stdout) {
var data = stdout.split('\n');
//console.log(stdout);
data.forEach(function(l) {
var line = l.split(' ');
if (line[1]) {
- for (var i = 2; i < 6; i++) {
+ for (var i = 2; i < 7; i++) {
line[i] = line[i].white;
}
- if (parseFloat(line[0]) > 1) {
+ if (parseFloat(line[0]) > 0.75) {
line[0] = line[0].red.bold;
} else {
line[0] = line[0].white;
}
- if (parseFloat(line[1]) > 1) {
+ if (parseFloat(line[1]) > 0.75) {
line[1] = line[1].red.bold;
} else {
line[1] = line[1].white;
}
-
- var tmp = line[6].split(':');
- line[6] = ('[' + tmp[0] + ']:').blue + tmp[1].yellow;
console.log(line.join('\t'));
}
View
1 install.txt
@@ -14,6 +14,7 @@ Dependencies:
forever
cradle
coloured
+ coffee-script
Installation:
Install node.js (0.4.x recommended)
View
2 scripts/chroot_runner.js
@@ -107,7 +107,7 @@ var myPid = daemon.start();
});
var start_child = function () {
- child = spawn('/usr/bin/node', args, { env: env });
+ child = spawn((path.extname(args[0]) == '.coffee' ? '/usr/bin/coffee' : '/usr/bin/node'), args, { env: env });
child.stdout.on('data', log_line.bind('stdout'));
child.stderr.on('data', log_line.bind('stderr'));
child.on('exit', function (code) {
View
16 scripts/start_hosted_apps.js
@@ -102,6 +102,7 @@ var next = function() {
restart_key: config.opt.restart_key
}
}, {
+ writeHead: function(data){},
send: function(data) {
if (data instanceof Object) {
if (data.status.indexOf('failed') > -1) {
@@ -116,6 +117,21 @@ var next = function() {
}
//Let the process fire up and daemonize before starting the next one
setTimeout(next, 500);
+ },
+ end: function(data){
+ if (data instanceof Object) {
+ if (data.status.indexOf('failed') > -1) {
+ f++;
+ } else {
+ g++;
+ }
+ util.print(' [' + ((data.status.indexOf('failed') > -1) ? bad.red.bold : good.bold.green) + ']\n');
+ } else {
+ g++;
+ util.print(' [' + '!!'.yellow.bold + ']\n');
+ }
+ //Let the process fire up and daemonize before starting the next one
+ setTimeout(next, 500);
}
});

0 comments on commit 0b05366

Please sign in to comment.