puppet-openstack_health/manifests/api.pp
Matthew Treinish 9d625d903d
Install openstack-health in editable mode
Due to the magic of non-determinism that is python packaging for
whatever reason the wsgi_script entrypoint is not being generated
when installing openstack-health in non-editable mode. So while we
wait for the local witch doctor to remove the curse from the system
this switches to using editable installs to move forward.

As part of this change the exec for running pip to install
openstack-health is also improved.

Change-Id: If5e166d6cba0553f160eabde491d0230e4834f01
2015-10-20 20:14:43 -04:00

70 lines
1.9 KiB
Puppet

# Install and maintain OpenStack Health.
# params:
# source_dir:
# The directory where the application will be running
# serveradmin:
# Used in the Apache virtual host, eg., openstack-health@openstack.org
# vhost_name:
# Used in the Apache virtual host, eg., health.openstack.org
# vhost_port:
# Used in the Apache virtual host, eg., 5000
class openstack_health::api(
$db_uri = undef,
$source_dir = '/opt/openstack-health',
$server_admin = "webmaster@${::fqdn}",
$vhost_name = 'localhost',
$vhost_port = 5000,
) {
include ::httpd::mod::wsgi
$api_dir = "${source_dir}/openstack_health"
$virtualenv_dir = "${source_dir}/.venv"
class { '::python':
dev => true,
pip => true,
virtualenv => true,
version => 'system',
}
::python::virtualenv { $virtualenv_dir:
ensure => present,
require => Class['::python'],
}
::python::requirements { "${source_dir}/requirements.txt":
virtualenv => $virtualenv_dir,
require => Python::Virtualenv[$virtualenv_dir],
subscribe => Vcsrepo[$source_dir],
}
exec { 'package-application':
command => "${virtualenv_dir}/bin/pip install -e ${source_dir}",
require => Python::Requirements["${source_dir}/requirements.txt"],
refreshonly => true,
subscribe => Vcsrepo[$source_dir],
}
file { '/etc/openstack-health.conf':
ensure => present,
content => template('openstack_health/openstack-health.conf.erb'),
owner => 'openstack_health',
group => 'openstack_health',
mode => '0644',
subscribe => Vcsrepo[$source_dir],
}
::httpd::vhost { "${vhost_name}-api":
docroot => 'MEANINGLESS ARGUMENT',
port => $vhost_port,
priority => '50',
ssl => false,
template => 'openstack_health/openstack-health-api.vhost.erb',
require => [
File['/etc/openstack-health.conf'],
Exec['package-application'],
],
}
}