Giuseppe Lavagetto has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/377211 )

Change subject: changeprop: convert to role/profile
......................................................................


changeprop: convert to role/profile

Change-Id: I191a4f46aaffa13bca21bfbb3a00292ef10f46b1
---
M hieradata/labs/deployment-prep/common.yaml
M hieradata/role/common/scb.yaml
D modules/changeprop/manifests/init.pp
D modules/changeprop/manifests/packages.pp
D modules/changeprop/tests/Makefile
D modules/changeprop/tests/init.pp
A modules/profile/manifests/changeprop.pp
M modules/role/manifests/changeprop.pp
8 files changed, 61 insertions(+), 131 deletions(-)

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



diff --git a/hieradata/labs/deployment-prep/common.yaml 
b/hieradata/labs/deployment-prep/common.yaml
index a1fbef7..6100459 100644
--- a/hieradata/labs/deployment-prep/common.yaml
+++ b/hieradata/labs/deployment-prep/common.yaml
@@ -16,10 +16,10 @@
 service::configuration::logstash_host: 
deployment-logstash2.deployment-prep.eqiad.wmflabs
 citoid::zotero_host: deployment-zotero01.deployment-prep.eqiad.wmflabs
 citoid::zotero_port: 1969
-changeprop::purge_host: deployment-cache-text04.deployment-prep.eqiad.wmflabs
-changeprop::ores_uris: 
['http://deployment-sca03.deployment-prep.eqiad.wmflabs:8081']
-# Need to redefine RESTBase URI as Change-Prop redefines it in order to 
provide a different value for async updates
-changeprop::restbase_uri: 
http://deployment-restbase02.deployment-prep.eqiad.wmflabs:7231
+profile::changeprop::purge_host: 
deployment-cache-text04.deployment-prep.eqiad.wmflabs
+profile::changeprop::ores_uris: 
['http://deployment-sca03.deployment-prep.eqiad.wmflabs:8081']
+profile::changeprop::restbase_uri: 
http://deployment-restbase02.deployment-prep.eqiad.wmflabs:7231
+profile::changeprop::purge_port: 4827
 # Used to sync the setting between all Kafka clusters and clients.
 kafka_message_max_bytes: 4194304
 graphoid::allowed_domains:
diff --git a/hieradata/role/common/scb.yaml b/hieradata/role/common/scb.yaml
index df1763b..bf4a56b 100644
--- a/hieradata/role/common/scb.yaml
+++ b/hieradata/role/common/scb.yaml
@@ -89,7 +89,13 @@
   broker.version.fallback: '0.9.0.1'
 ### END EVENTSTREAMS ###
 
-changeprop::restbase_uri: http://restbase-async.discovery.wmnet:7231
+### BEGIN CHANGEPROP ###
+profile::changeprop::restbase_uri: http://restbase-async.discovery.wmnet:7231
+profile::changeprop::purge_host: 239.128.0.112
+profile::changeprop::purge_port: 4827
+profile::changeprop::ores_uris:
+  - http://ores.svc.eqiad.wmnet:8081
+  - http://ores.svc.codfw.wmnet:8081
 profile::nutcracker::memcached_pools: {}
 profile::nutcracker::monitor_port: 0 # we have nothing exposed via tcp
 
