Run cue-api behind Apache2

Change-Id: I2996e5e749e966bae26ab8c914b4a30cc18ec0c8
This commit is contained in:
Endre Karlson 2015-02-26 09:06:05 -08:00 committed by Min Pae
parent 36ee474588
commit 018f165b33
4 changed files with 93 additions and 1 deletions

View File

@ -33,6 +33,11 @@ auth_opts = [
CONF = cfg.CONF
CONF.register_opts(auth_opts)
cfg.CONF.register_opts([
cfg.BoolOpt('pecan_debug', default=False,
help='Pecan HTML Debug Interface'),
], group='api')
def get_pecan_config():
# Set up the pecan configuration
@ -58,7 +63,7 @@ def setup_app(pecan_config=None, extra_hooks=None):
app = pecan.make_app(
pecan_config.app.root,
static_root=pecan_config.app.static_root,
debug=CONF.debug,
debug=CONF.api.pecan_debug,
force_canonical=getattr(pecan_config.app, 'force_canonical', True),
hooks=app_hooks,
wrap_app=middleware.ParsableErrorMiddleware,

View File

@ -0,0 +1,42 @@
..
Copyright 2015 Hewlett-Packard Development Company, L.P.
Licensed under the Apache License, Version 2.0 (the "License"); you may
not use this file except in compliance with the License. You may obtain
a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
License for the specific language governing permissions and limitations
under the License.
Running Cue API behind Apache2
==============================
.. note::
In this howto we explain how to setup cue-api to run behind a Apache2
instance vs as a process of it's own.
We will assume that cue is available under /opt/stack/cue as it is in
devstack.
Symlink app.wsgi to /var/www
::
$ sudo mkdir /var/www/cue
$ sudo ln -s /opt/stack/cue/cue/api/app.wsgi /var/www/cue
Setup Apache2 config
::
$ sudo cp /opt/cue/etc/apache2/cue.conf /etc/apache2/sites-available
$ sudo a2ensite cue
$ sudo service apache2 reload
You should now have cue-api running under Apache2!

View File

@ -11,6 +11,17 @@ Main
getting-involved
getting-started
How To Guides
=============
.. toctree::
:maxdepth: 1
:glob:
howtos/*
==================
Indices and tables
==================

34
etc/apache2/cue.conf Normal file
View File

@ -0,0 +1,34 @@
# Copyright (c) 2013 New Dream Network, LLC (DreamHost)
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
# This is an example Apache2 configuration file for using the
# cue API through mod_wsgi. This version assumes you are
# running devstack to configure the software.
#
# Copied: ceilometer
Listen 8795
<VirtualHost *>
WSGIDaemonProcess cue-api user=vagrant group=vagrant processes=2 threads=10
WSGIScriptAlias / /var/www/cue/app.wsgi
SetEnv APACHE_RUN_USER vagrant
SetEnv APACHE_RUN_GROUP vagrant
WSGIProcessGroup cue-api
ErrorLog /var/log/apache2/cue_error.log
LogLevel warn
CustomLog /var/log/apache2/cue_access.log combined
</VirtualHost>