Mobrovac has uploaded a new change for review.
https://gerrit.wikimedia.org/r/244746
Change subject: Introduce the mobileapps role
......................................................................
Introduce the mobileapps role
This patch introduces the role and module for the Mobile Content Service
which is a Node.JS service that tailors a Wiki page's HTML output to the
needs of the native mobile phone applications.
Bug: T115142
Change-Id: I68e521b98b2ccb84845150b1663e47b5b741b584
---
M puppet/hieradata/common.yaml
A puppet/modules/mobileapps/manifests/init.pp
M puppet/modules/restbase/manifests/init.pp
M puppet/modules/restbase/templates/config.yaml.erb
A puppet/modules/role/manifests/mobileapps.pp
A puppet/modules/role/settings/mobileapps.yaml
6 files changed, 50 insertions(+), 5 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/vagrant
refs/changes/46/244746/1
diff --git a/puppet/hieradata/common.yaml b/puppet/hieradata/common.yaml
index 1c09f45..575e6f9 100644
--- a/puppet/hieradata/common.yaml
+++ b/puppet/hieradata/common.yaml
@@ -178,6 +178,8 @@
mathoid::png: true
mathoid::speak_text: true
+mobileapps::port: 8888
+
graphoid::base_path: "%{hiera('mwv::services_dir')}/graphoid"
graphoid::node_path: "%{hiera('graphoid::base_path')}/node_modules"
graphoid::conf_path: "%{hiera('graphoid::base_path')}/graphoid.config.json"
diff --git a/puppet/modules/mobileapps/manifests/init.pp
b/puppet/modules/mobileapps/manifests/init.pp
new file mode 100644
index 0000000..25e288e
--- /dev/null
+++ b/puppet/modules/mobileapps/manifests/init.pp
@@ -0,0 +1,29 @@
+# == Class: mobileapps
+#
+# The mobile content service is a Node.JS service for massaging Wiki
+# HTML making it more suitable for display in native mobile phone apps.
+#
+# === Parameters
+#
+# [*port*]
+# Port the mobile content service listens on for incoming connections.
+#
+# [*log_level*]
+# The lowest level to log (trace, debug, info, warn, error, fatal)
+#
+class mobileapps(
+ $port,
+ $log_level = undef,
+) {
+
+ require ::restbase
+
+ service::node { 'mobileapps':
+ port => $port,
+ log_level => $log_level,
+ config => {
+ restbase_uri => "localhost:${::restbase::port}",
+ },
+ }
+
+}
diff --git a/puppet/modules/restbase/manifests/init.pp
b/puppet/modules/restbase/manifests/init.pp
index 3bf779c..b8b1062 100644
--- a/puppet/modules/restbase/manifests/init.pp
+++ b/puppet/modules/restbase/manifests/init.pp
@@ -37,6 +37,11 @@
default => 10042,
}
+ $mobileapps_port = defined(Class['mobileapps']) ? {
+ true => $::mobileapps::port,
+ default => 8888,
+ }
+
file { $dbdir:
ensure => directory,
owner => 'www-data',
diff --git a/puppet/modules/restbase/templates/config.yaml.erb
b/puppet/modules/restbase/templates/config.yaml.erb
index 0962273..9a76320 100644
--- a/puppet/modules/restbase/templates/config.yaml.erb
+++ b/puppet/modules/restbase/templates/config.yaml.erb
@@ -138,31 +138,31 @@
x-request-handler:
- get_from_backend:
request:
- uri:
http://appservice.wmflabs.org/{domain}/v1/page/mobile-html/{title}
+ uri: http://localhost:<%= @mobileapps_port
%>/{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}
+ uri: http://localhost:<%= @mobileapps_port
%>/{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}
+ uri: http://localhost:<%= @mobileapps_port
%>/{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}
+ uri: http://localhost:<%= @mobileapps_port
%>/{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}
+ uri: http://localhost:<%= @mobileapps_port
%>/{domain}/v1/page/mobile-text/{title}
global-content: &gb/content/1.0.0
diff --git a/puppet/modules/role/manifests/mobileapps.pp
b/puppet/modules/role/manifests/mobileapps.pp
new file mode 100644
index 0000000..305a338
--- /dev/null
+++ b/puppet/modules/role/manifests/mobileapps.pp
@@ -0,0 +1,7 @@
+# == Class: role::mobileapps
+# This role installs the mobile content service.
+#
+class role::mobileapps {
+ include ::mobileapps
+ include ::restbase
+}
diff --git a/puppet/modules/role/settings/mobileapps.yaml
b/puppet/modules/role/settings/mobileapps.yaml
new file mode 100644
index 0000000..9b746fd
--- /dev/null
+++ b/puppet/modules/role/settings/mobileapps.yaml
@@ -0,0 +1,2 @@
+forward_ports:
+ 8888: 8888
--
To view, visit https://gerrit.wikimedia.org/r/244746
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I68e521b98b2ccb84845150b1663e47b5b741b584
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/vagrant
Gerrit-Branch: master
Gerrit-Owner: Mobrovac <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits