Mobrovac has uploaded a new change for review.

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

Change subject: service::gitupdate: Remove node_modules/ before installing the 
new ones
......................................................................

service::gitupdate: Remove node_modules/ before installing the new ones

Most of our Node.JS services use the '^x.x.x' format for specifying the
dependencies' versions to use. When `npm install` is run, it doesn't
check for newer versions if the currently-installed module satisfies the
version. Hence, we need to force npm to install the new versions by
removing the old module dependencies first.

Also, update the RESTBase configuration to the current master state.

Change-Id: Ie4769e123850d4ff4da24a22834b2c5d3d03586f
---
M puppet/modules/restbase/templates/config.yaml.erb
M puppet/modules/service/manifests/gitupdate.pp
2 files changed, 41 insertions(+), 131 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/vagrant 
refs/changes/27/254827/1

diff --git a/puppet/modules/restbase/templates/config.yaml.erb 
b/puppet/modules/restbase/templates/config.yaml.erb
index 90b01a5..97730c7 100644
--- a/puppet/modules/restbase/templates/config.yaml.erb
+++ b/puppet/modules/restbase/templates/config.yaml.erb
@@ -31,12 +31,7 @@
       license:
         name: Apache2
         url: http://www.apache.org/licenses/LICENSE-2.0
-    x-subspecs:
-      - mediawiki/v1/content
-      - mediawiki/v1/graphoid
-      - mediawiki/v1/mobileapps
-      - media/v1/mathoid
-    # - mediawiki/v1/revision-scoring
+
     securityDefinitions: &wp/content-security/1.0.0
       mediawiki_auth:
         description: Checks permissions using MW api
@@ -54,6 +49,31 @@
         x-whitelists:
           internal:
             - /^(?:::ffff:)?(?:10|127)\./
+
+    x-modules:
+      - name: mobileapps-public
+        path: specs/mediawiki/v1/mobileapps
+        type: spec
+        options:
+          host: http://appservice.wmflabs.org
+
+      - path: wikimedia/v1/graphoid_v1.yaml
+        options:
+          host: http://localhost:<%= @graphoid_port %>
+
+      - path: wikimedia/v1/summary_v1.js
+        options:
+          # One hour, for now.
+          response_cache-control: 'max-age: 3600, s-maxage: 3600'
+
+      - name: mathoid
+        path: specs/media/v1/mathoid
+        type: spec
+        options:
+          host: http://localhost:<%= @mathoid_port %>
+
+    x-subspecs:
+      - mediawiki/v1/content
 
   wmf-sys-1.0.0: &wp/sys/1.0.0
     info:
@@ -100,7 +120,7 @@
         x-modules:
           - name: action
             type: file
-            options:
+            templates:
               apiRequest:
                 method: post
                 uri: 'http://localhost<%= scope['::port_fragment'] 
%>/w/api.php'
@@ -121,56 +141,27 @@
             options:
               parsoidHost: http://localhost:<%= 
scope['::mediawiki::parsoid::port'] %>
 
-      /{module:graphoid}/v1/png/{title}/{revision}/{graph_id}:
-        get:
-          x-request-handler:
-            - get_from_graphoid:
-                request:
-                  uri: http://localhost:<%= @graphoid_port 
%>/{domain}/v1/png/{title}/{revision}/{graph_id}
-
       /{module:mobileapps}:
         x-subspec:
-          info:
-            title: Mobileapps sys API module
           paths:
-            /html/{title}:
-              get:
-                x-request-handler:
-                  - get_from_backend:
-                      request:
-                        uri: 
http://appservice.wmflabs.org/{domain}/v1/page/mobile-html/{title}
-            /sections/{title}:
-              get:
-                x-request-handler:
-                  - get_from_backend:
-                      request:
-                        uri: 
http://appservice.wmflabs.org/{domain}/v1/page/mobile-html-sections/{title}
-            /sections-lead/{title}:
-              get:
-                x-request-handler:
-                  - get_from_backend:
-                      request:
-                        uri: 
http://appservice.wmflabs.org/{domain}/v1/page/mobile-html-sections-lead/{title}
-            /sections-remaining/{title}:
-              get:
-                x-request-handler:
-                  - get_from_backend:
-                      request:
-                        uri: 
http://appservice.wmflabs.org/{domain}/v1/page/mobile-html-sections-remaining/{title}
-            /text/{title}:
-              get:
-                x-request-handler:
-                  - get_from_backend:
-                      request:
-                        uri: 
http://appservice.wmflabs.org/{domain}/v1/page/mobile-text/{title}
-
+            /v1:
+              x-modules:
+                - name: mobileapps-sys
+                  path: mods/wikimedia/v1/mobileapps
+                  type: spec
+                  options:
+                    host: http://appservice.wmflabs.org
 
   global-content: &gb/content/1.0.0
     swagger: '2.0'
     info: *wp/content-info/1.0.0
     securityDefinitions: *wp/content-security/1.0.0