diff --git a/modules/changeprop/manifests/init.pp 
b/modules/changeprop/manifests/init.pp
deleted file mode 100644
index 53e31e9..0000000
--- a/modules/changeprop/manifests/init.pp
+++ /dev/null
@@ -1,83 +0,0 @@
-# == Class: changeprop
-#
-# This class installs and configures the change propagation service, a part of
-# the EventBus system responsible for reacting to events received via Kafka and
-# dispatching the appropriate requests.
-#
-# === Parameters
-#
-# [*broker_list*]
-#   Comma-separated list of Kafka broker URIs
-#
-# [*purge_host*]
-#   The vhtcpd daemon host to send purge requests to. Default: 239.128.0.112
-#
-# [*purge_port*]
-#   The port the vhtcp daemon listens to. Default: 4827
-#
-# [*restbase_uri*]
-#   RESTBase's URI. Note that this is redefined here so that async update
-#   requests can be sent to the inactive DC. Default:
-#   'http://restbase.svc.eqiad.wmnet:7231'
-#
-# [*ores_uris*]
-#   A list of urls for the ORES service. Defaults to:
-#   [http://ores.svc.eqiad.wmnet:8081, http://ores.svc.codfw.wmnet:8081]
-#
-# [*redis_path*]
-#   The UNIX socket file path of the Redis/Nutcracker server. Default:
-#   "/var/run/nutcracker/redis_${::site}.sock"
-#
-# [*redis_pass*]
-#   The password to use when authenticating with Redis/Nutcracker. Default:
-#   'abc1234'
-#
-# [*kafka_msg_max_bytes*]
-#   The maximum number of bytes allowed in a Kafka message. Default:
-#   '1048576'
-#
-class changeprop(
-    $broker_list,
-    $purge_host          = '239.128.0.112',
-    $purge_port          = 4827,
-    $restbase_uri        = 'http://restbase.svc.eqiad.wmnet:7231',
-    $ores_uris           = [
-        'http://ores.svc.eqiad.wmnet:8081',
-        'http://ores.svc.codfw.wmnet:8081',
-    ],
-    $redis_path          = "/var/run/nutcracker/redis_${::site}.sock",
-    $redis_pass          = 'abc1234',
-    $kafka_msg_max_bytes = 1048576,
-) {
-
-    include ::service::configuration
-
-    require ::changeprop::packages
-
-    service::node { 'changeprop':
-        enable            => true,
-        port              => 7272,
-        healthcheck_url   => '',
-        has_spec          => true,
-        deployment        => 'scap3',
-        deployment_config => true,
-        deployment_vars   => {
-            broker_list     => $broker_list,
-            mwapi_uri       => $::service::configuration::mwapi_uri,
-            restbase_uri    => $restbase_uri,
-            ores_uris       => $ores_uris,
-            purge_host      => $purge_host,
-            purge_port      => $purge_port,
-            site            => $::site,
-            redis_path      => $redis_path,
-            redis_pass      => $redis_pass,
-            kafka_max_bytes => $kafka_msg_max_bytes,
-        },
-        auto_refresh      => false,
-        init_restart      => false,
-        environment       => {
-            'UV_THREADPOOL_SIZE' => 128,
-        },
-    }
-
-}
diff --git a/modules/changeprop/manifests/packages.pp 
b/modules/changeprop/manifests/packages.pp
deleted file mode 100644
index 1a76563..0000000
--- a/modules/changeprop/manifests/packages.pp
+++ /dev/null
@@ -1,16 +0,0 @@
-# == Class: changeprop::packages
-#
-# Installs the packages needed by change propagation
-#
-# NOTE: this is a temporary work-around for the CI to be able to install
-# development packages. In the future, we want to have more integration so as 
to
-# run tests as close to production as possible.
-#
-class changeprop::packages {
-
-  service::packages { 'changeprop':
-    pkgs     => ['librdkafka++1', 'librdkafka1'],
-    dev_pkgs => ['librdkafka-dev'],
-  }
-
-}
diff --git a/modules/changeprop/tests/Makefile 
b/modules/changeprop/tests/Makefile
deleted file mode 100644
index 3551657..0000000
--- a/modules/changeprop/tests/Makefile
+++ /dev/null
@@ -1,14 +0,0 @@
-# Test automator
-MANIFESTS=$(wildcard *.pp)
-OBJS=$(MANIFESTS:.pp=.po)
-TESTS_DIR=$(dir $(CURDIR))
-MODULE_DIR=$(TESTS_DIR:/=)
-MODULES_DIR=$(dir $(MODULE_DIR))
-
-all:    test
-
-test:   $(OBJS)
-
-%.po:   %.pp
-       puppet parser validate $<
-       puppet apply --noop --modulepath $(MODULES_DIR) $<
diff --git a/modules/changeprop/tests/init.pp b/modules/changeprop/tests/init.pp
deleted file mode 100644
index 0ecf3fb..0000000
--- a/modules/changeprop/tests/init.pp
+++ /dev/null
@@ -1 +0,0 @@
-include ::changeprop
diff --git a/modules/profile/manifests/changeprop.pp 
b/modules/profile/manifests/changeprop.pp
new file mode 100644
index 0000000..a9aed56
--- /dev/null
+++ b/modules/profile/manifests/changeprop.pp
@@ -0,0 +1,49 @@
+# Profile class for changeprop
+#
+# filtertags: labs-project-deployment-prep
+class profile::changeprop(
+    $restbase_uri = hiera('profile::changeprop::restbase_uri'),
+    $purge_host  = hiera('profile::changeprop::purge_host'),
+    $purge_port  = hiera('profile::changeprop::purge_port'),
+    $ores_uris  = hiera('profile::changeprop::ores_uris'),
+    $kafka_msg_max_bytes = hiera('kafka_message_max_bytes', 1048576),
+) {
+
+    include ::passwords::redis
+    include ::service::configuration
+    $kafka_config = kafka_config('main')
+    $broker_list = $kafka_config['brokers']['string']
+    $redis_path = "/var/run/nutcracker/redis_${::site}.sock"
+    $redis_pass = $::passwords::redis::main_password
+
+    service::packages { 'changeprop':
+        pkgs     => ['librdkafka++1', 'librdkafka1'],
+        dev_pkgs => ['librdkafka-dev'],
+    }
+
+    service::node { 'changeprop':
+        enable            => true,
+        port              => 7272,
+        healthcheck_url   => '',
+        has_spec          => true,
+        deployment        => 'scap3',
+        deployment_config => true,
+        deployment_vars   => {
+            broker_list     => $broker_list,
+            mwapi_uri       => $::service::configuration::mwapi_uri,
+            restbase_uri    => $restbase_uri,
+            ores_uris       => $ores_uris,
+            purge_host      => $purge_host,
+            purge_port      => $purge_port,
+            site            => $::site,
+            redis_path      => $redis_path,
+            redis_pass      => $redis_pass,
+            kafka_max_bytes => $kafka_msg_max_bytes,
+        },
+        auto_refresh      => false,
+        init_restart      => false,
+        environment       => {
+            'UV_THREADPOOL_SIZE' => 128,
+        },
+    }
+}
diff --git a/modules/role/manifests/changeprop.pp 
b/modules/role/manifests/changeprop.pp
index d25615f..52b58ac 100644
--- a/modules/role/manifests/changeprop.pp
+++ b/modules/role/manifests/changeprop.pp
@@ -2,20 +2,9 @@
 #
 # filtertags: labs-project-deployment-prep
 class role::changeprop {
-
-    include ::passwords::redis
-    $kafka_config = kafka_config('main')
-
     system::role { 'changeprop':
         description => 'propagates events from the EventBus',
     }
 
-    class { '::changeprop':
-        broker_list         => $kafka_config['brokers']['string'],
-        redis_pass          => $::passwords::redis::main_password,
-        # FIXME: this needs to be refactored when the role
-        # is moved to profiles.
-        kafka_msg_max_bytes => hiera('kafka_message_max_bytes', 1048576),
-    }
-
+    include ::profile::changeprop
 }

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I191a4f46aaffa13bca21bfbb3a00292ef10f46b1
Gerrit-PatchSet: 3
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Giuseppe Lavagetto <glavage...@wikimedia.org>
Gerrit-Reviewer: Giuseppe Lavagetto <glavage...@wikimedia.org>
Gerrit-Reviewer: Mobrovac <mobro...@wikimedia.org>
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