jenkins-bot has submitted this change and it was merged.

Change subject: Update Contenttranslation role
......................................................................


Update Contenttranslation role

* Properly migrate to service-runner.
* Removed obsolete experimental flag.

Bug: T149880
Change-Id: Ie284f3e3abec0b9727f70ed5ea8182360edcbcd9
---
M puppet/hieradata/common.yaml
M puppet/modules/contenttranslation/manifests/cxserver.pp
M puppet/modules/contenttranslation/manifests/init.pp
D puppet/modules/contenttranslation/templates/cxserver.conf.erb
M puppet/modules/contenttranslation/templates/cxserver.config.yaml.erb
5 files changed, 24 insertions(+), 106 deletions(-)

Approvals:
  KartikMistry: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/puppet/hieradata/common.yaml b/puppet/hieradata/common.yaml
index a2e889f..02badb6 100644
--- a/puppet/hieradata/common.yaml
+++ b/puppet/hieradata/common.yaml
@@ -33,7 +33,6 @@
 changeprop::port: 7272
 
 contenttranslation::dir: 
"%{hiera('mediawiki::dir')}/extensions/ContentTranslation"
-contenttranslation::cxserver::dir: "%{hiera('mwv::services_dir')}/cxserver"
 contenttranslation::view_template: 
"//$1%{hiera('mediawiki::multiwiki::base_domain')}%{::port_fragment}/wiki/$2"
 contenttranslation::action_template: 
"//$1%{hiera('mediawiki::multiwiki::base_domain')}%{::port_fragment}/w/index.php?title=$2"
 contenttranslation::api_template: 
"//$1%{hiera('mediawiki::multiwiki::base_domain')}%{::port_fragment}/w/api.php"
@@ -44,7 +43,6 @@
 contenttranslation::database_password: "%{hiera('mysql::root_password')}"
 contenttranslation::eventlogging: false
 contenttranslation::betafeature: false
-contenttranslation::experimental: false
 contenttranslation::intarget: false
 contenttranslation::namespace: 'Main'
 contenttranslation::suggestions: true
@@ -56,18 +54,11 @@
 
 contenttranslation::cxserver::dir: "%{hiera('mwv::services_dir')}/cxserver"
 contenttranslation::cxserver::port: 8090
-contenttranslation::cxserver::proxy: 'null'
-contenttranslation::cxserver::log: /vagrant/logs
-contenttranslation::cxserver::allow_cors: '*'
 contenttranslation::cxserver::apertium: 'http://apertium.wmflabs.org'
-contenttranslation::cxserver::yandex: 'https://translate.yandex.net'
-contenttranslation::cxserver::yandex_key: 'null'
-contenttranslation::cxserver::youdao: 
'https://fanyi.youdao.com/paidapi/fanyiapi'
-contenttranslation::cxserver::youdao_key: 'null'
-contenttranslation::cxserver::secure: 'false'
-contenttranslation::cxserver::ssl_key: 'null'
-contenttranslation::cxserver::cert: 'null'
-contenttranslation::cxserver::workers: 2
+contenttranslation::cxserver::yandex_url: 'https://translate.yandex.net'
+contenttranslation::cxserver::yandex_api_key: 'null'
+contenttranslation::cxserver::youdao_url: 
'https://fanyi.youdao.com/paidapi/fanyiapi'
+contenttranslation::cxserver::youdao_api_key: 'null'
 
 crm::dir: "%{hiera('mwv::services_dir')}/org.wikimedia.civicrm"
 crm::site_name: "crm%{hiera('mwv::tld')}"
diff --git a/puppet/modules/contenttranslation/manifests/cxserver.pp 
b/puppet/modules/contenttranslation/manifests/cxserver.pp
index 0b5cdc7..e3f09a7 100644
--- a/puppet/modules/contenttranslation/manifests/cxserver.pp
+++ b/puppet/modules/contenttranslation/manifests/cxserver.pp
@@ -7,60 +7,33 @@
 #
 # == Parameters
 #
-# [*dir*]
-#   The directory in which to install cxserver.
-#   Defaults to /srv/cxserver.
-#
 # [*port*]
 #   The port the cxserver should listen on.
 #   Defaults to 8090.
 #
-# [*proxy*]
-#   Forward proxy to use when connecting to machine translation services.
-#   Defaults to 'null' for no proxy.
-#
-# [*log*]
-#   Log directory.
-#   Defaults to 'log'.
-#
-# [*allow_cors*]
-#   Hosts for CORS. Defaults to '*'.
+# [*dir*]
+#   The directory in which to install cxserver.
+#   Defaults to /srv/cxserver.
 #
 # [*apertium*]
 #   The url for the apertium machine translation service.
 #   Defaults to '//apertium.wmflabs.org'
 #
-# [*yandex*]
+# [*yandex_url*]
 #   The url for the yandex machine translation service.
 #   Defaults to 'https://translate.yandex.net'
 #
-# [*yandex_key*]
+# [*yandex_api_key*]
 #   Api key for yandex translation service.
 #   Defaults to 'null'.
 #
-# [*youdao*]
+# [*youdao_url*]
 #   The url for the youdao machine translation service.
 #   Defaults to 'https://fanyi.youdao.com/paidapi/fanyiapi'
 #
