Mobrovac has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/357640 )

Change subject: Add scap configuration
......................................................................


Add scap configuration

Bug: T148128
Change-Id: I9bb4e7cf0460aabe1ce111d31d76f2314b2282aa
---
A scap/betacluster
A scap/checks.yaml
A scap/config-files.yaml
A scap/recommendation-api
A scap/recommendation-api-canary
A scap/scap.cfg
A scap/templates/config.yaml.j2
A scap/vars.yaml
8 files changed, 199 insertions(+), 0 deletions(-)

Approvals:
  Mobrovac: Verified; Looks good to me, approved



diff --git a/scap/betacluster b/scap/betacluster
new file mode 100644
index 0000000..f62e6b6
--- /dev/null
+++ b/scap/betacluster
@@ -0,0 +1,3 @@
+deployment-sca01.deployment-prep.eqiad.wmflabs
+deployment-sca02.deployment-prep.eqiad.wmflabs
+
diff --git a/scap/checks.yaml b/scap/checks.yaml
new file mode 100644
index 0000000..beb30f0
--- /dev/null
+++ b/scap/checks.yaml
@@ -0,0 +1,14 @@
+checks:
+  endpoints:
+    type: nrpe
+    stage: restart_service
+    command: check_endpoints_recomendation_api
+  depool:
+    type: command
+    stage: promote
+    command: depool-recomendation_api
+  repool:
+    type: command
+    stage: restart_service
+    command: pool-recomendation_api
+
diff --git a/scap/config-files.yaml b/scap/config-files.yaml
new file mode 100644
index 0000000..a1c742c
--- /dev/null
+++ b/scap/config-files.yaml
@@ -0,0 +1,6 @@
+---
+/etc/recommendation_api/config.yaml:
+  template: config.yaml.j2
+  erb_syntax: True
+  remote_vars: /etc/recommendation_api/config-vars.yaml
+
diff --git a/scap/recommendation-api b/scap/recommendation-api
new file mode 100644
index 0000000..fb6ab10
--- /dev/null
+++ b/scap/recommendation-api
@@ -0,0 +1,10 @@
+scb1001.eqiad.wmnet
+scb1002.eqiad.wmnet
+scb1003.eqiad.wmnet
+scb1004.eqiad.wmnet
+scb2002.codfw.wmnet
+scb2003.codfw.wmnet
+scb2004.codfw.wmnet
+scb2005.codfw.wmnet
+scb2006.codfw.wmnet
+
diff --git a/scap/recommendation-api-canary b/scap/recommendation-api-canary
new file mode 100644
index 0000000..8d1e9a8
--- /dev/null
+++ b/scap/recommendation-api-canary
@@ -0,0 +1,2 @@
+scb2001.codfw.wmnet
+
diff --git a/scap/scap.cfg b/scap/scap.cfg
new file mode 100644
index 0000000..21a994a
--- /dev/null
+++ b/scap/scap.cfg
@@ -0,0 +1,19 @@
+[global]
+git_repo: recommendation-api/deploy
+git_deploy_dir: /srv/deployment
+git_repo_user: deploy-service
+ssh_user: deploy-service
+server_groups: canary, default
+canary_dsh_targets: recommendation-api-canary
+dsh_targets: recommendation-api
+group_size: 2
+git_submodules: True
+service_name: recommendation_api
+service_port: 9632
+lock_file: /tmp/scap.recommendation-api.lock
+config_deploy: True
+
+[deployment-prep.eqiad.wmflabs]
+environment: beta
+server_groups: default
+dsh_targets: betacluster
diff --git a/scap/templates/config.yaml.j2 b/scap/templates/config.yaml.j2
new file mode 100644
index 0000000..3dfcfc4
--- /dev/null
+++ b/scap/templates/config.yaml.j2
@@ -0,0 +1,124 @@
+# Number of worker processes to spawn.
+# Set to 0 to run everything in a single process without clustering.
+# Use 'ncpu' to run as many workers as there are CPU units
+num_workers: <%= num_workers %>
+
+# Log error messages and gracefully restart a worker if v8 reports that it
+# uses more heap (note: not RSS) than this many mb.
+worker_heap_limit_mb: <%= worker_heap_limit_mb %>
+
+# The maximum interval in ms that can pass between two beat messages
+# sent by each worker to the master before it is killed
+worker_heartbeat_timeout: <%= worker_heartbeat_timeout %>
+
+# Logger info
+logging:
+  level: warn
+  name: <%= log_name %>
+  streams:
+    - host: <%= logstash_host %>
+      port: <%= logstash_port %>
+      type: gelf
+    - level: info
+      path: <%= log_file %>
+      type: file
+
+# Statsd metrics reporter
+metrics:
+  name: <%= metrics_name %>
+  host: <%= metrics_host %>
+  port: <%= metrics_port %>
+  type: statsd
+
+services:
+  - name: <%= name %>
+    # a relative path or the name of an npm package, if different from name
+    module: ./src/app.js
+    # per-service config
+    conf:
+      port: <%= port %>
+      # interface: localhost # uncomment to only listen on localhost
+      # more per-service config settings
+      # the location of the spec, defaults to spec.yaml if not specified
+      # spec: ./spec.template.yaml
+      # allow cross-domain requests to the API (default '*')
+      cors: '*'
+      # to disable use:
+      # cors: false
+      # to restrict to a particular domain, use:
+      # cors: restricted.domain.org
+      # content for the CSP headers
+      # csp: false  # uncomment this line to disable sending them
+      # URL of the outbound proxy to use (complete with protocol)
+      proxy: <%= proxy if proxy else '' %>
+      # the list of domains for which not to use the proxy defined above
+      # no_proxy_list:
+      #   - domain1.com
+      #   - domain2.org
+      # the list of incoming request headers that can be logged; if left empty,
+      # the following headers are allowed: cache-control, content-length,
+      # content-type, if-match, user-agent, x-request-id
+      # log_header_whitelist:
+      #   - cache-control
+      #   - content-length
+      #   - content-type
+      #   - if-match
+      #   - user-agent
+      #   - x-request-id
+      # User-Agent HTTP header to use for requests
+      user_agent: "Recommendation API (Wikimedia tool; learn more at 
https://meta.wikimedia.org/wiki/Recommendation_API)"
+      mwapi_req:
+        method: post
+        uri: <%= mwapi_uri %>
+        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: <%= restbase_uri %>
+        query: '{{ default(request.query, {}) }}'
+        headers: '{{request.headers}}'
+        body: '{{request.body}}'
+      wdqsapi_req:
+        method: 'post'
+        uri: <%= wdqs_uri %>
+        headers:
+          user-agent: '{{user-agent}}'
+        body:
+          format: 'json'
+          query: '{{request.query}}'
+      queries:
+        pageviews:
+          domain: '{{params.source}}.wikipedia.org'
+          parameters:
+            format: json
+            action: query
+            prop: pageprops
+            ppprop: wikibase_item
+            generator: mostviewed
+            gpvimlimit: 500
+        seed:
+          domain: '{{params.source}}.wikipedia.org'
+          parameters:
+            format: json
+            action: query
+            prop: pageprops
+            ppprop: wikibase_item
+            generator: search
+            gsrlimit: 500
+            gsrsearch: morelike:{{params.seed}}
+            gsrprop: ''
+        article:
+          domain: '{{params.source}}.wikipedia.org'
+          parameters:
+            format: json
+            action: query
+            prop: pageprops
+            ppprop: wikibase_item
+            generator: search
+            gsrlimit: 1
+            gsrsearch: '{{params.seed}}'
+            gsrprop: ''
+
diff --git a/scap/vars.yaml b/scap/vars.yaml
new file mode 100644
index 0000000..ddf554a
--- /dev/null
+++ b/scap/vars.yaml
@@ -0,0 +1,21 @@
+# general
+num_workers: 0
+worker_heap_limit_mb: 250
+worker_heartbeat_timeout: 7500
+# log-related variables
+log_name: recommendation_api
+logstash_host: localhost
+logstash_port: 12201
+log_file: /tmp/recommendation_api.log
+# metrics
+metrics_name: recommendation_api
+metrics_host: localhost
+metrics_port: 8125
+# service
+name: recommendation_api
+port: 9632
+proxy:
+mwapi_uri:
+restbase_uri:
+wdqs_uri:
+

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I9bb4e7cf0460aabe1ce111d31d76f2314b2282aa
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/services/recommendation-api/deploy
Gerrit-Branch: master
Gerrit-Owner: Nschaaf <nsch...@wikimedia.org>
Gerrit-Reviewer: Mobrovac <mobro...@wikimedia.org>
Gerrit-Reviewer: Nschaaf <nsch...@wikimedia.org>

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

Reply via email to