Merge "Configuring number of apache processes"

This commit is contained in:
Jenkins 2017-01-30 17:11:55 +00:00 committed by Gerrit Code Review
commit 8dfa7d7297
3 changed files with 20 additions and 1 deletions

View File

@ -104,6 +104,13 @@ Installation
$ ./manage.py make_web_conf --apache --ssl --sslkey=/path/to/ssl/key --sslcert=/path/to/ssl/cert > /etc/apache2/sites-available/horizon.conf
By default the apache configuration will launch a number of apache processes
equal to the number of CPUs + 1 of the machine on which you launch the
make_web_conf command. If the target machine is not the same or if you want
to specify the number of processes, add the --processes option::
$ ./manage.py make_web_conf --apache --processes 10 > /etc/apache2/sites-available/horizon.conf
6. Finally, enable the above configuration and restart the web server::
$ sudo a2ensite horizon

View File

@ -18,7 +18,7 @@
CustomLog {{ LOGDIR }}/{{ PROJECT_NAME }}-access.log combined
WSGIScriptReloading On
WSGIDaemonProcess {{ PROJECT_NAME }}_website
WSGIDaemonProcess {{ PROJECT_NAME }}_website processes={{ PROCESSES }}
WSGIProcessGroup {{ PROJECT_NAME }}_website
WSGIApplicationGroup {{ PROJECT_NAME }}_website
WSGIPassAuthorization On

View File

@ -12,6 +12,7 @@
from __future__ import print_function
import multiprocessing
import os
import re
import socket
@ -74,6 +75,7 @@ context = Context({
'SSLCERT': '/etc/pki/tls/certs/ca.crt',
'SSLKEY': '/etc/pki/tls/private/ca.key',
'CACERT': None,
'PROCESSES': multiprocessing.cpu_count() + 1,
})
context['PROJECT_ROOT'] = os.path.dirname(context['PROJECT_PATH'])
@ -213,6 +215,14 @@ location you desire, e.g.::
"configuration will work only when accessed with "
"the proper hostname (see --hostname).")
)
parser.add_argument(
"--processes",
dest="processes",
help=("Use with the --apache option to define the number of "
"apache processes (by default the number of cpus +1 which "
"is %s on this machine).") % context['PROCESSES'],
metavar="PROCESSES"
)
parser.add_argument(
"-p", "--project",
dest="project",
@ -268,6 +278,8 @@ location you desire, e.g.::
context['CACERT'] = options['cacert']
if options.get('logdir'):
context['LOGDIR'] = options['logdir'].rstrip('/')
if options.get('processes'):
context['PROCESSES'] = options['processes']
if options.get('project'):
context['PROJECT_NAME'] = options['project']
if options.get('hostname'):