[MediaWiki-commits] [Gerrit] service::node: Provide MW API and RESTBase request templates - change (operations/puppet)

2016-05-31 Thread Alexandros Kosiaris (Code Review)
Alexandros Kosiaris has submitted this change and it was merged.

Change subject: service::node: Provide MW API and RESTBase request templates
..


service::node: Provide MW API and RESTBase request templates

As of v0.3.2, service-template-node provides a unified way of accessing
the MW and RESTBase APIs to services based on it. This patch brings the
production-configuration part in the mix to assure requests are directed
to the proper entity.

The important implication here is that once all of the needed services
update to service-template-node v0.3.2, there will be only one place
where we define how and where to contact MW and RESTBase; individual
services will no longer need to declare them separately.

Change-Id: I76e39f2caebbb90f4f7082a865e9ab6e33db9e4f
---
M hieradata/labs/deployment-prep/common.yaml
M modules/service/manifests/configuration.pp
M modules/service/templates/node/config.yaml.erb
3 files changed, 29 insertions(+), 0 deletions(-)

Approvals:
  Mobrovac: Looks good to me, but someone else must approve
  Alexandros Kosiaris: Verified; Looks good to me, approved



diff --git a/hieradata/labs/deployment-prep/common.yaml 
b/hieradata/labs/deployment-prep/common.yaml
index ba85571..f160014 100644
--- a/hieradata/labs/deployment-prep/common.yaml
+++ b/hieradata/labs/deployment-prep/common.yaml
@@ -9,6 +9,8 @@
 has_lvs: false
 "puppetmaster::scripts::keep_reports_minutes": 360
 puppetmaster::autosigner: true
+service::configuration::mwapi_uri: 
http://deployment-mediawiki02.deployment-prep.eqiad.wmflabs/w/api.php
+service::configuration::restbase_uri: 
http://deployment-restbase02.deployment-prep.eqiad.wmflabs:7231
 #service::configuration::http_proxy:
 service::configuration::statsd_host: labmon1001.eqiad.wmnet
 service::configuration::logstash_host: 
deployment-logstash2.deployment-prep.eqiad.wmflabs
diff --git a/modules/service/manifests/configuration.pp 
b/modules/service/manifests/configuration.pp
index 59afc90..c10c056 100644
--- a/modules/service/manifests/configuration.pp
+++ b/modules/service/manifests/configuration.pp
@@ -4,6 +4,14 @@
 #
 # === Parameters
 #
+# [*mwapi_uri*]
+#   The host/IP where to reach the MW API. Default:
+#   http://api.svc.${::mw_primary}.wmnet/w/api.php
+#
+# [*restbase_uri*]
+#   The host/IP where to reach RESTBase. Default:
+#   http://restbase.svc.${::rb_site}.wmnet:7231
+#
 # [*http_proxy*]
 #   Full URL of the proxy to use
 #
