Browse Source

Puppet: supervisor

producao
Marcio Mazza 10 years ago
parent
commit
400ff4d612
  1. 3
      bin/run_sigi
  2. 24
      puppet/manifests/site.pp

3
bin/run_sigi

@ -2,6 +2,7 @@
NAME="sigi" NAME="sigi"
DJANGODIR=/srv/sigi DJANGODIR=/srv/sigi
VENVDIR=/srv/.virtualenvs/sigi/bin
SOCKFILE=/var/run/sigi/sigi.sock SOCKFILE=/var/run/sigi/sigi.sock
USER=sigi USER=sigi
GROUP=sigi GROUP=sigi
@ -18,7 +19,7 @@ export PYTHONPATH=$DJANGODIR:$PYTHONPATH
RUNDIR=$(dirname $SOCKFILE) RUNDIR=$(dirname $SOCKFILE)
test -d $RUNDIR || mkdir -p $RUNDIR test -d $RUNDIR || mkdir -p $RUNDIR
exec gunicorn ${DJANGO_WSGI_MODULE}:application \ exec ${VENVDIR}/gunicorn ${DJANGO_WSGI_MODULE}:application \
--name $NAME \ --name $NAME \
--workers $NUM_WORKERS \ --workers $NUM_WORKERS \
--user=$USER --group=$GROUP \ --user=$USER --group=$GROUP \

24
puppet/manifests/site.pp

@ -1,3 +1,7 @@
Exec {
path => '/usr/bin:/usr/sbin:/bin:/usr/local/bin',
}
group { 'sigi': group { 'sigi':
ensure => 'present', ensure => 'present',
} }
@ -97,6 +101,26 @@ exec { 'collectstatic':
# TODO local_settings.py ... # 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 # NGINX

Loading…
Cancel
Save