-    x-subspecs:
-      - media/v1/mathoid
+    x-modules:
+      - name: mathoid
+        path: specs/media/v1/mathoid
+        type: spec
+        options:
+          host: http://localhost:<%= @mathoid_port %>/complete
 
 
   global-sys: &gb/sys/1.0.0
@@ -181,87 +172,6 @@
       /{module:table}: *wp/sys/table
       /{module:key_value}: *wp/sys/key_value
       /{module:post_data}: *wp/sys/post_data
-      /{module:mathoid}/v1/request/{format}:
-        post:
-          x-request-handler:
-            - store:
-                request:
-                  method: put
-                  uri: /{domain}/sys/post_data/mathoid.request/
-                  body:
-                    q: '{$.request.body.q}'
-                    type: '{$$.default($.request.body.type, "tex")}'
-            - handle_req:
-                request:
-                  method: post
-                  uri: /{domain}/sys/mathoid/v1/handler/{format}
-                  headers:
-                    cache-control: '{cache-control}'
-                    x-resource-location: '{$.store.body}'
-                  body:
-                    q: '{$.request.body.q}'
-                    type: '{$$.default($.request.body.type, "tex")}'
-      /{module:mathoid}/v1/request/{format}/{hash}:
-        get:
-          x-setup-handler:
-            - init:
-                uri: /{domain}/sys/post_data/mathoid.request
-          x-request-handler:
-            - get_from_storage:
-                request:
-                  method: get
-                  uri: /{domain}/sys/post_data/mathoid.request/{hash}
-            - handle_req:
-                request:
-                  method: post
-                  uri: /{domain}/sys/mathoid/v1/handler/{format}
-                  headers:
-                    cache-control: '{cache-control}'
-                    x-resource-location: '{$.request.params.hash}'
-                  body: '{$.get_from_storage.body}'
-      /{module:mathoid}/v1/handler/{format}:
-        post:
-          x-setup-handler:
-            - init:
-                uri: /{domain}/sys/key_value/mathoid.data
-                body:
-                  keyType: string
-                  valueType: json
-          x-request-handler:
-            - check_storage:
-                request:
-                  method: get
-                  uri: 
/{domain}/sys/key_value/mathoid.data/{$.request.headers.x-resource-location}
-                  headers:
-                    cache-control: '{cache-control}'
-                return_if:
-                  status: '2xx'
-                return:
-                  status: 200
-                  headers: 
'{$$.merge($.check_storage.body.data[$.request.params.format].headers,$.check_storage.body.headers)}'
-                  body: 
'{$.check_storage.body.data[$.request.params.format].body}'
-                catch:
-                  status: 404
-            - mathoid:
-                request:
-                  method: post
-                  uri: http://localhost:<%= @mathoid_port %>/complete
-                  body:
-                    q: '{$.request.body.q}'
-                    type: '{$.request.body.type}'
-            - store:
-                request:
-                  method: put
-                  uri: 
/{domain}/sys/key_value/mathoid.data/{$.request.headers.x-resource-location}
-                  headers:
-                    content-type: application/json
-                  body:
-                    headers: '{$$.merge($.mathoid.headers, 
{"x-resource-location": $.request.headers.x-resource-location})}'
-                    data: '{$.mathoid.body}'
-                return:
-                  status: 200
-                  headers: 
'{$$.merge($.mathoid.body[$.request.params.format].headers,$$.merge($.mathoid.headers,
 {"x-resource-location": $.request.headers.x-resource-location}))}'
-                  body: '{$.mathoid.body[$.request.params.format].body}'
 
 
   wp-default-1.0.0: &wp/default/1.0.0
diff --git a/puppet/modules/service/manifests/gitupdate.pp 
b/puppet/modules/service/manifests/gitupdate.pp
index 949918d..bf6cd5e 100644
--- a/puppet/modules/service/manifests/gitupdate.pp
+++ b/puppet/modules/service/manifests/gitupdate.pp
@@ -75,7 +75,7 @@
     # descern the update command to use
     $up_cmd = $type ? {
         'php'    => 'composer update --no-interaction --optimize-autoloader',
-        'nodejs' => 'npm install --no-bin-links',
+        'nodejs' => 'rm-rf node_modules/ && npm install --no-bin-links',
         default  => 'invalid'
     }
     if $update and $up_cmd == 'invalid' {

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie4769e123850d4ff4da24a22834b2c5d3d03586f
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/vagrant
Gerrit-Branch: master
Gerrit-Owner: Mobrovac <mobro...@wikimedia.org>

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

Reply via email to