BryanDavis has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/329546 )

Change subject: Convert statsd to systemd
......................................................................

Convert statsd to systemd

Bug: T154268
Change-Id: Iba2e9f9a0ab04cfaa98fa96c3434bc024a521bff
---
M puppet/modules/statsd/manifests/init.pp
A puppet/modules/statsd/templates/systemd.erb
D puppet/modules/statsd/templates/upstart.conf.erb
3 files changed, 24 insertions(+), 28 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/vagrant 
refs/changes/46/329546/1

diff --git a/puppet/modules/statsd/manifests/init.pp 
b/puppet/modules/statsd/manifests/init.pp
index ef2bbf9..05c4efd 100644
--- a/puppet/modules/statsd/manifests/init.pp
+++ b/puppet/modules/statsd/manifests/init.pp
@@ -41,14 +41,20 @@
         content => template('statsd/config.js.erb'),
         mode    => '0644',
         require => Git::Clone['statsd'],
+        notify  => Service['statsd'],
     }
 
-    file { '/etc/init/statsd.conf':
-        content => template('statsd/upstart.conf.erb'),
+    file { '/lib/systemd/system/statsd.service':
+        content => template('statsd/systemd.erb'),
         owner   => 'root',
         group   => 'root',
         mode    => '0444',
         notify  => Service['statsd'],
+    }
+    exec { 'systemd reload for statsd':
+        refreshonly => true,
+        command     => '/bin/systemctl daemon-reload',
+        subscribe   => File['/lib/systemd/system/statsd.service'],
     }
 
     file { '/etc/logrotate.d/statsd':
@@ -66,11 +72,7 @@
     service { 'statsd':
         ensure   => running,
         enable   => true,
-        provider => 'upstart',
-        require  => [
-            Git::Clone['statsd'],
-            Npm::Install[$dir],
-            File["${dir}/config.js"],
-        ],
+        provider => 'systemd',
+        require  => Npm::Install[$dir],
     }
 }
diff --git a/puppet/modules/statsd/templates/systemd.erb 
b/puppet/modules/statsd/templates/systemd.erb
new file mode 100644
index 0000000..ff61e53
--- /dev/null
+++ b/puppet/modules/statsd/templates/systemd.erb
@@ -0,0 +1,14 @@
+[Unit]
+Description="statsd service"
+
+[Service]
+Environment=NODE_PATH=<%= @dir %>/node_modules
+User=www-data
+Group=www-data
+SyslogIdentifier=statsd
+WorkingDirectory=<%= @dir %>
+ExecStart=/usr/bin/nodejs stats.js <%= @dir %>/config.js > <%= @logdir 
%>/statsd.log
+Restart=always
+
+[Install]
+WantedBy=multi-user.target
diff --git a/puppet/modules/statsd/templates/upstart.conf.erb 
b/puppet/modules/statsd/templates/upstart.conf.erb
deleted file mode 100644
index b31934a..0000000
--- a/puppet/modules/statsd/templates/upstart.conf.erb
+++ /dev/null
@@ -1,20 +0,0 @@
-# vim: set ft=upstart:
-
-# This file is managed by Puppet
-# Upstart init script for statsd
-
-description "statsd service"
-
-start on mediawiki-ready
-stop on runlevel [016]
-
-setuid "www-data"
-setgid "www-data"
-
-env NODE_PATH="<%= @dir %>/node_modules"
-
-chdir "<%= @dir %>"
-exec /usr/bin/nodejs stats.js <%= @dir %>/config.js > <%= @logdir %>/statsd.log
-
-respawn
-

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iba2e9f9a0ab04cfaa98fa96c3434bc024a521bff
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/vagrant
Gerrit-Branch: jessie-migration
Gerrit-Owner: BryanDavis <bda...@wikimedia.org>

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

Reply via email to