Switch api server to use system python instead of venv

This commit removes the venv handling from the api puppet module. The
venv added unecessary complexity to the puppet module and made things a
bit fragile. Since this is typically deployed on a standalone server
there wasn't really a reason to do this.

Change-Id: Ifa3a0c8ece479534115d8905f5faf831d8bb88ae
This commit is contained in:
Matthew Treinish 2017-08-02 14:09:03 -04:00
parent ae79f7b8d4
commit 46ebfa525e
No known key found for this signature in database
GPG Key ID: FD12A0F214C9E177
2 changed files with 9 additions and 14 deletions

View File

@ -42,7 +42,6 @@ class openstack_health::api(
}
$api_dir = "${source_dir}/openstack_health"
$virtualenv_dir = "${source_dir}/.venv"
class { '::python':
dev => true,
@ -66,11 +65,6 @@ class openstack_health::api(
require => Class['::openstack_health::user'],
}
::python::virtualenv { $virtualenv_dir:
ensure => present,
require => Class['::python'],
}
package {'apache2-utils':
ensure => present,
}
@ -110,9 +104,9 @@ class openstack_health::api(
}
exec { 'requirements':
command => "${virtualenv_dir}/bin/pip install -U -r ${source_dir}/requirements.txt",
command => "pip install -U -r ${source_dir}/requirements.txt",
path => '/usr/local/bin:/usr/bin:/bin/',
require => [
Python::Virtualenv[$virtualenv_dir],
Package['libmemcached-dev'],
Package['cython'],
],
@ -122,9 +116,9 @@ class openstack_health::api(
}
exec { 'elastic-recheck-install':
command => "${virtualenv_dir}/bin/pip install -U ${elastic_recheck_dir}",
command => "pip install -U ${elastic_recheck_dir}",
path => '/usr/local/bin:/usr/bin:/bin/',
require => [
Python::Virtualenv[$virtualenv_dir],
Package['libffi-dev'],
],
subscribe => Vcsrepo[$elastic_recheck_dir],
@ -133,8 +127,10 @@ class openstack_health::api(
}
exec { 'package-application':
command => "${virtualenv_dir}/bin/pip install -e ${source_dir}",
command => "pip install -U ${source_dir}",
path => '/usr/local/bin:/usr/bin:/bin/',
refreshonly => true,
require => Exec['elastic-recheck-install'],
subscribe => Exec['requirements'],
}

View File

@ -1,7 +1,6 @@
<% unless [443, 80].include?(scope.lookupvar("openstack_health::api::vhost_port").to_i) %>
Listen <%= scope.lookupvar("openstack_health::api::vhost_port") %>
<% end %>
WSGIPythonHome <%= scope.lookupvar("openstack_health::api::virtualenv_dir") %>
<VirtualHost *:<%= scope.lookupvar("openstack_health::api::vhost_port") %>>
ServerName <%= scope.lookupvar("openstack_health::api::vhost_name") %>
ServerAdmin <%= scope.lookupvar("openstack_health::api::server_admin") %>
@ -11,9 +10,9 @@ WSGIPythonHome <%= scope.lookupvar("openstack_health::api::virtualenv_dir") %>
ErrorLog ${APACHE_LOG_DIR}/openstack-health-api-error.log
WSGIDaemonProcess flask user=openstack_health group=openstack_health threads=5 home=<%= scope.lookupvar("openstack_health::api::source_dir") %>
WSGIScriptAlias / <%= scope.lookupvar("openstack_health::api::virtualenv_dir") %>/bin/openstack-health
WSGIScriptAlias / /usr/local/bin/openstack-health
<Directory <%= scope.lookupvar("openstack_health::api::virtualenv_dir") %>/bin>
<Directory /usr/local/bin>
WSGIProcessGroup flask
WSGIApplicationGroup %{GLOBAL}
WSGIScriptReloading On