observing / haproxy Goto Github PK
View Code? Open in Web Editor NEWHAProxy management and orchestration
License: MIT License
HAProxy management and orchestration
License: MIT License
We should be able to parse streamingly parse the logfile that HAProxy outputs so we can create a stream of useful information from it.
do you plan to do also add backend and add frontend methods?
Summary of fixes, for tests to run correctly...
Seems like entire test suite may have evolved organically + requires to be run inside a pristine build environment (where npm has never been installed + no npm modules have been installed), so entire test flow can be fixed.
Detailed list of problems + resolutions.
npm ERR! not a package /tmp/npm-29229-1Lj84CuY/1432732957086-0.35323801008053124/tmp.tgz
fix: unsure
workaround: cd / && npm --prefix=$(pwd) install haproxy --save
fix: define mocha as dependency, along with which + dsv + mkdirp
workaround: npm install mocha --save
net8-rmt# npm test
npm ERR! Error: ENOENT, open '/buildstacks/work/haproxy-1.5.12/package.json'
npm ERR! If you need help, you may report this entire log,
npm ERR! including the npm and node versions, at:
npm ERR! http://github.com/npm/npm/issues
npm ERR! System Linux 3.19.0-18-generic
npm ERR! command "/usr/bin/nodejs" "/usr/bin/npm" "test"
npm ERR! cwd /buildstacks/work/haproxy-1.5.12
npm ERR! node -v v0.10.25
npm ERR! npm -v 1.4.21
npm ERR! path /buildstacks/work/haproxy-1.5.12/package.json
npm ERR! code ENOENT
npm ERR! errno 34
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /buildstacks/work/haproxy-1.5.12/npm-debug.log
npm ERR! not ok code 0
Failed because package.json is the wrong place.
workaround: ln -s node_modules/haproxy/package.json .
net8-rmt# npm test
[email protected] test /buildstacks/work/haproxy-1.5.12
NODE_ENV=testing ./node_modules/.bin/mocha $(find test -name '*.test.js')
find: `test': No such file or directory
/buildstacks/work/haproxy-1.5.12/node_modules/mocha/lib/utils.js:591
if (!files.length) throw new Error("cannot resolve path (or pattern) '"
^
Error: cannot resolve path (or pattern) 'test'
at Object.lookupFiles (/buildstacks/work/haproxy-1.5.12/node_modules/mocha/lib/utils.js:591:32)
at runAgain (/buildstacks/work/haproxy-1.5.12/node_modules/mocha/bin/_mocha:320:30)
at Array.forEach (native)
at Object. (/buildstacks/work/haproxy-1.5.12/node_modules/mocha/bin/_mocha:319:6)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Function.Module.runMain (module.js:497:10)
at startup (node.js:119:16)
at node.js:902:3
npm ERR! Test failed. See above for more details.
npm WARN This failure might be due to the use of legacy binary "node"
npm WARN For further explanations, please read
/usr/share/doc/nodejs/README.Debian
npm ERR! not ok code 0
There is no 'test' directory. Maybe this should be 'node_modules'.
net8-rmt# npm test
[email protected] test /buildstacks/work/haproxy-1.5.12
NODE_ENV=testing ./node_modules/.bin/mocha $(find node_modules -name '*.test.js')
module.js:340
throw err;
^
Error: Cannot find module 'chai'
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:280:25)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Suite. (/buildstacks/work/haproxy-1.5.12/node_modules/haproxy/test/haproxy.test.js:7:14)
at context.describe.context.context (/buildstacks/work/haproxy-1.5.12/node_modules/mocha/lib/interfaces/bdd.js:49:10)
at Object. (/buildstacks/work/haproxy-1.5.12/node_modules/haproxy/test/haproxy.test.js:1:63)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at /buildstacks/work/haproxy-1.5.12/node_modules/mocha/lib/mocha.js:192:27
at Array.forEach (native)
at Mocha.loadFiles (/buildstacks/work/haproxy-1.5.12/node_modules/mocha/lib/mocha.js:189:14)
at Mocha.run (/buildstacks/work/haproxy-1.5.12/node_modules/mocha/lib/mocha.js:422:31)
at Object. (/buildstacks/work/haproxy-1.5.12/node_modules/mocha/bin/_mocha:398:16)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Function.Module.runMain (module.js:497:10)
at startup (node.js:119:16)
at node.js:902:3
npm ERR! Test failed. See above for more details.
npm WARN This failure might be due to the use of legacy binary "node"
npm WARN For further explanations, please read
/usr/share/doc/nodejs/README.Debian
npm ERR! not ok code 0
Now chai is missing.
fix/workaround: change 'test' to 'node_modules' in package_json
fix: define chai as a dependency
workaround: npm install chai --save
Dependency sinon-chai missing.
fix: define sinon-chai as a dependency
workaround: npm install sinon-chai --save
Hi,
We would like to report a potential security vulnerability.
The bug is introduced because the package-exported method fails to sanitize its opts.prefix
parameter and lets it flow into a sensitive command execution API.
Here is the proof of concept.
const lib = require('haproxy');
var opts = {
prefix: 'touch rce',
which: ' '
}
var a = new lib(opts)
a.orchestrator.run(['haproxy'], () => {})// a file named rce will be created
Please consider fixing it. thanks!
you know the drill
Since this project seems abandoned, please see haproxy-sdk and haproxy-api
the reload
method docs state that it will
Hot reload the configuration with the minimal amount of downtime
(as long as you don't use the hard
option).
After looking at the actual command
var cmd = 'haproxy -D -f %s -p %s -sf %s';
it looks like it's using the -sf
option which should cause a reload with zero downtime / traffic disruption.
If this correct can we/you/me update the docs (I'm happy to make a PR) as the difference is quite important.
Have you thought about or are you aware of any efforts to configure haproxy or a subset of its features using JSON?
Generating a load via - ab -t 30 -n 1000000 -c 5 - produces unexpected results on a multi-core machine.
Setting nbproc 1, works as expected - one CPU pegs near 100%.
Setting nbproc 2, works as expected - two CPUs peg near 100%.
After this, raising nbproc to higher values works unexpectedly - only two CPUs peg, never more.
Maybe this is by design + the docs seem to indicate nbproc 4 should peg four CPUs.
Looking at ps, the correct number of processes startup as expected. It just appears only two of these processes are used.
Some of the orchestrator
code uses really odd ps | grep
magic to find the pid of running processes and checking for running processes. This can all be simplefied by just using pgrep haproxy
which just returns a list of all process id's
It currently just dies, hard when it receives a response that it did not expect. For example if you do
haproxy.disable('foo', '\n\rn\ evil chars')
It will receive an error response from the server. Which it cannot detect.
To see what happens to your code in Node.js 10, Greenkeeper has created a branch with the following changes:
.travis.yml
If you’re interested in upgrading this repo to Node.js 10, you can open a PR with these changes. Please note that this issue is just intended as a friendly reminder and the PR as a possible starting point for getting your code running on Node.js 10.
Greenkeeper has checked the engines
key in any package.json
file, the .nvmrc
file, and the .travis.yml
file, if present.
engines
was only updated if it defined a single version, not a range..nvmrc
was updated to Node.js 10.travis.yml
was only changed if there was a root-level node_js
that didn’t already include Node.js 10, such as node
or lts/*
. In this case, the new version was appended to the list. We didn’t touch job or matrix configurations because these tend to be quite specific and complex, and it’s difficult to infer what the intentions were.For many simpler .travis.yml
configurations, this PR should suffice as-is, but depending on what you’re doing it may require additional work or may not be applicable at all. We’re also aware that you may have good reasons to not update to Node.js 10, which is why this was sent as an issue and not a pull request. Feel free to delete it without comment, I’m a humble robot and won’t feel rejected 🤖
There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.
Your Greenkeeper Bot 🌴
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.