[WIP] Replace apache with nginx

Since stackalytics requires so much RAM, we are switching to nginx in
an effort to improve performance.

Change-Id: I031b7dbd5b8163cec06950c682b951ea51fcefc4
Depends-On: Iaf67ce97b9376577c49e445c7172dc8563622dde
Signed-off-by: Paul Belanger <pabelanger@redhat.com>
This commit is contained in:
Paul Belanger 2015-11-09 08:27:31 -05:00
parent a8d6a95297
commit bf6ffa47f9
3 changed files with 17 additions and 48 deletions

View File

@ -1,9 +1,4 @@
[uwsgi]
uid = stackalytics
gid = stackalytics
socket = 127.0.0.1:3031
socket = /tmp/stackalytics.sock
pythonpath = /usr/local/lib/python2.7/dist-packages
module = stackalytics.dashboard.web:app
processes = 2
threads = 1
stats = 127.0.0.1:9191

View File

@ -27,14 +27,10 @@ class stackalytics (
$memcached_port = '11211',
$vhost_name = $::fqdn,
) {
include ::httpd
include ::httpd::mod::wsgi
include ::pip
include ::logrotate
$packages = [
'libapache2-mod-proxy-uwsgi',
'libapache2-mod-uwsgi',
'uwsgi',
'uwsgi-plugin-python',
]
@ -51,6 +47,22 @@ class stackalytics (
udp_port => $memcached_port,
}
class { '::nginx':
manage_repo => false,
}
::nginx::resource::vhost { $vhost_name:
ensure => present,
uwsgi => 'unix:///tmp/stackalytics.sock',
}
::nginx::resource::location { $vhost_name:
ensure => present,
location_alias => '/usr/local/lib/python2.7/dist-packages/stackalytics/dashboard/static/',
location => '/static/',
vhost => $vhost_name,
}
group { 'stackalytics':
ensure => present,
}
@ -201,27 +213,6 @@ class stackalytics (
refreshonly => true,
}
::httpd::vhost { $vhost_name:
port => 80,
docroot => 'MEANINGLESS ARGUMENT',
priority => '50',
template => 'stackalytics/stackalytics.vhost.erb',
ssl => true,
}
httpd::mod { 'proxy':
ensure => present,
}
httpd::mod { 'proxy_http':
ensure => present,
}
httpd::mod { 'proxy_uwsgi':
ensure => present,
require => Package[$packages],
}
ini_setting { 'sources_root':
ensure => present,
notify => Exec['stackalytics-reload'],

View File

@ -1,17 +0,0 @@
<VirtualHost <%= @vhost_name %>:80>
ErrorLog ${APACHE_LOG_DIR}/stackalytics-error.log
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/stackalytics-access.log combined
<Directory /usr/local/lib/python2.7/dist-packages/stackalytics/dashboard>
Require all granted
</Directory>
Alias /static /usr/local/lib/python2.7/dist-packages/stackalytics/dashboard/static/
ProxyPass / uwsgi://127.0.0.1:3031/ retry=0
ProxyPassReverse / uwsgi://127.0.0.1:3031/
</VirtualHost>