Commit 080499d1 authored by Rémi Duraffort's avatar Rémi Duraffort Committed by Neil Williams
Browse files

Remove references to wsgi

Change-Id: Id4ed07793bf21f37b4fe03178b6a2b0a0920ad2b
parent 37a94aaf
......@@ -38,8 +38,6 @@ include doc/v1/_static/*
include doc/v2/_static/*
include doc/v1/linaro_dashboard_bundle/*
include man/*
include etc/debug.wsgi
include etc/lava-default.conf
include etc/lava-master
include etc/lava-master.init
include etc/lava-master.service
......@@ -50,13 +48,9 @@ include etc/lava-server.conf
include etc/lava-server.gunicorn
include etc/lava-server-gunicorn.init
include etc/lava-server-gunicorn.service
include etc/lava-server.uwsgi.conf
include etc/env.yaml
include etc/logrotate.d/*
include etc/lava-server.wsgi
include etc/settings.conf
include etc/uwsgi.ini
include etc/uwsgi.reload
include fake-dispatcher
include version.py
recursive-include etc/dispatcher-config README
......
#!/usr/bin/python
# See https://code.google.com/p/modwsgi/wiki/DebuggingTechniques
# same licence as mod_wsgi itself
import cStringIO
import os
def application(environ, start_response):
headers = []
headers.append(('Content-Type', 'text/plain'))
write = start_response('200 OK', headers)
input = environ['wsgi.input']
output = cStringIO.StringIO()
print >> output, "PID: %s" % os.getpid()
print >> output, "UID: %s" % os.getuid()
print >> output, "GID: %s" % os.getgid()
print >> output
keys = environ.keys()
keys.sort()
for key in keys:
print >> output, '%s: %s' % (key, repr(environ[key]))
print >> output
output.write(input.read(int(environ.get('CONTENT_LENGTH', '0'))))
return [output.getvalue()]
# set the static files directory for this instance
Alias /var/lib/lava-server-static/ /usr/share/lava-server/static
# Allow serving media, static and other custom files
<Directory /usr/share/lava-server/static>
Options FollowSymLinks
AllowOverride None
Order allow,deny
allow from all
</Directory>
# uWSGI mount point. For this to work the uWSGI module needs be loaded.
# XXX: Perhaps we should just load it ourselves here, dunno.
<Location /var/lib/lava-server/>
SetHandler uwsgi-handler
uWSGISocket /run/uwsgi.sock
</Location>
#NameVirtualHost 127.0.0.1:80
#<VirtualHost lava-server:80>
<VirtualHost *:80>
ServerAdmin webmaster@localhost
Alias /static/ /usr/share/lava-server/static/
Alias /tmp/ /var/lib/lava/dispatcher/tmp/
Alias /favicon.ico /usr/share/lava-server/static/lava-server/images/logo.png
# Allow serving media, static and other custom files
<Directory /usr/share/lava-server/static/lava-server/>
Options FollowSymLinks
AllowOverride None
# apache2.4 config
Require all granted
# apache 2.2 config
# Order allow,deny
# allow from all
</Directory>
DocumentRoot /usr/share/lava-server/static/lava-server/
# Make exceptions for static and media.
# This allows apache to serve those and offload the application server
<Location /static>
SetHandler none
</Location>
# We don't need media files as those are private in our implementation
# this block is required for apache2.4
<Directory /etc/lava-server>
Require all granted
</Directory>
# images folder for lava-dispatcher tarballs
<Location /images/>
SetHandler none
</Location>
<Directory /var/lib/lava/dispatcher/tmp>
Options Indexes
Require all granted
AllowOverride None
</Directory>
WSGIDaemonProcess lavaserver user=lavaserver group=lavaserver processes=1 threads=5
WSGIProcessGroup lavaserver
# Use this line to debug your Apache setup
# WSGIScriptAlias / /etc/lava-server/debug.wsgi
WSGIScriptAlias / /etc/lava-server/lava-server.wsgi
WSGIPassAuthorization On
<Directory /usr/share/lava-server/static>
WSGIApplicationGroup %{GLOBAL}
WSGIPassAuthorization On
# apache2.4 config
Require all granted
# apache2.2 config
# Order deny,allow
# Allow from all
</Directory>
LogLevel info
ErrorLog ${APACHE_LOG_DIR}/lava-server.log
CustomLog ${APACHE_LOG_DIR}/lava-server.log combined
</VirtualHost>
#!/usr/bin/python
import lava.recipes.wsgi
application = lava.recipes.wsgi.handler('lava_server.settings.distro', '/etc/lava-server/{filename}.conf')
/var/log/lava-server/lava-uwsgi.log {
weekly
rotate 12
compress
delaycompress
missingok
notifempty
create 644 root root
}
[uwsgi]
socket = /run/uwsgi.sock
chmod-socket = 660
wsgi-file = /etc/lava-server/lava-server.wsgi
master = true
workers = 8
logto = /var/log/lava-uwsgi.log
log-master = true
auto-procname = true
touch-reload = /etc/lava-server/uwsgi.reload
gid = lavaserver
uid = lavaserver
Touching this file will gracefully restart uWSGI worker for the default LAVA instance
__import__('pkg_resources').declare_namespace(__name__)
# DO NOT ADD ANYTHING TO THIS FILE!
# IT MUST STAY AS IS (empty apart from the two lines above)
import os
import yaml
from django.core.wsgi import get_wsgi_application
def create_environ(env_file):
""" Generate the env variables for the server, same as the dispatcher """
conf = yaml.load(open(env_file))
if conf.get('purge', False):
environ = {}
else:
environ = dict(os.environ)
# Remove some variables (that might not exist)
for var in conf.get('removes', {}):
try:
del environ[var]
except KeyError:
pass
# Override
environ.update(conf.get('overrides', {}))
return environ
def handler(settings, ddst):
import django.core.wsgi
env_file = "/etc/lava-server/env.yaml"
if os.path.exists(env_file):
os.environ = create_environ(env_file)
os.environ['DJANGO_SETTINGS_MODULE'] = settings
os.environ['DJANGO_DEBIAN_SETTINGS_TEMPLATE'] = ddst
return get_wsgi_application()
......@@ -68,11 +68,11 @@ class Command(BaseCommand):
parser.add_argument('-u', '--user',
default='lavaserver',
help="Run the process under this user. It should be the same user as the wsgi process.")
help="Run the process under this user. It should be the same user as the gunicorn process.")
parser.add_argument('-g', '--group',
default='lavaserver',
help="Run the process under this group. It should be the same group as the wsgi process.")
help="Run the process under this group. It should be the same group as the gunicorn process.")
def drop_priviledges(self, user, group):
try:
......
......@@ -107,10 +107,6 @@ setup(
data_files=[
('/etc/lava-server',
['etc/settings.conf',
'etc/uwsgi.ini',
'etc/debug.wsgi',
'etc/lava-server.wsgi',
'etc/uwsgi.reload',
'etc/env.yaml']),
('/etc/apache2/sites-available',
['etc/lava-server.conf']),
......@@ -119,7 +115,7 @@ setup(
'etc/logrotate.d/lava-master-log',
'etc/logrotate.d/lava-publisher-log',
'etc/logrotate.d/lava-scheduler-log',
'etc/logrotate.d/lava-server-uwsgi-log']),
'etc/logrotate.d/lava-server-gunicorn-log']),
('/usr/share/lava-server',
['instance.template']),
('/usr/share/lava-server',
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment