+17
| var stdin = process.openStdin() | ||
| process.stdin.setRawMode(true) | ||
| var NUM_START = 48 | ||
| stdin.on('data', function (press) { | ||
| var keycode = press.readUInt8(0) | ||
| if(keycode==3){ | ||
| process.stdout.write('^C') | ||
| process.kill(process.pid, 'SIGTERM') | ||
| } | ||
| var number = keycode - 48 | ||
| if(number>=0 && number<=9){ | ||
| if(number==0) number=10 | ||
| console.log('Restarting Process %d',number) | ||
| } | ||
| }) |
| { | ||
| "name": "foreman", | ||
| "version": "0.0.14", | ||
| "dependencies": { | ||
| "colors": { | ||
| "version": "0.6.0-1" | ||
| }, | ||
| "commander": { | ||
| "version": "1.1.1", | ||
| "dependencies": { | ||
| "keypress": { | ||
| "version": "0.1.0" | ||
| } | ||
| } | ||
| }, | ||
| "mu2": { | ||
| "version": "0.5.17" | ||
| }, | ||
| "http-proxy": { | ||
| "version": "0.8.5", | ||
| "dependencies": { | ||
| "optimist": { | ||
| "version": "0.3.5", | ||
| "dependencies": { | ||
| "wordwrap": { | ||
| "version": "0.0.2" | ||
| } | ||
| } | ||
| }, | ||
| "pkginfo": { | ||
| "version": "0.2.3" | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } |
+1
-1
@@ -96,3 +96,3 @@ var util = require('util') | ||
| this.Warn = function Warn(prefix){ | ||
| this.Warn = function Warn(){ | ||
| console.warn('[WARN] '.yellow + this.fmt.apply(null,arguments).yellow ); | ||
@@ -99,0 +99,0 @@ } |
+2
-2
@@ -15,5 +15,5 @@ var prog = require('child_process') | ||
| if(hostname){ | ||
| cons.Alert('Forwarding requests to %s through forward proxy',hostname) | ||
| cons.Alert('Intercepting requests to %s through forward proxy',hostname) | ||
| }else{ | ||
| cons.Alert('Forwarding ALL requests through forward proxy') | ||
| cons.Alert('Intercepting ALL requests through forward proxy') | ||
| } | ||
@@ -20,0 +20,0 @@ emitter.once('killall',function(){ |
+1
-1
@@ -47,3 +47,3 @@ var prog = require('child_process') | ||
| cons.Alert('Starting Proxy Server %s -> %s', port, port_targets); | ||
| cons.Alert('Starting Proxy Server [%s] %s -> %s', key, port, port_targets); | ||
@@ -50,0 +50,0 @@ emitter.once('killall',function(){ |
+20
-14
@@ -12,5 +12,5 @@ #!/usr/bin/env node | ||
| program.version('0.0.8'); | ||
| program.option('-j, --procfile <file>', 'load profile FILE','Procfile'); | ||
| program.option('-e, --env <file>' ,'use FILE to load environment','.env'); | ||
| program.option('-p, --port <port>' ,'start indexing ports at number PORT',5000); | ||
| program.option('-j, --procfile <FILE>' , 'load profile FILE','Procfile'); | ||
| program.option('-e, --env <FILE>' ,'use FILE to load environment','.env'); | ||
| program.option('-p, --port <PORT>' ,'start indexing ports at number PORT',5000); | ||
@@ -54,8 +54,8 @@ var command; | ||
| .usage('[Options] [Processes] e.g. web=1,log=2,api') | ||
| .option('-s, --showenvs' ,'show ENV variables on start',false) | ||
| .option('-x, --proxy <port>','start a load balancing proxy on PORT') | ||
| .option('-f, --forward <port>','start a forward proxy') | ||
| .option('-h, --hostname <HOSTNAME>','set forward proxy to HOSTNAME',null) | ||
| .option('-t, --trim <N>' ,'trim logs to N characters',0) | ||
| .option('-w, --wrap' ,'wrap logs (negates trim)',false) | ||
| .option('-s, --showenvs' ,'show ENV variables on start',false) | ||
| .option('-x, --proxy <PORT>' ,'start a load balancing proxy on PORT') | ||
| .option('-f, --forward <PORT>' ,'start a forward proxy on PORT') | ||
| .option('-i, --intercept <HOSTNAME>' ,'set forward proxy to intercept HOSTNAME',null) | ||
| .option('-t, --trim <N>' ,'trim logs to N characters',0) | ||
| .option('-w, --wrap' ,'wrap logs (negates trim)') | ||
| .description('Start the jobs in the Procfile') | ||
@@ -93,3 +93,3 @@ .action(function(command_left,command_right){ | ||
| if(command.forward) startForward(command.forward,command.hostname,emitter) | ||
| if(command.forward) startForward(command.forward,command.intercept,emitter) | ||
@@ -111,5 +111,5 @@ startProxies(reqs,proc,command,emitter,program.port); | ||
| .command('export') | ||
| .option('-a, --app <name>' ,'export upstart application as NAME','foreman') | ||
| .option('-u, --user <name>' ,'export upstart user as NAME','root') | ||
| .option('-o, --out <dir>' ,'export upstart files to DIR','.') | ||
| .option('-a, --app <NAME>' ,'export upstart application as NAME','foreman') | ||
| .option('-u, --user <NAME>' ,'export upstart user as NAME','root') | ||
| .option('-o, --out <DIR>' ,'export upstart files to DIR','.') | ||
| .description('Export to an upstart job independent of foreman') | ||
@@ -225,2 +225,8 @@ .action(function(command_left,command_right){ | ||
| if(program.args.length==0) program.help(); | ||
| if(program.args.length==0) { | ||
| console.log(' _____ '.cyan) | ||
| console.log(' | __|___ ___ ___ _____ ___ ___ '.cyan) | ||
| console.log(' | __| . | _| -_| | | |'.yellow) | ||
| console.log(' |__| |___|_| |___|_|_|_|_^_|_|_|'.magenta) | ||
| program.help(); | ||
| } |
+1
-1
| { | ||
| "name": "foreman", | ||
| "version": "0.0.14", | ||
| "version": "0.0.15", | ||
| "homepage": "http://nodefly.github.com/node-foreman/", | ||
@@ -5,0 +5,0 @@ "description": "Node Implementation of Foreman", |
+26
-8
@@ -18,2 +18,6 @@ # Node Foreman | ||
| All of Foremans version dependencies have been set to use `latest`. | ||
| If however you find a dependency should break it is possible to find out which dependency versions were last working with Foreman. | ||
| The `npm-shrinkwrap.json` file is updated each time Foreman is published to npm. | ||
| ### How to Contribute | ||
@@ -108,5 +112,2 @@ | ||
| Bad candidates are default configurations that do not contain any location-specific | ||
| information. | ||
| ### Advanced Usage | ||
@@ -188,6 +189,7 @@ | ||
| ## Scalability | ||
| ## Proxy Servers | ||
| Node.js applications scale by creating multiple processes that either | ||
| share a socket, or sit behind a load balancer. | ||
| Node.js processes are supposed to be stateless. | ||
| Application scale by starting multiple processes that either share a socket, | ||
| or sit behind a load balancer. | ||
| Node Foreman can help you test the parallel capabilities of your application | ||
@@ -205,6 +207,16 @@ by spawning multiple processes behind a round-robin proxy automatically. | ||
| ## Security | ||
| ### Multiple Proxies | ||
| _This Section is Alpha_ | ||
| If you have multiple processes in your `Procfile` you can start multiple proxies. | ||
| $ nf start -x 8888,8080,9090 | ||
| This will start 3 separate proxies and bind each to a separate process group. | ||
| Proxies are bound based on their order specified, their order in the Procfile, | ||
| or by their order on the command line. | ||
| $ nf start -x 8888,9999 web,api | ||
| ### Security | ||
| Node Foreman disallows applications from starting on privileged ports. | ||
@@ -224,1 +236,7 @@ It does however allow proxies to be bound to lower ports, such as port 80. | ||
Shrinkwrap
Supply chain riskPackage contains a shrinkwrap file. This may allow the package to bypass normal install procedures.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 2 instances in 1 package
Shell access
Supply chain riskThis module accesses the system shell. Accessing the system shell increases the risk of executing arbitrary code.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 10 instances in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 2 instances in 1 package
Shell access
Supply chain riskThis module accesses the system shell. Accessing the system shell increases the risk of executing arbitrary code.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 10 instances in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
296259
0.65%25
8.7%692
8.98%238
8.18%1
Infinity%