Ori.livneh has uploaded a new change for review.
https://gerrit.wikimedia.org/r/60094
Change subject: Use Upstart rather than supervisor to manage IPython
......................................................................
Use Upstart rather than supervisor to manage IPython
This change transfers responsibility for starting and stopping IPython Notebook
from supervisor to Upstart. I'm doing so for the sake of simplicity and
consistency. I did not use the `upstart_job` resource type in
generic-definitions.pp because I wanted to keep the module self-contained and
because I wanted to use template (`upstart_job` looks for a static file in
files/upstart).
Change-Id: I2c10bb25bc31285be2f1dd3b31b5252855f76f11
---
M modules/eventlogging/manifests/notebook.pp
A modules/eventlogging/templates/ipython-notebook.conf.erb
D modules/eventlogging/templates/notebook.conf.erb
3 files changed, 40 insertions(+), 16 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/operations/puppet
refs/changes/94/60094/1
diff --git a/modules/eventlogging/manifests/notebook.pp
b/modules/eventlogging/manifests/notebook.pp
index 9d1488f..504c470 100644
--- a/modules/eventlogging/manifests/notebook.pp
+++ b/modules/eventlogging/manifests/notebook.pp
@@ -89,11 +89,22 @@
mode => '0444',
}
- file { '/etc/supervisor/conf.d/notebook.conf':
- content => template('eventlogging/notebook.conf.erb'),
- require => [ Package['ipython-notebook'], File[$notebook_dir],
File[$graph_dir] ],
- notify => Service['supervisor'],
- mode => '0444',
+ file { '/etc/init.d/ipython-notebook':
+ ensure => link,
+ target => '/lib/init/upstart-job',
+ }
+
+ file { '/etc/init/ipython-notebook.conf':
+ content => template('eventlogging/ipython-notebook.conf.erb'),
+ require => File['/etc/init.d/ipython-notebook'],
+ notify => Exec['start ipython-notebook'],
+ }
+
+ exec { 'Start IPython Notebook':
+ command => '/sbin/start ipython-notebook',
+ refreshonly => true,
+ require => [ Package['ipython-notebook'],
File[$notebook_dir], File[$graph_dir] ],
+ returns => [ 0, 1 ], # OK if "Job is already running"
}
}
diff --git a/modules/eventlogging/templates/ipython-notebook.conf.erb
b/modules/eventlogging/templates/ipython-notebook.conf.erb
new file mode 100644
index 0000000..2471fd4
--- /dev/null
+++ b/modules/eventlogging/templates/ipython-notebook.conf.erb
@@ -0,0 +1,24 @@
+# vim: set ft=upstart:
+
+# Upstart job configuration for IPython Notebook
+# This file is managed by Puppet
+
+description "IPython Notebook"
+author "Ori Livneh <[email protected]>"
+
+start on (local-filesystems and net-device-up IFACE!=lo)
+stop on runlevel [!2345]
+
+setuid <%= ipython_user %>
+setgid <%= ipython_dir %>
+
+chdir "<%= ipython_dir %>"
+
+env HOME="<%= ipython_dir %>"
+env IPYTHONDIR="<%= ipython_dir %>"
+env MPLCONFIGDIR="<%= graph_dir %>"
+
+exec ipython notebook \
+ --ipython-dir="<%= ipython_dir %>" \
+ --profile="<%= ipython_profile %>"
+respawn
diff --git a/modules/eventlogging/templates/notebook.conf.erb
b/modules/eventlogging/templates/notebook.conf.erb
deleted file mode 100644
index e90b128..0000000
--- a/modules/eventlogging/templates/notebook.conf.erb
+++ /dev/null
@@ -1,11 +0,0 @@
-; supervisor configuration for ipython-notebook
-; This file is managed by Puppet.
-
-[program:notebook]
-command = ipython notebook --ipython-dir="<%= ipython_dir %>" --profile="<%=
ipython_profile %>"
-user = <%= ipython_user %>
-directory = <%= ipython_dir %>
-redirect_stderr = true
-stdout_logfile = /var/log/supervisor/%(program_name)s.log
-stderr_logfile = NONE
-environment = IPYTHONDIR=<%= ipython_dir %>,MPLCONFIGDIR=<%= graph_dir %>
--
To view, visit https://gerrit.wikimedia.org/r/60094
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I2c10bb25bc31285be2f1dd3b31b5252855f76f11
Gerrit-PatchSet: 1
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Ori.livneh <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits