dev/modules/sysconfig/manifests/deploy.pp
changeset 587 a1aa29e7809f
child 588 8e9ea314e06e
equal deleted inserted replaced
586:59cddf254ebd 587:a1aa29e7809f
       
     1 class sysconfig::deploy {
       
     2     
       
     3     # create /var/run/gunicorn folder and insert entry in /etc/rc.local
       
     4     file { 'run-folder':
       
     5         path    => '/var/run/gunicorn',
       
     6         ensure  => 'directory',
       
     7         owner   => 'www-data',
       
     8         group   => 'www-data',
       
     9         mode    => '0775',
       
    10     }
       
    11 
       
    12     #create run folder for gunicorn
       
    13     file { 'rc.local':
       
    14         path    => '/etc/rc.local',
       
    15         ensure  => 'present',
       
    16         mode    => 755,
       
    17         owner   => 'root',
       
    18         group   => 'root',
       
    19         content => template('sysconfig/rc.local.erb')
       
    20     }
       
    21 
       
    22     # install supervidsord
       
    23     class { 'supervisord': }
       
    24     
       
    25     supervisord::program { 'coment' :
       
    26         command      => '/srv/comt/bin/gunicorn -b unix:/var/run/gunicorn/comt.socket cm.wsgi:app',
       
    27         user         => 'www-data',
       
    28         directory    => '/srv/comt',
       
    29         environment  => "PYTHONPATH='/srv/comt/src',PROJECT_PATH='/srv/comt/src/cm'"
       
    30     }
       
    31 
       
    32     exec { 'reload_supervisor' :
       
    33         command  => '/usr/bin/supervisorctl update',
       
    34         require  => Supervisord::Program['coment']
       
    35     }
       
    36 
       
    37     #add site
       
    38     nginx::resource::upstream { 'coment_app':
       
    39         ensure                => present,
       
    40         members               => [ 'unix:/var/run/gunicorn/comt.socket' ],
       
    41         upstream_fail_timeout => 0,
       
    42         require               => Exec['reload_supervisor']
       
    43     }
       
    44 
       
    45     nginx::resource::vhost { '172.16.1.2':
       
    46         ensure           => present,
       
    47         proxy            => 'http://coment_app',
       
    48         proxy_set_header => ['Host $http_host'],
       
    49         vhost_cfg_append => {
       
    50             'proxy_redirect' => 'off'
       
    51         },
       
    52         require          => Nginx::Resource::Upstream['coment_app']
       
    53     }
       
    54 
       
    55 }