jenkins-bot has submitted this change and it was merged. Change subject: Deb 0.6.0: Add config.yaml, remove settings.js, update postinst script ......................................................................
Deb 0.6.0: Add config.yaml, remove settings.js, update postinst script * As of 0.6.0, we are using service-runner which uses config.yaml. * Added a sample config.yaml file that has the same defaults as the erstwhile settings.js file. * Removed settings.js file. * Updated the parsoid.postinst script to update config.yaml to point to a previously existing settings.js file, if the file is present at the place previous deb pkgs might have installed it. Change-Id: I61f67671ae8469bc02c125b71ca81493bcb4f213 --- A debian/config.yaml M debian/parsoid.default M debian/parsoid.install M debian/parsoid.postinst D debian/settings.js 5 files changed, 104 insertions(+), 107 deletions(-) Approvals: Arlolra: Looks good to me, approved jenkins-bot: Verified diff --git a/debian/config.yaml b/debian/config.yaml new file mode 100644 index 0000000..a8d64d2 --- /dev/null +++ b/debian/config.yaml @@ -0,0 +1,94 @@ +# This is a sample configuration file +# +# Also see: +# - `npm start -- -h` for more information about passing config files via +# the commandline. +# - lib/config/ParsoidConfig.js for all the properties that you can configure +# here. Not all properties are documented here. + +worker_heartbeat_timeout: 300000 + +logging: + level: info + +#metrics: +# type: log + +services: + - module: ../src/lib/index.js + entrypoint: apiServiceWorker + conf: + # For backwards compatibility, and to continue to support non-static + # configs for the time being, optionally provide a path to a + # localsettings.js file. See localsettings.example.js + #localsettings: ./localsettings.js + + # Set your own user-agent string + # Otherwise, defaults to: + # 'Parsoid/<current-version-defined-in-package.json>' + #userAgent: 'My-User-Agent-String' + + # Configure Parsoid to point to your MediaWiki instances. + mwApis: + - # This is the only required parameter, + # the URL of you MediaWiki API endpoint. + uri: 'http://localhost/w/api.php' + # The "domain" is used for communication with Visual Editor + # and RESTBase. It defaults to the hostname portion of + # the `uri` property below, but you can manually set it + # to an arbitrary string. + domain: 'localhost' # optional + # To specify a proxy (or proxy headers) specific to this prefix + # (which overrides defaultAPIProxyURI). Alternatively, set `proxy` + # to `null` to override and force no proxying when a default proxy + # has been set. + #proxy: + # uri: 'http://my.proxy:1234/' + # headers: # optional + # 'X-Forwarded-Proto': 'https' + + # We pre-define wikipedias as 'enwiki', 'dewiki' etc. Similarly + # for other projects: 'enwiktionary', 'enwikiquote', 'enwikibooks', + # 'enwikivoyage' etc. + # The default for this is false. Uncomment the line below if you want + # to load WMF's config for wikipedias, etc. + #loadWMF: true + + # A default proxy to connect to the API endpoints. + # Default: undefined (no proxying). + # Overridden by per-wiki proxy config in setMwApi. + #defaultAPIProxyURI: 'http://proxy.example.org:8080' + + # Enable debug mode (prints extra debugging messages) + #debug: true + + # Use the PHP preprocessor to expand templates via the MW API (default true) + #usePHPPreProcessor: false + + # Use selective serialization (default false) + #useSelser: true + + # Allow cross-domain requests to the API (default '*') + # Sets Access-Control-Allow-Origin header + # disable: + #allowCORS: false + # restrict: + #allowCORS: 'some.domain.org' + + # Allow override of port/interface: + #serverPort: 8000 + #serverInterface: '127.0.0.1' + + # Enable linting of some wikitext errors to the log + #linting: true + # Send lint errors to MW API instead of to the log + #linterSendAPI: false + + # Require SSL certificates to be valid (default true) + # Set to false when using self-signed SSL certificates + #strictSSL: false + + # Use a different server for CSS style modules. + # Leaving it undefined (the default) will use the same URI as the MW API, + # changing api.php for load.php. + #modulesLoadURI: 'http://example.org/load.php' diff --git a/debian/parsoid.default b/debian/parsoid.default index a52649d..cae6ac4 100644 --- a/debian/parsoid.default +++ b/debian/parsoid.default @@ -3,7 +3,7 @@ # File where the parsoid daemon will write stderr and stdout to PARSOID_LOG_FILE=/var/log/parsoid/parsoid.log -PARSOID_SETTINGS_FILE=/etc/mediawiki/parsoid/settings.js +PARSOID_SETTINGS_FILE=/etc/mediawiki/parsoid/config.yaml PORT="8142" diff --git a/debian/parsoid.install b/debian/parsoid.install index c8c23d5..ef44b98 100644 --- a/debian/parsoid.install +++ b/debian/parsoid.install @@ -1,5 +1,5 @@ # config for the server -debian/settings.js /etc/mediawiki/parsoid/ +debian/config.yaml /etc/mediawiki/parsoid/ # main source src/ usr/lib/parsoid/ diff --git a/debian/parsoid.postinst b/debian/parsoid.postinst index 30ea500..caf7875 100644 --- a/debian/parsoid.postinst +++ b/debian/parsoid.postinst @@ -57,4 +57,12 @@ #DEBHELPER# +# If there is a Parsoid localsettings.js file +# from a previous install, update the config.yaml file +# to point to it +if [ -e /etc/mediawiki/parsoid/settings.js ]; then + sed 's/#\s*localsettings:.*$/localsettings: \/etc\/mediawiki\/parsoid\/settings.js/g; s/mwApis:/#mwApis:/g; s/\(- # This is the only required parameter\)/#\1/g; s/^\(\s*\)uri:/\1#uri:/g; s/^\(\s*\)domain:/\1#domain:/g;' < /etc/mediawiki/parsoid/config.yaml > /etc/mediawiki/parsoid/config.yaml.new + mv /etc/mediawiki/parsoid/config.yaml.new /etc/mediawiki/parsoid/config.yaml +fi + exit 0 diff --git a/debian/settings.js b/debian/settings.js deleted file mode 100644 index a6f4543..0000000 --- a/debian/settings.js +++ /dev/null @@ -1,105 +0,0 @@ -/* - * This is a sample configuration file. - * - * Copy this file to localsettings.js and edit that file to fit your needs. - * - * Also see: - * - bin/server.js for more information about passing config files via - * the commandline. - * - lib/config/ParsoidConfig.js all the properties - * that you can configure here. Not all properties are - * documented here. - */ -'use strict'; - -exports.setup = function(parsoidConfig) { - // Set your own user-agent string - // Otherwise, defaults to "Parsoid/<current-version-defined-in-package.json>" - //parsoidConfig.userAgent = "My-User-Agent-String"; - - // The URL of your MediaWiki API endpoint. - parsoidConfig.setMwApi({ prefix: 'localhost', uri: 'http://localhost/w/api.php' }); - // To specify a proxy (or proxy headers) specific to this prefix (which - // overrides defaultAPIProxyURI) use: - /* - parsoidConfig.setMwApi({ - prefix: 'localhost', - uri: 'http://localhost/w/api.php', - // set `proxy` to `null` to override and force no proxying. - proxy: { - uri: 'http://my.proxy:1234/', - headers: { 'X-Forwarded-Proto': 'https' } // headers are optional - } - }); - */ - - // We pre-define wikipedias as 'enwiki', 'dewiki' etc. Similarly - // for other projects: 'enwiktionary', 'enwikiquote', 'enwikibooks', - // 'enwikivoyage' etc. (default true) - //parsoidConfig.loadWMF = false; - - // A default proxy to connect to the API endpoints. - // Default: undefined (no proxying). - // Overridden by per-wiki proxy config in setMwApi. - //parsoidConfig.defaultAPIProxyURI = 'http://proxy.example.org:8080'; - - // Enable debug mode (prints extra debugging messages) - //parsoidConfig.debug = true; - - // Use the PHP preprocessor to expand templates via the MW API (default true) - //parsoidConfig.usePHPPreProcessor = false; - - // Use selective serialization (default false) - parsoidConfig.useSelser = true; - - // Allow cross-domain requests to the API (default '*') - // Sets Access-Control-Allow-Origin header - // disable: - //parsoidConfig.allowCORS = false; - // restrict: - //parsoidConfig.allowCORS = 'some.domain.org'; - - // Set to true for using the default performance metrics reporting to statsd - // If true, provide the statsd host/port values - /* - parsoidConfig.useDefaultPerformanceTimer = true; - parsoidConfig.txstatsdHost = 'statsd.domain.org'; - parsoidConfig.txstatsdPort = 8125; - */ - - // Alternatively, define performanceTimer as follows: - /* - parsoidConfig.performanceTimer = { - timing: function(metricName, time) { }, // do-something-with-it - count: function(metricName, value) { }, // do-something-with-it - }; - */ - - // How often should we emit a heap sample? Time in ms. - // This setting is only relevant if you have enabled - // performance monitoring either via the default metrics - // OR by defining your own performanceTimer properties - //parsoidConfig.heapUsageSampleInterval = 5 * 60 * 1000; - - // Allow override of port/interface: - //parsoidConfig.serverPort = 8000; - //parsoidConfig.serverInterface = '127.0.0.1'; - - // The URL of your LintBridge API endpoint - //parsoidConfig.linterAPI = 'http://lintbridge.wmflabs.org/add'; - - // Require SSL certificates to be valid (default true) - // Set to false when using self-signed SSL certificates - //parsoidConfig.strictSSL = false; - - // Use a different server for CSS style modules. - // Set to true to use bits.wikimedia.org, or to a string with the URI. - // Leaving it undefined (the default) will use the same URI as the MW API, - // changing api.php for load.php. - //parsoidConfig.modulesLoadURI = true; - - // Suppress some warnings from the Mediawiki API - // (defaults to suppressing warnings which the Parsoid team knows to - // be harmless) - //parsoidConfig.suppressMwApiWarnings = /annoying warning|other warning/; -}; -- To view, visit https://gerrit.wikimedia.org/r/320462 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I61f67671ae8469bc02c125b71ca81493bcb4f213 Gerrit-PatchSet: 4 Gerrit-Project: mediawiki/services/parsoid/deploy Gerrit-Branch: master Gerrit-Owner: Subramanya Sastry <[email protected]> Gerrit-Reviewer: Arlolra <[email protected]> Gerrit-Reviewer: Legoktm <[email protected]> Gerrit-Reviewer: Subramanya Sastry <[email protected]> Gerrit-Reviewer: Tim Starling <[email protected]> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list [email protected] https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
