MaxSem has uploaded a new change for review.

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

Change subject: WIP: discovery stats module
......................................................................

WIP: discovery stats module

This is just a sketch based on statistics::wmde
* The repository mentioned doesn't exist yet, code's at
  https://github.com/MaxSem/discovery-stats
* While the current code can be run from anywhere on the cluster
  that has access to Graphite, it might in the future need access
  to DB replicas and/or Hadoop, so it should be placed on a stat* host.

Bug: T143048
Change-Id: Ibac3173b941dbee9ac6ffe72aaa5c3dd8dcdb144
---
M manifests/role/statistics.pp
A modules/statistics/manifests/discovery.pp
2 files changed, 70 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/operations/puppet 
refs/changes/73/305673/1

diff --git a/manifests/role/statistics.pp b/manifests/role/statistics.pp
index 96e41f3..858514a 100644
--- a/manifests/role/statistics.pp
+++ b/manifests/role/statistics.pp
@@ -141,6 +141,9 @@
     # WMDE statistics scripts and cron jobs
     include ::statistics::wmde
 
+    # Discovery statistics generating scripts
+    include ::statistics::discovery
+
     # eventlogging logs are not private, but they
     # are here for convenience
     include ::statistics::rsync::eventlogging
diff --git a/modules/statistics/manifests/discovery.pp 
b/modules/statistics/manifests/discovery.pp
new file mode 100644
index 0000000..60ec32c
--- /dev/null
+++ b/modules/statistics/manifests/discovery.pp
@@ -0,0 +1,67 @@
+
+class statistics::discovery {
+  Class['::statistics'] -> Class['::statistics::discovery']
+
+  $statistics_working_path = $::statistics::working_path
+  $dir = "${statistics_working_path}/discovery-stats"
+  user { $user:
+    ensure => present,
+    home => $dir
+  }
+  $data_dir  = "${dir}/data"
+  $scripts_dir  = "${dir}/src"
+
+  $statsd_host = hiera('statsd')
+  # TODO graphite hostname should be in hiera
+  $graphite_host = 'graphite.eqiad.wmnet'
+
+  # Path in which all crons will log to.
+  $log_dir = "${dir}/log"
+
+  $wmde_secrets = hiera('wmde_secrets')
+
+  require_package(
+    'php5',
+    'php5-cli',
+    'git')
+
+  $directories = [
+    $dir,
+    $scripts_dir,
+    $log_dir
+  ]
+
+  file { $directories:
+    ensure  => 'directory',
+    owner   => $user,
+    group   => $user,
+    mode    => '0644',
+    require => User[$user],
+  }
+
+  git::clone { 'analytics/discovery-stats':
+    ensure    => 'latest',
+    branch    => 'production',
+    origin    => 'https://gerrit.wikimedia.org/r/analytics/discovery-stats',
+    owner     => $user,
+    group     => $user,
+    require   => File["${dir}/src"],
+  }
+
+  logrotate::conf { 'analytics/discovery-stats':
+    ensure  => present,
+    content => template('statistics/wmde/logrotate.erb'),
+    require => File[$log_dir],
+  }
+
+  Cron {
+    user => $user,
+  }
+
+  cron { 'discovery-stats':
+    command => "/usr/bin/php ${scripts_dir}/tracking-category-count.php >> 
${log_dir}/minutely.log 2>&1",
+    hour    => '*',
+    require => Git::Clone['wmde/scripts'],
+  }
+
+}

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ibac3173b941dbee9ac6ffe72aaa5c3dd8dcdb144
Gerrit-PatchSet: 1
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: MaxSem <maxsem.w...@gmail.com>

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

Reply via email to