Yuvipanda has submitted this change and it was merged.

Change subject: cxserver: Unify production and beta roles
......................................................................


cxserver: Unify production and beta roles

Bug: T86633
Change-Id: I74ee57e9e10aac2f7df7c3c09052afbaf901e4d0
---
M hieradata/role/common/cxserver/production.yaml
M manifests/role/cxserver.pp
M manifests/site.pp
M modules/cxserver/manifests/init.pp
4 files changed, 17 insertions(+), 54 deletions(-)

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



diff --git a/hieradata/role/common/cxserver/production.yaml 
b/hieradata/role/common/cxserver/production.yaml
index 6fb0a82..b3b5cd4 100644
--- a/hieradata/role/common/cxserver/production.yaml
+++ b/hieradata/role/common/cxserver/production.yaml
@@ -1 +1 @@
-role::cxserver::cxserver_port: 8080
+role::cxserver::port: 8080
diff --git a/manifests/role/cxserver.pp b/manifests/role/cxserver.pp
index 655ec6a..87e5b9c 100644
--- a/manifests/role/cxserver.pp
+++ b/manifests/role/cxserver.pp
@@ -1,64 +1,27 @@
 # vim: set ts=4 et sw=4:
 
-class role::cxserver::production {
-    system::role { 'role::cxserver::production':
+class role::cxserver (
+    $port = 8080,
+) {
+    system::role { 'role::cxserver':
         description => 'content translation server'
     }
 
-    class { '::cxserver':
-        base_path => '/srv/deployment/cxserver/cxserver',
-        node_path => '/srv/deployment/cxserver/deploy/node_modules',
-        conf_path => '/srv/deployment/cxserver/cxserver/config.js',
-        log_dir   => '/var/log/cxserver',
-        parsoid   => 'http://parsoid-lb.eqiad.wikimedia.org',
-        apertium  => 'http://apertium.svc.eqiad.wmnet:2737',
-    }
-
-    # Define cxserver port
-    $cxserver_port = hiera('role::cxserver::cxserver_port', 8080)
+    include ::cxserver
 
     # We have to explicitly open the cxserver port (bug T47868)
     ferm::service { 'cxserver_http':
         proto => 'tcp',
-        port  => $cxserver_port,
+        port  => $port,
     }
 
     monitoring::service { 'cxserver':
         description   => 'cxserver',
-        check_command => "check_http_on_port!${cxserver_port}",
+        check_command => "check_http_on_port!${port}",
     }
 }
 
-class role::cxserver::beta {
-    system::role { 'role::cxserver::beta':
-        description => 'content translation server (on beta)'
-    }
-
-    class { '::cxserver':
-        base_path => '/srv/deployment/cxserver/cxserver',
-        node_path => '/srv/deployment/cxserver/deploy/node_modules',
-        conf_path => '/srv/deployment/cxserver/config.js',
-        log_dir   => '/data/project/cxserver/log',
-        parsoid   => 'http://parsoid-lb.eqiad.wikimedia.org',
-        apertium  => 'http://apertium-beta.wmflabs.org',
-    }
-
-    # Need to allow jenkins-deploy to reload cxserver
-    sudo::user { 'jenkins-deploy': privileges => [
-        # Since the "root" user is local, we cant add the sudo policy in
-        # OpenStack manager interface at wikitech
-        'ALL = (root)  NOPASSWD:/usr/sbin/service cxserver restart',
-    ] }
-
-    # Define cxserver port
-    $cxserver_port = hiera('role::cxserver::cxserver_port', 8080)
-
-    # We have to explicitly open the cxserver port (bug 45868)
-    ferm::service { 'cxserver_http':
-        proto => 'tcp',
-        port  => $cxserver_port,
-    }
-
+class role::cxserver::jenkins_access {
     # Allow ssh access from the Jenkins master to the server where cxserver is
     # running
     include contint::firewall::labs
diff --git a/manifests/site.pp b/manifests/site.pp
index 4e4ed0d..18c30eb 100644
--- a/manifests/site.pp
+++ b/manifests/site.pp
@@ -2718,7 +2718,7 @@
 
     include role::mathoid::production
     include role::citoid::production
-    role apertium, cxserver::production
+    role apertium, cxserver
 
     class { 'admin':
         groups => [
diff --git a/modules/cxserver/manifests/init.pp 
b/modules/cxserver/manifests/init.pp
index 91c8e88..5fc6b23 100644
--- a/modules/cxserver/manifests/init.pp
+++ b/modules/cxserver/manifests/init.pp
@@ -23,13 +23,13 @@
 # [*port*]
 #   Port where to run the cxserver service. Defaults to 8080.
 class cxserver(
-    $base_path,
-    $node_path,
-    $conf_path,
-    $log_dir,
-    $parsoid,
-    $apertium,
-    $port=8080
+    $base_path = '/srv/deployment/cxserver/cxserver',
+    $node_path = '/srv/deployment/cxserver/deploy/node_modules',
+    $conf_path = '/srv/deployment/cxserver/cxserver/config.js',
+    $log_dir = '/var/log/cxserver',
+    $parsoid = 'http://parsoid-lb.eqiad.wikimedia.org',
+    $apertium = 'http://apertium.svc.eqiad.wmnet:2737',
+    $port = 8080,
 ) {
     # dictd-* packages for dictionary server.
     require_package('nodejs')

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I74ee57e9e10aac2f7df7c3c09052afbaf901e4d0
Gerrit-PatchSet: 4
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Yuvipanda <[email protected]>
Gerrit-Reviewer: Alexandros Kosiaris <[email protected]>
Gerrit-Reviewer: Filippo Giunchedi <[email protected]>
Gerrit-Reviewer: Giuseppe Lavagetto <[email protected]>
Gerrit-Reviewer: Hashar <[email protected]>
Gerrit-Reviewer: Yuvipanda <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to