Eevans has uploaded a new change for review. https://gerrit.wikimedia.org/r/243350
Change subject: Update restbase to 176eebd ...................................................................... Update restbase to 176eebd List of changes: xxxxxxx Update node module dependencies Change-Id: I8972373cb7164b8d373ddae8bc5e4f9250bc34df --- M node_modules/js-yaml/node_modules/argparse/package.json M node_modules/jsonwebtoken/node_modules/jws/node_modules/base64url/node_modules/concat-stream/node_modules/inherits/package.json M node_modules/jsonwebtoken/node_modules/jws/node_modules/jwa/node_modules/ecdsa-sig-formatter/node_modules/asn1.js/node_modules/inherits/package.json M node_modules/preq/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/inherits/package.json M node_modules/preq/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/isarray/package.json M node_modules/preq/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/string_decoder/package.json M node_modules/restbase-mod-table-cassandra/node_modules/restbase-mod-table-spec/node_modules/core-js/package.json A node_modules/service-runner/.jscs.json D node_modules/service-runner/.jscsrc A node_modules/service-runner/.jshintignore A node_modules/service-runner/.travis.yml M node_modules/service-runner/lib/base_service.js M node_modules/service-runner/lib/docker.js M node_modules/service-runner/lib/logger.js M node_modules/service-runner/lib/master.js M node_modules/service-runner/lib/worker.js M node_modules/service-runner/node_modules/yargs/node_modules/cliui/node_modules/right-align/node_modules/align-text/package.json M node_modules/service-runner/package.json A node_modules/service-runner/test.js A node_modules/service-runner/test/index.js M node_modules/swagger-router/node_modules/js-yaml/node_modules/argparse/package.json 21 files changed, 509 insertions(+), 137 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/services/aqs/deploy refs/changes/50/243350/1 diff --git a/node_modules/js-yaml/node_modules/argparse/package.json b/node_modules/js-yaml/node_modules/argparse/package.json index 4ff4f69..959b779 100644 --- a/node_modules/js-yaml/node_modules/argparse/package.json +++ b/node_modules/js-yaml/node_modules/argparse/package.json @@ -40,7 +40,7 @@ "gitHead": "990f1b5332e70dd3c1c437d2f4077a2b63ac9674", "_id": "[email protected]", "_shasum": "bcfae39059656d1973d0b9e6a1a74154b5a9a136", - "_from": "argparse@~1.0.2", + "_from": "argparse@~ 1.0.0", "_npmVersion": "1.4.28", "_npmUser": { "name": "vitaly", diff --git a/node_modules/jsonwebtoken/node_modules/jws/node_modules/base64url/node_modules/concat-stream/node_modules/inherits/package.json b/node_modules/jsonwebtoken/node_modules/jws/node_modules/base64url/node_modules/concat-stream/node_modules/inherits/package.json index 292dc68..420a206 100644 --- a/node_modules/jsonwebtoken/node_modules/jws/node_modules/base64url/node_modules/concat-stream/node_modules/inherits/package.json +++ b/node_modules/jsonwebtoken/node_modules/jws/node_modules/base64url/node_modules/concat-stream/node_modules/inherits/package.json @@ -30,7 +30,7 @@ "shasum": "b17d08d326b4423e568eff719f91b0b1cbdf69f1", "tarball": "http://registry.npmjs.org/inherits/-/inherits-2.0.1.tgz" }, - "_from": "inherits@~2.0.1", + "_from": "inherits@^2.0.1", "_npmVersion": "1.3.8", "_npmUser": { "name": "isaacs", diff --git a/node_modules/jsonwebtoken/node_modules/jws/node_modules/jwa/node_modules/ecdsa-sig-formatter/node_modules/asn1.js/node_modules/inherits/package.json b/node_modules/jsonwebtoken/node_modules/jws/node_modules/jwa/node_modules/ecdsa-sig-formatter/node_modules/asn1.js/node_modules/inherits/package.json index 420a206..2ae619b 100644 --- a/node_modules/jsonwebtoken/node_modules/jws/node_modules/jwa/node_modules/ecdsa-sig-formatter/node_modules/asn1.js/node_modules/inherits/package.json +++ b/node_modules/jsonwebtoken/node_modules/jws/node_modules/jwa/node_modules/ecdsa-sig-formatter/node_modules/asn1.js/node_modules/inherits/package.json @@ -30,7 +30,7 @@ "shasum": "b17d08d326b4423e568eff719f91b0b1cbdf69f1", "tarball": "http://registry.npmjs.org/inherits/-/inherits-2.0.1.tgz" }, - "_from": "inherits@^2.0.1", + "_from": "inherits@2", "_npmVersion": "1.3.8", "_npmUser": { "name": "isaacs", diff --git a/node_modules/preq/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/inherits/package.json b/node_modules/preq/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/inherits/package.json index 420a206..75ae68e 100644 --- a/node_modules/preq/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/inherits/package.json +++ b/node_modules/preq/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/inherits/package.json @@ -30,7 +30,7 @@ "shasum": "b17d08d326b4423e568eff719f91b0b1cbdf69f1", "tarball": "http://registry.npmjs.org/inherits/-/inherits-2.0.1.tgz" }, - "_from": "inherits@^2.0.1", + "_from": "inherits@~2.0.1", "_npmVersion": "1.3.8", "_npmUser": { "name": "isaacs", @@ -44,6 +44,5 @@ ], "directories": {}, "_shasum": "b17d08d326b4423e568eff719f91b0b1cbdf69f1", - "_resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.1.tgz", - "readme": "ERROR: No README data found!" + "_resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.1.tgz" } diff --git a/node_modules/preq/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/isarray/package.json b/node_modules/preq/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/isarray/package.json index 19228ab..85aec01 100644 --- a/node_modules/preq/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/isarray/package.json +++ b/node_modules/preq/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/isarray/package.json @@ -45,9 +45,5 @@ ], "directories": {}, "_shasum": "8a18acfca9a8f4177e09abfc6038939b05d1eedf", - "_resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", - "bugs": { - "url": "https://github.com/juliangruber/isarray/issues" - }, - "readme": "ERROR: No README data found!" + "_resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz" } diff --git a/node_modules/preq/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/string_decoder/package.json b/node_modules/preq/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/string_decoder/package.json index a8c586b..379f735 100644 --- a/node_modules/preq/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/string_decoder/package.json +++ b/node_modules/preq/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/string_decoder/package.json @@ -49,6 +49,5 @@ "tarball": "http://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz" }, "directories": {}, - "_resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", - "readme": "ERROR: No README data found!" + "_resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz" } diff --git a/node_modules/restbase-mod-table-cassandra/node_modules/restbase-mod-table-spec/node_modules/core-js/package.json b/node_modules/restbase-mod-table-cassandra/node_modules/restbase-mod-table-spec/node_modules/core-js/package.json index 6eb9115..04953c7 100644 --- a/node_modules/restbase-mod-table-cassandra/node_modules/restbase-mod-table-spec/node_modules/core-js/package.json +++ b/node_modules/restbase-mod-table-cassandra/node_modules/restbase-mod-table-spec/node_modules/core-js/package.json @@ -81,6 +81,5 @@ "tarball": "http://registry.npmjs.org/core-js/-/core-js-0.9.18.tgz" }, "directories": {}, - "_resolved": "https://registry.npmjs.org/core-js/-/core-js-0.9.18.tgz", - "readme": "ERROR: No README data found!" + "_resolved": "https://registry.npmjs.org/core-js/-/core-js-0.9.18.tgz" } diff --git a/node_modules/service-runner/.jscs.json b/node_modules/service-runner/.jscs.json new file mode 100644 index 0000000..1e038a9 --- /dev/null +++ b/node_modules/service-runner/.jscs.json @@ -0,0 +1,26 @@ +{ + "preset": "node-style-guide", + "requireCurlyBraces": [ + "if", + "else", + "for", + "while", + "do", + "try", + "catch" + ], + "validateIndentation": 4, + "requireCamelCaseOrUpperCaseIdentifiers": "ignoreProperties", + "requireCapitalizedComments": null, + "maximumLineLength": 100, + "validateQuoteMarks": null, + "requireTrailingComma": null, + "disallowTrailingComma": null, + "requireSpacesInsideObjectBrackets": "all", + + "excludeFiles": [ + "node_modules/**", + "test/**", + "coverage/**" + ] +} \ No newline at end of file diff --git a/node_modules/service-runner/.jscsrc b/node_modules/service-runner/.jscsrc deleted file mode 100644 index 1b06b8d..0000000 --- a/node_modules/service-runner/.jscsrc +++ /dev/null @@ -1,24 +0,0 @@ -{ - "preset": "node-style-guide", - - // Preserve these exceptions, they codify what we're already doing. - "requireCurlyBraces": [ - "if", - "else", - "for", - "while", - "do", - "try", - "catch" - ], - - // We'd like to eliminate these at some point, to conform with the preset. - "maximumLineLength": null, - "requireCamelCaseOrUpperCaseIdentifiers": null, - "requireTrailingComma": null, - "validateIndentation": null, - - "excludeFiles": [ - "node_modules/**" - ] -} diff --git a/node_modules/service-runner/.jshintignore b/node_modules/service-runner/.jshintignore new file mode 100644 index 0000000..f05b1f2 --- /dev/null +++ b/node_modules/service-runner/.jshintignore @@ -0,0 +1,2 @@ +node_modules +test diff --git a/node_modules/service-runner/.travis.yml b/node_modules/service-runner/.travis.yml new file mode 100644 index 0000000..e15d757 --- /dev/null +++ b/node_modules/service-runner/.travis.yml @@ -0,0 +1,11 @@ +language: node_js +node_js: + - "0.10" + +sudo: false + +notifications: + email: + - [email protected] + +script: npm test diff --git a/node_modules/service-runner/lib/base_service.js b/node_modules/service-runner/lib/base_service.js index 79305ba..41f2fc0 100644 --- a/node_modules/service-runner/lib/base_service.js +++ b/node_modules/service-runner/lib/base_service.js @@ -199,14 +199,14 @@ }); } - var package_json = {}; + var packageJson = {}; try { - package_json = require(self._basePath + '/' + 'package.json'); + packageJson = require(self._basePath + '/' + 'package.json'); } catch (e) {} return action.then(function(config) { config = self._sanitizeConfig(config, self.options); - config.package = package_json; + config.package = packageJson; if (config.info) { // for backwards compat var pack = config.package; diff --git a/node_modules/service-runner/lib/docker.js b/node_modules/service-runner/lib/docker.js index 8a5c6ca..e0832a1 100644 --- a/node_modules/service-runner/lib/docker.js +++ b/node_modules/service-runner/lib/docker.js @@ -20,7 +20,7 @@ // The options used in the script var opts; // The image name -var img_name; +var imgName; // The container's name var name; @@ -36,10 +36,10 @@ * @param {Boolean} capture whether to capture stdout and return its contents * @return {Promise} the promise which is fulfilled once the child exists */ -function promised_spawn(args, capture) { +function promisedSpawn(args, capture) { return new P(function(resolve, reject) { - var options = capture ? undefined : {stdio: 'inherit'}; + var options = capture ? undefined : { stdio: 'inherit' }; var ret = ''; if (opts.verbose) { console.log('# RUNNING: ' + args.join(' ') + '\n' + @@ -67,11 +67,11 @@ * * @return {Promise} the promise which creates the image file */ -function create_docker_file() { +function createDockerFile() { var contents = ''; - var base_img; - var extra_pkgs = ['nodejs', 'nodejs-legacy', 'npm', 'git']; + var baseImg; + var extraPkgs = ['nodejs', 'nodejs-legacy', 'npm', 'git']; // set some defaults if (!pkg.deploy) { @@ -88,23 +88,23 @@ } // set the deploy target - base_img = targets[pkg.deploy.target]; + baseImg = targets[pkg.deploy.target]; // get any additional packages that need to be installed Object.keys(pkg.deploy.dependencies).forEach(function(sys) { - if (sys !== '_all' && (sys === base_img || (new RegExp(sys)).test(base_img))) { - Array.prototype.push.apply(extra_pkgs, pkg.deploy.dependencies[sys]); + if (sys !== '_all' && (sys === baseImg || (new RegExp(sys)).test(baseImg))) { + Array.prototype.push.apply(extraPkgs, pkg.deploy.dependencies[sys]); } }); - Array.prototype.push.apply(extra_pkgs, pkg.deploy.dependencies._all); + Array.prototype.push.apply(extraPkgs, pkg.deploy.dependencies._all); - if (!base_img || base_img === '') { + if (!baseImg || baseImg === '') { console.error('ERROR: You must specify a valid target!'); console.error('ERROR: Check the deploy stanza in package.json and targets.yaml'); process.exit(2); } - contents = 'FROM ' + base_img + '\n' + - 'RUN apt-get update && apt-get install -y ' + extra_pkgs.join(' ') + + contents = 'FROM ' + baseImg + '\n' + + 'RUN apt-get update && apt-get install -y ' + extraPkgs.join(' ') + ' && rm -rf /var/lib/apt/lists/*\n'; if (!opts.deploy) { @@ -142,9 +142,9 @@ * * @return {Promise} the promise starting the build */ -function build_img() { +function buildImg() { - return promised_spawn(['docker', 'build', '-t', img_name, '.']); + return promisedSpawn(['docker', 'build', '-t', imgName, '.']); } @@ -155,7 +155,7 @@ * @param {Array} args the array of extra parameters to pass, optional * @return {Promise} the promise starting the container */ -function start_container(args) { +function startContainer(args) { var cmd = ['docker', 'run', '--name', name, '--rm']; @@ -172,10 +172,10 @@ }); // append the image name to create a container from - cmd.push(img_name); + cmd.push(imgName); // ok, start the container - return promised_spawn(cmd); + return promisedSpawn(cmd); } @@ -185,35 +185,35 @@ * rebuilds the node modules, committing and git-review-ing * the result */ -function update_deploy() { +function updateDeploy() { - function promised_git(args) { - var args_arr = ['git']; - Array.prototype.push.apply(args_arr, args); - return promised_spawn(args_arr, true); + function promisedGit(args) { + var argsArr = ['git']; + Array.prototype.push.apply(argsArr, args); + return promisedSpawn(argsArr, true); } - function chained_pgit(args) { + function chainedPgit(args) { var arg = args.shift(); if (!arg) { return P.resolve(); } - return promised_git(arg) + return promisedGit(arg) .then(function(data) { if (args.length === 0) { return P.resolve(data); } - return chained_pgit(args); + return chainedPgit(args); }); } // check if there is an alternative repo name defined - return promised_git(['config', 'deploy.name']) + return promisedGit(['config', 'deploy.name']) .then(function(name) { opts.name = name ? name : pkg.name; // we need to CHDIR into the deploy dir for subsequent operations process.chdir(opts.dir); - return chained_pgit([ + return chainedPgit([ // make sure we are on master ['checkout', 'master'], // fetch any possible updates @@ -228,10 +228,10 @@ // the submodule is present opts.submodule = list.split(' ')[1]; // update it fully - return promised_git(['submodule', 'update', '--init']) + return promisedGit(['submodule', 'update', '--init']) .then(function() { process.chdir(opts.dir + '/' + opts.submodule); - return chained_pgit([ + return chainedPgit([ // fetch new commits ['fetch', 'origin'], // inspect what has changed @@ -243,18 +243,23 @@ opts.need_build = true; } // get the SHA1 of the latest commit on master - return promised_git(['rev-parse', '--short', 'origin/master']); - }).then(function(short_sha1) { - opts.commit_msg = 'Update ' + opts.name + ' to ' + short_sha1 + '\n\n'; + return promisedGit(['rev-parse', '--short', 'origin/master']); + }).then(function(shortSha1) { + opts.commit_msg = 'Update ' + opts.name + ' to ' + shortSha1 + '\n\n'; // get a nice list of commits included in the change - return promised_git(['log', '..origin/master', '--oneline', '--no-merges', '--reverse', '--color=never']); + return promisedGit(['log', + '..origin/master', + '--oneline', + '--no-merges', + '--reverse', + '--color=never']); }).then(function(logs) { if (!logs && !opts.need_build) { // no updates have happened, nothing to do here any more but clean up // go back to the root dir process.chdir(opts.dir); // and get back to master - return promised_git(['checkout', 'master']) + return promisedGit(['checkout', 'master']) .then(function() { console.log('The deploy repository is up to date already, exiting.'); process.exit(0); @@ -265,12 +270,12 @@ logs = ''; } opts.commit_msg += 'List of changes:\n' + logs; - return promised_git(['checkout', 'origin/master']); + return promisedGit(['checkout', 'origin/master']); }).then(function() { // go back to the root dir process.chdir(opts.dir); // add the submodule changes - return promised_git(['add', opts.submodule]); + return promisedGit(['add', opts.submodule]); }); }); } else { @@ -278,13 +283,16 @@ opts.submodule = 'src'; opts.need_build = true; opts.commit_msg = 'Initial import of ' + opts.name; - return promised_git(['submodule', 'add', 'https://gerrit.wikimedia.org/r/mediawiki/services/' + opts.name, opts.submodule]); + return promisedGit(['submodule', + 'add', + 'https://gerrit.wikimedia.org/r/mediawiki/services/' + opts.name, + opts.submodule]); } }).then(function() { // make sure the package.json symlink is in place return fs.symlinkAsync(opts.submodule + '/package.json', 'package.json') .catch(function() {}).then(function() { - return promised_git(['add', 'package.json']); + return promisedGit(['add', 'package.json']); }); }).then(function() { if (!opts.need_build) { @@ -295,15 +303,15 @@ opts.commit_msg += 'xxxxxxx Update node module dependencies\n'; } // a rebuild is needed, start by removing the existing modules - return promised_git(['rm', '-r', 'node_modules']) + return promisedGit(['rm', '-r', 'node_modules']) .then(function() { - return promised_spawn(['rm', '-rf', 'node_modules'], true); + return promisedSpawn(['rm', '-rf', 'node_modules'], true); }).then(function() { // start the container which builds the modules - return start_container(['-v', opts.dir + ':/opt/service', '-w', '/opt/service']); + return startContainer(['-v', opts.dir + ':/opt/service', '-w', '/opt/service']); }).then(function() { // remove unnecessary files - return promised_spawn([ + return promisedSpawn([ 'find', 'node_modules/', '-regextype', @@ -314,11 +322,11 @@ ], true); }).then(function() { // add the built submodules - return promised_git(['add', 'node_modules']); + return promisedGit(['add', 'node_modules']); }); }).then(function() { // commit the changes - return promised_git(['commit', '-m', opts.commit_msg]); + return promisedGit(['commit', '-m', opts.commit_msg]); }).then(function() { if (!opts.review) { console.log('\n\nChanges are sitting in the sync-repo branch in'); @@ -326,7 +334,7 @@ console.log(opts.commit_msg); return; } - return chained_pgit([ + return chainedPgit([ // send them for review ['review', '-R'], // get back to master @@ -344,11 +352,11 @@ * * @return {Promise} a promise resolving when the check is done */ -function get_uid() { +function getUid() { if (opts.deploy) { // get the deploy repo location - return promised_spawn(['git', 'config', 'deploy.dir'], true) + return promisedSpawn(['git', 'config', 'deploy.dir'], true) .then(function(dir) { if (!dir) { console.error('ERROR: You must set the location of the deploy repo!'); @@ -362,7 +370,8 @@ opts.uid = stat.uid; opts.gid = stat.gid; }).catch(function(err) { - console.error('ERROR: The deploy repo dir ' + opts.dir + ' does not exist or is not a git repo!'); + console.error('ERROR: The deploy repo dir ' + + opts.dir + ' does not exist or is not a git repo!'); process.exit(3); }); } @@ -383,7 +392,7 @@ /** * Main process signal handler */ -function sig_handle() { +function sigHandle() { if (child) { child.kill('SIGINT'); } @@ -425,27 +434,27 @@ } // use the package's name as the image name - img_name = pkg.name; - if (opts.deploy) { img_name += 'deploy'; } + imgName = pkg.name; + if (opts.deploy) { imgName += 'deploy'; } // the container's name name = pkg.name + '-' + Date.now() + '-' + Math.floor(Math.random() * 1000); // trap exit signals - process.on('SIGINT', sig_handle); - process.on('SIGTERM', sig_handle); + process.on('SIGINT', sigHandle); + process.on('SIGTERM', sigHandle); // change the dir process.chdir(opts.path); // start the process - return get_uid() - .then(create_docker_file) - .then(build_img) + return getUid() + .then(createDockerFile) + .then(buildImg) .then(function() { if (opts.deploy) { - return update_deploy(); + return updateDeploy(); } else { - return start_container(); + return startContainer(); } }); } diff --git a/node_modules/service-runner/lib/logger.js b/node_modules/service-runner/lib/logger.js index 81a3e87..f382a6d 100644 --- a/node_modules/service-runner/lib/logger.js +++ b/node_modules/service-runner/lib/logger.js @@ -2,8 +2,8 @@ var P = require('bluebird'); var extend = require('extend'); var bunyan = require('bunyan'); -var gelf_stream = require('gelf-stream'); -var syslog_stream = require('bunyan-syslog-udp'); +var gelfStream = require('gelf-stream'); +var syslogStream = require('bunyan-syslog-udp'); var DEF_LEVEL = 'warn'; @@ -33,7 +33,7 @@ // Convert the 'gelf' logger type to a real logger return { type: 'raw', - stream: gelf_stream.forBunyan(stream.host, + stream: gelfStream.forBunyan(stream.host, stream.port, stream.options), level: stream.level || conf.level }; @@ -54,7 +54,7 @@ return { level: stream.level || conf.level, type: 'raw', - stream: syslog_stream.createBunyanStream({ + stream: syslogStream.createBunyanStream({ facility: stream.facility || 'local0', host: stream.host || '127.0.0.1', port: stream.port || 514 @@ -74,16 +74,16 @@ conf.streams.forEach(function(stream) { var idx; var convertedStream = stream; - if(streamConverterList.indexOf(stream.type) > -1) { + if (streamConverterList.indexOf(stream.type) > -1) { convertedStream = streamConverter[stream.type](stream, conf); } idx = streams.push(convertedStream); idx--; // check that there is a level field and // update the minimum level index - if(streams[idx].level) { + if (streams[idx].level) { var levelIdx = self._getLevelIndex(streams[idx].level); - if(levelIdx < minLevelIdx) { + if (levelIdx < minLevelIdx) { minLevelIdx = levelIdx; } } else { diff --git a/node_modules/service-runner/lib/master.js b/node_modules/service-runner/lib/master.js index 072952a..f5c6da7 100644 --- a/node_modules/service-runner/lib/master.js +++ b/node_modules/service-runner/lib/master.js @@ -7,6 +7,7 @@ var BaseService = require('./base_service'); var Worker = require('./worker'); +var Logger = require('./logger'); /** * Master class, inherits from BaseService. @@ -52,7 +53,7 @@ } }); - var shutdown_master = function() { + var shutdownMaster = function() { self._shuttingDown = true; self._logger.log('info/service-runner/master', 'master shutting down, killing workers'); if (self.interval) { @@ -64,8 +65,8 @@ }); }; - process.on('SIGINT', shutdown_master); - process.on('SIGTERM', shutdown_master); + process.on('SIGINT', shutdownMaster); + process.on('SIGTERM', shutdownMaster); // Set up rolling restarts process.on('SIGHUP', function() { @@ -150,7 +151,7 @@ // Now replace the exit listener to make sure 'disconnect' was called worker.process.removeListener('exit', exit); worker.process.once('exit', function(exitCode, signalCode) { - if (worker.state != 'disconnected') { + if (worker.state !== 'disconnected') { disconnect(); } exit(exitCode, signalCode); @@ -168,7 +169,7 @@ fixCloseDisconnectListeners(worker); worker.send({ type: 'config', - body: yaml.safeDump(self.config) + body: yaml.dump(self.config) }); worker.on('message', function(msg) { if (msg.type === 'startup_finished') { diff --git a/node_modules/service-runner/lib/worker.js b/node_modules/service-runner/lib/worker.js index 4b4ef59..5a2a5ed 100644 --- a/node_modules/service-runner/lib/worker.js +++ b/node_modules/service-runner/lib/worker.js @@ -59,12 +59,17 @@ // For node 0.6/0.8: npm install [email protected] // For 0.10: npm install heapdump process.on('SIGUSR2', function() { - var heapdump = require('heapdump'); - var cwd = process.cwd(); - console.error('SIGUSR2 received! Writing snapshot.'); - process.chdir('/tmp'); - heapdump.writeSnapshot(); - process.chdir(cwd); + try { + var heapdump = require('heapdump'); + var cwd = process.cwd(); + console.error('SIGUSR2 received! Writing snapshot.'); + process.chdir('/tmp'); + heapdump.writeSnapshot(); + process.chdir(cwd); + } catch (e) { + self._logger.log('warn/service-runner/worker', + 'Worker ' + process.pid + ' received SIGUSR2, but heapdump is not installed'); + } }); self._metrics = makeStatsD(self.config.metrics, self._logger); diff --git a/node_modules/service-runner/node_modules/yargs/node_modules/cliui/node_modules/right-align/node_modules/align-text/package.json b/node_modules/service-runner/node_modules/yargs/node_modules/cliui/node_modules/right-align/node_modules/align-text/package.json index a810bd6..13b5032 100644 --- a/node_modules/service-runner/node_modules/yargs/node_modules/cliui/node_modules/right-align/node_modules/align-text/package.json +++ b/node_modules/service-runner/node_modules/yargs/node_modules/cliui/node_modules/right-align/node_modules/align-text/package.json @@ -52,7 +52,7 @@ "gitHead": "11c2e834ff2c63f9844bddf189fea5cab921e44d", "_id": "[email protected]", "_shasum": "72db3983872eec2313919c9426a993a41afe93f7", - "_from": "align-text@^0.1.0", + "_from": "align-text@^0.1.1", "_npmVersion": "2.10.1", "_nodeVersion": "0.12.4", "_npmUser": { @@ -70,5 +70,6 @@ "tarball": "http://registry.npmjs.org/align-text/-/align-text-0.1.3.tgz" }, "directories": {}, - "_resolved": "https://registry.npmjs.org/align-text/-/align-text-0.1.3.tgz" + "_resolved": "https://registry.npmjs.org/align-text/-/align-text-0.1.3.tgz", + "readme": "ERROR: No README data found!" } diff --git a/node_modules/service-runner/package.json b/node_modules/service-runner/package.json index 0ba3368..d6c6db8 100644 --- a/node_modules/service-runner/package.json +++ b/node_modules/service-runner/package.json @@ -1,6 +1,6 @@ { "name": "service-runner", - "version": "0.2.7", + "version": "0.2.8", "description": "Generic nodejs service supervisor / cluster runner", "main": "service-runner.js", "bin": { @@ -8,9 +8,7 @@ }, "scripts": { "start": "./service-runner.js", - "test": "mocha", - "coverage": "istanbul cover _mocha -- -R spec", - "coveralls": "cat ./coverage/lcov.info | coveralls" + "test": "mocha" }, "repository": { "type": "git", @@ -43,15 +41,20 @@ "yargs": "^3.24.0", "bunyan-syslog-udp": "^0.1.0" }, - "gitHead": "8fed2dfb12e3837bf4633bf02290b47c5567e641", - "_id": "[email protected]", - "_shasum": "79b9587861b16f23f5982681196769038874370f", + "devDependencies": { + "mocha": "^2.2.5", + "mocha-jshint": "^2.2.3", + "mocha-jscs": "^1.2.0" + }, + "gitHead": "ba00eb2adbe958c3b583961201189e513c3e98ef", + "_id": "[email protected]", + "_shasum": "c7342205b1b806cf9826b98eefd8a5b242fdc95d", "_from": "service-runner@^0.2.5", - "_npmVersion": "2.14.3", - "_nodeVersion": "0.10.37", + "_npmVersion": "2.13.2", + "_nodeVersion": "2.5.0", "_npmUser": { - "name": "doorman", - "email": "[email protected]" + "name": "gwicke", + "email": "[email protected]" }, "maintainers": [ { @@ -64,9 +67,9 @@ } ], "dist": { - "shasum": "79b9587861b16f23f5982681196769038874370f", - "tarball": "http://registry.npmjs.org/service-runner/-/service-runner-0.2.7.tgz" + "shasum": "c7342205b1b806cf9826b98eefd8a5b242fdc95d", + "tarball": "http://registry.npmjs.org/service-runner/-/service-runner-0.2.8.tgz" }, "directories": {}, - "_resolved": "https://registry.npmjs.org/service-runner/-/service-runner-0.2.7.tgz" + "_resolved": "https://registry.npmjs.org/service-runner/-/service-runner-0.2.8.tgz" } diff --git a/node_modules/service-runner/test.js b/node_modules/service-runner/test.js new file mode 100644 index 0000000..80d04f3 --- /dev/null +++ b/node_modules/service-runner/test.js @@ -0,0 +1,342 @@ +var conf = { + "info": { + "name": "aqs" + }, + "templates": { + "wmf-content-1.0.0": { + "swagger": "2.0", + "info": { + "version": "1.0.0-beta", + "title": "Wikimedia Analytics REST API", + "description": "This API aims to provide straightforward and low-latency access to Wikimedia Analytics data. It is currently in beta testing, so things aren't completely locked down yet. Each entry point has explicit stability markers to inform you about development status and change policy, according to [our API version policy](https://www.mediawiki.org/wiki/API_versioning).\n### High-volume access\n - As a general rule, don't perform more than 200 requests/s to\n this API.\n - Set a unique `User-Agent` header that allows us to contact you\n quickly. Email addresses or URLs of contact pages work well.\n - Consider using our [HTML\n dumps](https://phabricator.wikimedia.org/T17017) once they\n become available.\n", + "termsOfService": "https://wikimediafoundation.org/wiki/Terms_of_Use", + "contact": { + "name": "the Wikimedia Analytics team", + "url": "http://mediawiki.org/wiki/RESTBase" + }, + "license": { + "name": "Apache2", + "url": "http://www.apache.org/licenses/LICENSE-2.0" + } + }, + "x-subspecs": [ + "analytics/v1/pageviews" + ] + }, + "wmf-sys-1.0.0": { + "info": { + "title": "Default MediaWiki sys API module", + "version": "1.0.0" + }, + "paths": { + "/{module:table}": { + "x-modules": [ + { + "name": "restbase-mod-table-cassandra", + "version": "1.0.0", + "type": "npm", + "options": { + "conf": { + "hosts": [ + "aqs1001.eqiad.wmnet", + "aqs1002.eqiad.wmnet", + "aqs1003.eqiad.wmnet" + ], + "keyspace": "system", + "localDc": "eqiad", + "datacenters": [ + "eqiad" + ], + "username": "cassandra", + "password": "cassandra", + "defaultConsistency": "localQuorum", + "storage_groups": [ + { + "name": "default.group.local", + "domains": "/./" + } + ] + } + } + } + ] + } + } + }, + "wp-default-1.0.0": { + "x-subspecs": [ + { + "paths": { + "/{api:v1}": { + "x-subspec": { + "swagger": "2.0", + "info": { + "version": "1.0.0-beta", + "title": "Wikimedia Analytics REST API", + "description": "This API aims to provide straightforward and low-latency access to Wikimedia Analytics data. It is currently in beta testing, so things aren't completely locked down yet. Each entry point has explicit stability markers to inform you about development status and change policy, according to [our API version policy](https://www.mediawiki.org/wiki/API_versioning).\n### High-volume access\n - As a general rule, don't perform more than 200 requests/s to\n this API.\n - Set a unique `User-Agent` header that allows us to contact you\n quickly. Email addresses or URLs of contact pages work well.\n - Consider using our [HTML\n dumps](https://phabricator.wikimedia.org/T17017) once they\n become available.\n", + "termsOfService": "https://wikimediafoundation.org/wiki/Terms_of_Use", + "contact": { + "name": "the Wikimedia Analytics team", + "url": "http://mediawiki.org/wiki/RESTBase" + }, + "license": { + "name": "Apache2", + "url": "http://www.apache.org/licenses/LICENSE-2.0" + } + }, + "x-subspecs": [ + "analytics/v1/pageviews" + ] + } + } + } + }, + { + "paths": { + "/{api:sys}": { + "x-subspec": { + "info": { + "title": "Default MediaWiki sys API module", + "version": "1.0.0" + }, + "paths": { + "/{module:table}": { + "x-modules": [ + { + "name": "restbase-mod-table-cassandra", + "version": "1.0.0", + "type": "npm", + "options": { + "conf": { + "hosts": [ + "aqs1001.eqiad.wmnet", + "aqs1002.eqiad.wmnet", + "aqs1003.eqiad.wmnet" + ], + "keyspace": "system", + "localDc": "eqiad", + "datacenters": [ + "eqiad" + ], + "username": "cassandra", + "password": "cassandra", + "defaultConsistency": "localQuorum", + "storage_groups": [ + { + "name": "default.group.local", + "domains": "/./" + } + ] + } + } + } + ] + } + } + } + } + } + } + ] + } + }, + "spec": { + "title": "The Analytics RESTBase root", + "paths": { + "/{domain:analytics.wikimedia.org}": { + "x-subspecs": [ + { + "paths": { + "/{api:v1}": { + "x-subspec": { + "swagger": "2.0", + "info": { + "version": "1.0.0-beta", + "title": "Wikimedia Analytics REST API", + "description": "This API aims to provide straightforward and low-latency access to Wikimedia Analytics data. It is currently in beta testing, so things aren't completely locked down yet. Each entry point has explicit stability markers to inform you about development status and change policy, according to [our API version policy](https://www.mediawiki.org/wiki/API_versioning).\n### High-volume access\n - As a general rule, don't perform more than 200 requests/s to\n this API.\n - Set a unique `User-Agent` header that allows us to contact you\n quickly. Email addresses or URLs of contact pages work well.\n - Consider using our [HTML\n dumps](https://phabricator.wikimedia.org/T17017) once they\n become available.\n", + "termsOfService": "https://wikimediafoundation.org/wiki/Terms_of_Use", + "contact": { + "name": "the Wikimedia Analytics team", + "url": "http://mediawiki.org/wiki/RESTBase" + }, + "license": { + "name": "Apache2", + "url": "http://www.apache.org/licenses/LICENSE-2.0" + } + }, + "x-subspecs": [ + "analytics/v1/pageviews" + ] + } + } + } + }, + { + "paths": { + "/{api:sys}": { + "x-subspec": { + "info": { + "title": "Default MediaWiki sys API module", + "version": "1.0.0" + }, + "paths": { + "/{module:table}": { + "x-modules": [ + { + "name": "restbase-mod-table-cassandra", + "version": "1.0.0", + "type": "npm", + "options": { + "conf": { + "hosts": [ + "aqs1001.eqiad.wmnet", + "aqs1002.eqiad.wmnet", + "aqs1003.eqiad.wmnet" + ], + "keyspace": "system", + "localDc": "eqiad", + "datacenters": [ + "eqiad" + ], + "username": "cassandra", + "password": "cassandra", + "defaultConsistency": "localQuorum", + "storage_groups": [ + { + "name": "default.group.local", + "domains": "/./" + } + ] + } + } + } + ] + } + } + } + } + } + } + ] + } + } + }, + "services": [ + { + "name": "aqs", + "module": "./restbase/lib/server", + "conf": { + "port": 7231, + "spec": { + "title": "The Analytics RESTBase root", + "paths": { + "/{domain:analytics.wikimedia.org}": { + "x-subspecs": [ + { + "paths": { + "/{api:v1}": { + "x-subspec": { + "swagger": "2.0", + "info": { + "version": "1.0.0-beta", + "title": "Wikimedia Analytics REST API", + "description": "This API aims to provide straightforward and low-latency access to Wikimedia Analytics data. It is currently in beta testing, so things aren't completely locked down yet. Each entry point has explicit stability markers to inform you about development status and change policy, according to [our API version policy](https://www.mediawiki.org/wiki/API_versioning).\n### High-volume access\n - As a general rule, don't perform more than 200 requests/s to\n this API.\n - Set a unique `User-Agent` header that allows us to contact you\n quickly. Email addresses or URLs of contact pages work well.\n - Consider using our [HTML\n dumps](https://phabricator.wikimedia.org/T17017) once they\n become available.\n", + "termsOfService": "https://wikimediafoundation.org/wiki/Terms_of_Use", + "contact": { + "name": "the Wikimedia Analytics team", + "url": "http://mediawiki.org/wiki/RESTBase" + }, + "license": { + "name": "Apache2", + "url": "http://www.apache.org/licenses/LICENSE-2.0" + } + }, + "x-subspecs": [ + "analytics/v1/pageviews" + ] + } + } + } + }, + { + "paths": { + "/{api:sys}": { + "x-subspec": { + "info": { + "title": "Default MediaWiki sys API module", + "version": "1.0.0" + }, + "paths": { + "/{module:table}": { + "x-modules": [ + { + "name": "restbase-mod-table-cassandra", + "version": "1.0.0", + "type": "npm", + "options": { + "conf": { + "hosts": [ + "aqs1001.eqiad.wmnet", + "aqs1002.eqiad.wmnet", + "aqs1003.eqiad.wmnet" + ], + "keyspace": "system", + "localDc": "eqiad", + "datacenters": [ + "eqiad" + ], + "username": "cassandra", + "password": "cassandra", + "defaultConsistency": "localQuorum", + "storage_groups": [ + { + "name": "default.group.local", + "domains": "/./" + } + ] + } + } + } + ] + } + } + } + } + } + } + ] + } + } + }, + "salt": "HQrFGO6SZL8zdLw0F5M31VngrEYG9KoTKnVEdHwJ", + "default_page_size": 250 + } + } + ], + "worker_heap_limit_mb": 300, + "logging": { + "name": "aqs", + "level": "warn", + "streams": [ + { + "path": "/tmp/debug.log", + "level": "warn" + } + ] + }, + "metrics": { + "name": "aqs", + "type": "statsd", + "host": "statsd.eqiad.wmnet", + "port": 8125 + }, + "num_workers": 24, + "worker_heartbeat_timeout": 7500, + "package": { + "name": "aqs" + }, + "serviceName": "aqs" +}; +var conf = {foo: undefined} +var yaml = require('js-yaml'); +console.log(yaml.load(yaml.dump(conf))); diff --git a/node_modules/service-runner/test/index.js b/node_modules/service-runner/test/index.js new file mode 100644 index 0000000..eec744d --- /dev/null +++ b/node_modules/service-runner/test/index.js @@ -0,0 +1,4 @@ +"use strict"; + +require('mocha-jshint')(); +require('mocha-jscs')(); diff --git a/node_modules/swagger-router/node_modules/js-yaml/node_modules/argparse/package.json b/node_modules/swagger-router/node_modules/js-yaml/node_modules/argparse/package.json index e49f578..959b779 100644 --- a/node_modules/swagger-router/node_modules/js-yaml/node_modules/argparse/package.json +++ b/node_modules/swagger-router/node_modules/js-yaml/node_modules/argparse/package.json @@ -57,6 +57,5 @@ "tarball": "http://registry.npmjs.org/argparse/-/argparse-1.0.2.tgz" }, "directories": {}, - "_resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.2.tgz", - "readme": "ERROR: No README data found!" + "_resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.2.tgz" } -- To view, visit https://gerrit.wikimedia.org/r/243350 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I8972373cb7164b8d373ddae8bc5e4f9250bc34df Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/services/aqs/deploy Gerrit-Branch: master Gerrit-Owner: Eevans <[email protected]> _______________________________________________ MediaWiki-commits mailing list [email protected] https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