@@ -28,6 +36,8 @@
 #   Default: false
 #
 class service::configuration(
+$mwapi_uri = "http://api.svc.${::mw_primary}.wmnet/w/api.php;,
+$restbase_uri  = "http://restbase.svc.${::rb_site}.wmnet:7231;,
 $http_proxy= undef,
 $statsd_host   = 'localhost',
 $statsd_port   = 8125,
diff --git a/modules/service/templates/node/config.yaml.erb 
b/modules/service/templates/node/config.yaml.erb
index ad09c37..178bc78 100644
--- a/modules/service/templates/node/config.yaml.erb
+++ b/modules/service/templates/node/config.yaml.erb
@@ -1,5 +1,7 @@
 <%
 cvars = {
+  'mwapi' => scope.lookupvar('service::configuration::mwapi_uri'),
+  'restbase'  => scope.lookupvar('service::configuration::restbase_uri'),
   'gelf_host' => scope.lookupvar('service::configuration::logstash_host'),
   'gelf_port' => scope.lookupvar('service::configuration::logstash_port'),
   'stat_host' => scope.lookupvar('service::configuration::statsd_host'),
@@ -62,3 +64,18 @@
   # cors: restricted.domain.org
   # URL of the outbound proxy to use (complete with protocol)
   proxy: <%= cvars['proxy'] %>
+  # the template used for contacting the MW API
+  mwapi_req:
+method: post
+uri: <%= cvars['mwapi'] %>
+headers:
+  host: '{{request.params.domain}}'
+  user-agent: '{{user-agent}}'
+body: '{{ default(request.query, {}) }}'
+  # the template used for contacting RESTBase
+  restbase_req:
+method: '{{request.method}}'
+uri: <%= cvars['restbase'] %>/{{domain}}/v1/{+path}
+query: '{{ default(request.query, {}) }}'
+headers: '{{request.headers}}'
+body: '{{request.body}}'

-- 
To view, visit https://gerrit.wikimedia.org/r/291857
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I76e39f2caebbb90f4f7082a865e9ab6e33db9e4f
Gerrit-PatchSet: 2
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Mobrovac 
Gerrit-Reviewer: Alexandros Kosiaris 
Gerrit-Reviewer: Giuseppe Lavagetto 
Gerrit-Reviewer: Mobrovac 
Gerrit-Reviewer: jenkins-bot <>

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] service::node: Provide MW API and RESTBase request templates - change (operations/puppet)

2016-05-30 Thread Mobrovac (Code Review)
Mobrovac has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/291857

Change subject: service::node: Provide MW API and RESTBase request templates
..

service::node: Provide MW API and RESTBase request templates

As of v0.3.2, service-template-node provides a unified way of accessing
the MW and RESTBase APIs to services based on it. This patch brings the
production-configuration part in the mix to assure requests are directed
to the proper entity.

The important implication here is that once all of the needed services
update to service-template-node v0.3.2, there will be only one place
where we define how and where to contact MW and RESTBase; individual
services will no longer need to declare them separately.

Change-Id: I76e39f2caebbb90f4f7082a865e9ab6e33db9e4f
---
M hieradata/labs/deployment-prep/common.yaml
M modules/service/manifests/configuration.pp
M modules/service/templates/node/config.yaml.erb
3 files changed, 29 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/operations/puppet 
refs/changes/57/291857/1

diff --git a/hieradata/labs/deployment-prep/common.yaml 
b/hieradata/labs/deployment-prep/common.yaml
index ba85571..f160014 100644
--- a/hieradata/labs/deployment-prep/common.yaml
+++ b/hieradata/labs/deployment-prep/common.yaml
@@ -9,6 +9,8 @@
 has_lvs: false
 "puppetmaster::scripts::keep_reports_minutes": 360
 puppetmaster::autosigner: true
+service::configuration::mwapi_uri: 
http://deployment-mediawiki02.deployment-prep.eqiad.wmflabs/w/api.php
+service::configuration::restbase_uri: 
http://deployment-restbase02.deployment-prep.eqiad.wmflabs:7231
 #service::configuration::http_proxy:
 service::configuration::statsd_host: labmon1001.eqiad.wmnet
 service::configuration::logstash_host: 
deployment-logstash2.deployment-prep.eqiad.wmflabs
diff --git a/modules/service/manifests/configuration.pp 
b/modules/service/manifests/configuration.pp
index 59afc90..c10c056 100644
--- a/modules/service/manifests/configuration.pp
+++ b/modules/service/manifests/configuration.pp
@@ -4,6 +4,14 @@
 #
 # === Parameters
 #
+# [*mwapi_uri*]
+#   The host/IP where to reach the MW API. Default:
+#   http://api.svc.${::mw_primary}.wmnet/w/api.php
+#
+# [*restbase_uri*]
+#   The host/IP where to reach RESTBase. Default:
+#   http://restbase.svc.${::rb_site}.wmnet:7231
+#
 # [*http_proxy*]
 #   Full URL of the proxy to use
 #
@@ -28,6 +36,8 @@
 #   Default: false
 #
 class service::configuration(
+$mwapi_uri = "http://api.svc.${::mw_primary}.wmnet/w/api.php;,
+$restbase_uri  = "http://restbase.svc.${::rb_site}.wmnet:7231;,
 $http_proxy= undef,
 $statsd_host   = 'localhost',
 $statsd_port   = 8125,
diff --git a/modules/service/templates/node/config.yaml.erb 
b/modules/service/templates/node/config.yaml.erb
index ad09c37..178bc78 100644
--- a/modules/service/templates/node/config.yaml.erb
+++ b/modules/service/templates/node/config.yaml.erb
@@ -1,5 +1,7 @@
 <%
 cvars = {
+  'mwapi' => scope.lookupvar('service::configuration::mwapi_uri'),
+  'restbase'  => scope.lookupvar('service::configuration::restbase_uri'),
   'gelf_host' => scope.lookupvar('service::configuration::logstash_host'),
   'gelf_port' => scope.lookupvar('service::configuration::logstash_port'),
   'stat_host' => scope.lookupvar('service::configuration::statsd_host'),
@@ -62,3 +64,18 @@
   # cors: restricted.domain.org
   # URL of the outbound proxy to use (complete with protocol)
   proxy: <%= cvars['proxy'] %>
+  # the template used for contacting the MW API
+  mwapi_req:
+method: post
+uri: <%= cvars['mwapi'] %>
+headers:
+  host: '{{request.params.domain}}'
+  user-agent: '{{user-agent}}'
+body: '{{ default(request.query, {}) }}'
+  # the template used for contacting RESTBase
+  restbase_req:
+method: '{{request.method}}'
+uri: <%= cvars['restbase'] %>/{{domain}}/v1/{+path}
+query: '{{ default(request.query, {}) }}'
+headers: '{{request.headers}}'
+body: '{{request.body}}'

-- 
To view, visit https://gerrit.wikimedia.org/r/291857
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I76e39f2caebbb90f4f7082a865e9ab6e33db9e4f
Gerrit-PatchSet: 1
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Mobrovac 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits