From 400ff4d61204f999570a3487dfab4f6b54ba3179 Mon Sep 17 00:00:00 2001 From: Marcio Mazza Date: Wed, 10 Sep 2014 20:14:44 -0300 Subject: [PATCH] Puppet: supervisor --- bin/run_sigi | 3 ++- puppet/manifests/site.pp | 24 ++++++++++++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/bin/run_sigi b/bin/run_sigi index 6ddfde4..a6ddc73 100755 --- a/bin/run_sigi +++ b/bin/run_sigi @@ -2,6 +2,7 @@ NAME="sigi" DJANGODIR=/srv/sigi +VENVDIR=/srv/.virtualenvs/sigi/bin SOCKFILE=/var/run/sigi/sigi.sock USER=sigi GROUP=sigi @@ -18,7 +19,7 @@ export PYTHONPATH=$DJANGODIR:$PYTHONPATH RUNDIR=$(dirname $SOCKFILE) test -d $RUNDIR || mkdir -p $RUNDIR -exec gunicorn ${DJANGO_WSGI_MODULE}:application \ +exec ${VENVDIR}/gunicorn ${DJANGO_WSGI_MODULE}:application \ --name $NAME \ --workers $NUM_WORKERS \ --user=$USER --group=$GROUP \ diff --git a/puppet/manifests/site.pp b/puppet/manifests/site.pp index f6c5788..34f8ce7 100644 --- a/puppet/manifests/site.pp +++ b/puppet/manifests/site.pp @@ -1,3 +1,7 @@ +Exec { + path => '/usr/bin:/usr/sbin:/bin:/usr/local/bin', +} + group { 'sigi': ensure => 'present', } @@ -97,6 +101,26 @@ exec { 'collectstatic': # TODO local_settings.py ... +########################################################################### +# SUPERVISOR + +# XXX trocar isso por algum plugin do puppet? + +$supervisor_conf = '/etc/supervisor/conf.d/sigi.conf' + +file { $supervisor_conf: + ensure => link, + target => "${sigi_dir}/etc/supervisor/conf.d/sigi.conf", + require => [ + Vcsrepo[$sigi_dir], + Package['supervisor'] ] +} + +exec { 'supervisor_update': + command => 'supervisorctl reread && supervisorctl update', + refreshonly => true, + subscribe => [ File[$supervisor_conf], Vcsrepo[$sigi_dir]], +} ########################################################################### # NGINX