Ori.livneh has uploaded a new change for review.

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

Change subject: Write redis's pid file to /var/lib/redis by default.
......................................................................

Write redis's pid file to /var/lib/redis by default.

- We configure redis to daemonize. This is not great, but tricky to change,
  because redis's configuration and its Upstart job configuration have to be
  changed in a particular order to avoid Upstart losing track of redis's pid.
- We configure redis to write its pid file in /var/run/redis/.
- Upstart setuid / setgid redis, so it can't create /var/run/redis.
- We could drop the setuid / setgid directives from the job file and use
  start-stop-daemon to run redis and drop privileges instead, but that means
  changing "expect fork" to "expect daemon", which is tricky -- see the first
  point above.
- We could have a separate Upstart job that is configured to run before any
  redis instance jobs and that creates /var/run/redis. But this is ugly.
- We can make redis write its pid file to /var/lib/redis, which persists across
  reboots. This is the approach I went with. If a stale pidfile is present,
  redis will clobber it, which is the desired behavior.

Change-Id: I5b3c0964fcbb2343dca99494915bcf88e630e64b
---
M modules/redis/manifests/init.pp
M modules/redis/manifests/instance.pp
2 files changed, 2 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/operations/puppet 
refs/changes/80/268580/1

diff --git a/modules/redis/manifests/init.pp b/modules/redis/manifests/init.pp
index 0344551..df99c15 100644
--- a/modules/redis/manifests/init.pp
+++ b/modules/redis/manifests/init.pp
@@ -6,7 +6,7 @@
 class redis {
     require_package('redis-server')
 
-    file { '/srv/redis':
+    file { [ '/srv/redis', '/var/lib/redis', '/var/log/redis' ]:
         ensure => directory,
         owner  => 'redis',
         group  => 'redis',
diff --git a/modules/redis/manifests/instance.pp 
b/modules/redis/manifests/instance.pp
index b4d44b0..8d60f08 100644
--- a/modules/redis/manifests/instance.pp
+++ b/modules/redis/manifests/instance.pp
@@ -50,7 +50,7 @@
     }
 
     $defaults = {
-        pidfile    => "/var/run/redis/${instance_name}.pid",
+        pidfile    => "/var/lib/redis/${instance_name}.pid",
         logfile    => "/var/log/redis/${instance_name}.log",
         port       => $port,
         unixsocket => $unixsocket,

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I5b3c0964fcbb2343dca99494915bcf88e630e64b
Gerrit-PatchSet: 1
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Ori.livneh <o...@wikimedia.org>

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

Reply via email to