[MediaWiki-commits] [Gerrit] [BREAKING] Make Citoid use service-template-node and service... - change (mediawiki...citoid)
Mvolz has submitted this change and it was merged. Change subject: [BREAKING] Make Citoid use service-template-node and service-runner .. [BREAKING] Make Citoid use service-template-node and service-runner This patch converts Citoid into a service-template-node-based service, thus easing its development and deployment. Amongst other things, this new basis brings: - unified command-line arguments - unified configuration management; localsettings.js is gone, the configuration is to be managed by altering config.dev.yaml - support for process clustering; this should improve performance and availability, as until now only one process per host has been executed - support for process management (OOM prevents and the like) - support for logging directly to logstash (no more grepping and tailing) - support for metrics reporting, both to a StatsD server, as well as to the logger when run locally during development - support for auto-magic error handling (with or without promises) - code coverage reporting - support for API versioning (yet to be used in Citoid) This patch also structures and adds some more tests. Grunt has been removed in favour of mocha. Note that 'npm test' still reports only jshint results as a compatibility requirement with Jenkins. To run all of the tests locally, use the 'mocha' command instead. Note that, due to the disruptive nature of the patch, the following commands should be run: rm localsettings.js rm -rf node_modules npm install Bug: T75993 Change-Id: I7370c9a91e67c263a291aab4b8ae9014a23efa5f --- M .gitignore M .jshintignore M .jshintrc D Gruntfile.js A app.js A config.dev.yaml A config.yaml M lib/CitoidService.js M lib/Scraper.js M lib/ZoteroService.js M lib/pubMedRequest.js M lib/translators/general.js M lib/translators/openGraph.js M lib/unshorten.js A lib/util.js D localsettings.js.sample M package.json A routes/root.js M server.js A test/features/app/index.js A test/features/errors/index.js A test/features/scraping/index.js A test/features/scraping/lang.js M test/index.js A test/mocha.opts A test/utils/assert.js A test/utils/logStream.js A test/utils/server.js 28 files changed, 1,136 insertions(+), 549 deletions(-) Approvals: Mvolz: Looks good to me, approved diff --git a/.gitignore b/.gitignore index c88c5d5..ea81c00 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,5 @@ *~ .DS_Store *.log - -localsettings.js - node_modules +coverage diff --git a/.jshintignore b/.jshintignore index 79e6ea4..1c69eee 100644 --- a/.jshintignore +++ b/.jshintignore @@ -1,2 +1,3 @@ +coverage node_modules -test \ No newline at end of file +test diff --git a/.jshintrc b/.jshintrc index bae215e..f9c3280 100644 --- a/.jshintrc +++ b/.jshintrc @@ -1,4 +1,10 @@ { + + "predef": [ + "Map", + "Set" + ], + // Enforcing "bitwise": true, "eqeqeq": true, @@ -6,7 +12,6 @@ "noarg": true, "nonew": true, "undef": true, - "unused": true, "curly": true, "newcap": true, @@ -27,11 +32,7 @@ "smarttabs": true, "nomen": false, - // Environment - "globals":{ - "require": true, - "module": true, - "global": true - }, + "node": true, "esnext": true + } diff --git a/Gruntfile.js b/Gruntfile.js deleted file mode 100644 index 7178f57..000 --- a/Gruntfile.js +++ /dev/null @@ -1,39 +0,0 @@ -module.exports = function( grunt ) { - - // These plugins provide necessary tasks. - grunt.loadNpmTasks('grunt-contrib-jshint'); - grunt.loadNpmTasks('grunt-simple-mocha'); - - // Project configuration. - grunt.initConfig({ - // Task configuration. - jshint: { - options: { - jshintrc: true - }, - all: [ - '*.js', - 'localsettings.js.sample', - 'lib/*.js', - 'lib/translators/*.js', - 'test/*.js' - ] - }, - simplemocha: { - options: { - globals: ['describe', 'its'], - timeout: 2, - ignoreLeaks: false, - ui: 'bdd', - reporter: 'tap' - }, - all: { src: ['test/*.js'] } - } - }); - - // Default task. - grunt.registerTask('test', ['jshint:all']); - grunt.registerTask('all', ['jshint:all', 'simplemocha']); - grunt.registerTask('default', 'test'); - -}; diff --git a/app.js b/app.js new file mode 100644 index 000..d636a6b --- /dev/null +++
[MediaWiki-commits] [Gerrit] [BREAKING] Make Citoid use service-template-node and service... - change (mediawiki...citoid)
Mobrovac has uploaded a new change for review. https://gerrit.wikimedia.org/r/199250 Change subject: [BREAKING] Make Citoid use service-template-node and service-runner .. [BREAKING] Make Citoid use service-template-node and service-runner This patch converts Citoid into a service-template-node-based service, thus easing its development and deployment. Amongst other things, this new basis brings: - unified command-line arguments - unified configuration management; localsettings.js is gone, the configuration is to be managed by altering config.dev.yaml - support for process clustering; this should improve performance and availability, as until now only one process per host has been executed - support for process management (OOM prevents and the like) - support for logging directly to logstash (no more grepping and tailing) - support for metrics reporting, both to a StatsD server, as well as to the logger when run locally during development - support for auto-magic error handling (with or without promises) - code coverage reporting - support for API versioning (yet to be used in Citoid) This patch also structures and adds some more tests. Grunt has been removed in favour of mocha. Note that 'npm test' still reports only jshint results as a compatibility requirement with Jenkins. To run all of the tests locally, use the 'mocha' command instead. Note that, due to the disruptive nature of the patch, the following commands should be run: rm localsettings.js rm -rf node_modules npm install Bug: T75993 Change-Id: I7370c9a91e67c263a291aab4b8ae9014a23efa5f --- M .gitignore M .jshintignore M .jshintrc D Gruntfile.js A app.js A config.dev.yaml A config.yaml M lib/CitoidService.js M lib/Scraper.js M lib/ZoteroService.js M lib/pubMedRequest.js M lib/translators/general.js M lib/translators/openGraph.js M lib/unshorten.js A lib/util.js D localsettings.js.sample M package.json A routes/root.js M server.js A test/features/app/index.js A test/features/errors/index.js A test/features/scraping/index.js A test/features/scraping/lang.js M test/index.js A test/mocha.opts A test/utils/assert.js A test/utils/logStream.js A test/utils/server.js 28 files changed, 1,154 insertions(+), 543 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/services/citoid refs/changes/50/199250/1 diff --git a/.gitignore b/.gitignore index c88c5d5..ea81c00 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,5 @@ *~ .DS_Store *.log - -localsettings.js - node_modules +coverage diff --git a/.jshintignore b/.jshintignore index 79e6ea4..1c69eee 100644 --- a/.jshintignore +++ b/.jshintignore @@ -1,2 +1,3 @@ +coverage node_modules -test \ No newline at end of file +test diff --git a/.jshintrc b/.jshintrc index bae215e..6e8ef79 100644 --- a/.jshintrc +++ b/.jshintrc @@ -1,4 +1,10 @@ { + + "predef": [ + "Map", + "Set" + ], + // Enforcing "bitwise": true, "eqeqeq": true, @@ -6,7 +12,6 @@ "noarg": true, "nonew": true, "undef": true, - "unused": true, "curly": true, "newcap": true, @@ -33,5 +38,7 @@ "module": true, "global": true }, + "node": true, "esnext": true + } diff --git a/Gruntfile.js b/Gruntfile.js deleted file mode 100644 index 7178f57..000 --- a/Gruntfile.js +++ /dev/null @@ -1,39 +0,0 @@ -module.exports = function( grunt ) { - - // These plugins provide necessary tasks. - grunt.loadNpmTasks('grunt-contrib-jshint'); - grunt.loadNpmTasks('grunt-simple-mocha'); - - // Project configuration. - grunt.initConfig({ - // Task configuration. - jshint: { - options: { - jshintrc: true - }, - all: [ - '*.js', - 'localsettings.js.sample', - 'lib/*.js', - 'lib/translators/*.js', - 'test/*.js' - ] - }, - simplemocha: { - options: { - globals: ['describe', 'its'], - timeout: 2, - ignoreLeaks: false, - ui: 'bdd', - reporter: 'tap' - }, - all: { src: ['test/*.js'] } - } - }); - - // Default task. - grunt.registerTask('test', ['jshint:all']); - grunt.registerTask('all', ['jshint:all', 'simplemocha']); - grunt.registerTask('default', 'test'); - -}; diff --git a/app.js b/app.js new file mode 100644 index 000..d636a6b --- /dev/null +++ b/app.js @@ -0,0 +1,148 @@ +'use strict'; + +