-# [*youdao_key*]
+# [*youdao_api_key*]
 #   Api key for youdao translation service.
 #   Defaults to 'null'.
-#
-# [*secure*]
-#   Whether or not to run cxserver on https.
-#   Defaults to 'false'.
-#
-# [*ssl_key*]
-#   Path to ssl key file.
-#   Defaults to 'null'.
-#
-# [*cert*]
-#   Path to cert file.
-#   Defaults to 'null'.
-#
-# [*workers*]
-#   Number of workers to spawn when starting cxserver.
-#   Defaults to 2.
 #
 # == Example
 #
@@ -75,44 +48,19 @@
 #   and include entries for the settings you want to override.
 #
 class contenttranslation::cxserver(
-    $dir,
     $port,
-    $proxy,
-    $log,
-    $allow_cors,
+    $dir,
     $apertium,
-    $yandex,
-    $yandex_key,
-    $youdao,
-    $youdao_key,
-    $secure,
-    $ssl_key,
-    $cert,
-    $workers,
+    $yandex_url,
+    $yandex_api_key,
+    $youdao_url,
+    $youdao_api_key,
+    $registry = 'registry.yaml',
 ) {
-    require ::npm
+    require ::service
 
-    git::clone { 'mediawiki/services/cxserver/deploy':
-        directory => $dir,
-        owner     => $::share_owner,
-        group     => $::share_group,
-    }
-
-    file { "${dir}/src/config.yaml":
-        content => template('contenttranslation/cxserver.config.yaml.erb'),
-        require => Git::Clone['mediawiki/services/cxserver/deploy'],
-    }
-
-    file { '/etc/init/cxserver.conf':
-        content => template('contenttranslation/cxserver.conf.erb'),
-    }
-
-    service { 'cxserver':
-        ensure    => running,
-        provider  => 'upstart',
-        subscribe => [
-            File['/etc/init/cxserver.conf'],
-            File["${dir}/src/config.yaml"],
-        ],
+    service::node { 'cxserver':
+        port      => $port,
+        config    => template('contenttranslation/cxserver.config.yaml.erb'),
     }
 }
diff --git a/puppet/modules/contenttranslation/manifests/init.pp 
b/puppet/modules/contenttranslation/manifests/init.pp
index 3db11aa..538a530 100644
--- a/puppet/modules/contenttranslation/manifests/init.pp
+++ b/puppet/modules/contenttranslation/manifests/init.pp
@@ -41,9 +41,6 @@
 #   Whether of not to make ContentTranslation only accessible as a beta
 #   feature.
 #
-# [*experimental*]
-#   Whether or not to enable experimental ContentTranslation features.
-#
 # [*intarget*]
 #   Whether or not to translate article on the target language wiki.
 #
@@ -84,7 +81,6 @@
     $database_password,
     $eventlogging,
     $betafeature,
-    $experimental,
     $intarget,
     $namespace,
     $suggestions,
@@ -106,7 +102,6 @@
             'wgContentTranslationEventLogging'            => $eventlogging,
             'wgContentTranslationTranslateInTarget'       => $intarget,
             'wgContentTranslationAsBetaFeature'           => $betafeature,
-            'wgContentTranslationeExperimentalFeatures'   => $experimental,
             'wgContentTranslationTargetNamespace'         => $namespace,
             'wgContentTranslationEnableSuggestions'       => $suggestions,
         }
diff --git a/puppet/modules/contenttranslation/templates/cxserver.conf.erb 
b/puppet/modules/contenttranslation/templates/cxserver.conf.erb
deleted file mode 100644
index e69385d..0000000
--- a/puppet/modules/contenttranslation/templates/cxserver.conf.erb
+++ /dev/null
@@ -1,19 +0,0 @@
-# vim: set ft=upstart:
-
-# Upstart job configuration for cxserver
-# This file is managed by Puppet
-
-description "cxserver service"
-
-start on (local-filesystems and net-device-up IFACE!=lo)
-stop on runlevel [!2345]
-
-setuid "www-data"
-setgid "www-data"
-
-env NODE_PATH="<%= @dir %>/node_modules"
-
-chdir "<%= @dir %>"
-exec node src/server.js --num-workers <%= @workers %>
-
-respawn
diff --git 
a/puppet/modules/contenttranslation/templates/cxserver.config.yaml.erb 
b/puppet/modules/contenttranslation/templates/cxserver.config.yaml.erb
index 485b1f8..08cc978 100644
--- a/puppet/modules/contenttranslation/templates/cxserver.config.yaml.erb
+++ b/puppet/modules/contenttranslation/templates/cxserver.config.yaml.erb
@@ -30,3 +30,6 @@
 
 # registry to use
 registry: registry.yaml
+
+# base path
+app_base_path: /vagrant/srv/cxserver/src

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ie284f3e3abec0b9727f70ed5ea8182360edcbcd9
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/vagrant
Gerrit-Branch: master
Gerrit-Owner: KartikMistry <kartik.mis...@gmail.com>
Gerrit-Reviewer: BryanDavis <bda...@wikimedia.org>
Gerrit-Reviewer: Dduvall <dduv...@wikimedia.org>
Gerrit-Reviewer: KartikMistry <kartik.mis...@gmail.com>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to