monasca-log-api/monasca_log_api
Tomasz Trębski 81413d4d52 Moving unversioned endpoints
Healthcheck and Versions are endpoints
that are not available under either
v2.0 and v3.0. Changes includes:
- package reornigazation
- tests adjustments

Change-Id: Ib6bdd4695b5ebf57f27fc8bd311222bb216dd470
2016-03-11 08:21:47 +00:00
..
api Add implementation of /v3.0/logs API 2016-02-24 23:09:39 -07:00
healthcheck Adding healthcheck 2016-02-22 12:49:21 +01:00
middleware Updating requirements.txt 2016-02-10 08:11:36 +01:00
reference Moving unversioned endpoints 2016-03-11 08:21:47 +00:00
tests Moving unversioned endpoints 2016-03-11 08:21:47 +00:00
.gitignore monasca-log-api python 2015-10-08 10:38:12 +02:00
README.md Add support for Apache mod_wsgi 2016-02-25 10:30:22 -07:00
__init__.py monasca-log-api python 2015-10-08 10:38:12 +02:00
server.py Change default config file 2016-03-07 13:56:05 +01:00

README.md

Monasca-log-api Python

Installation

To install the python api implementation, git clone the source and run the following command:

    sudo python setup.py install

Configuration

If it installs successfully, you will need to make changes to the following two files to reflect your system settings, especially where kafka server is located::

    /etc/monasca/log-api-config.conf
    /etc/monasca/log-api-config.ini

Once the configurations are modified to match your environment, you can start up the server using either Gunicorn or Apache.

Start the Server -- for Gunicorn

The server can be run in the foreground, or as daemons:

Running the server in foreground mode with Gunicorn:

    gunicorn -k eventlet --worker-connections=2000 --backlog=1000
             --paste /etc/monasca/log-api.ini

Running the server as daemons with Gunicorn:

    gunicorn -k eventlet --worker-connections=2000 --backlog=1000
             --paste /etc/monasca/log-api.ini -D

Start the Server -- for Apache

To start the server using Apache: create a modwsgi file, create a modwsgi config file, and enable the wsgi module in Apache.

The modwsgi conf file may look something like this, and the site will need to be enabled:

    Listen myhost:8082
    Listen 127.0.0.1:8082

    <VirtualHost *:8082>
        WSGIDaemonProcess log-api processes=4 threads=4 socket-timeout=120 user=log group=log python-path=/usr/local/lib/python2.7/site-packages
        WSGIProcessGroup log-api
        WSGIApplicationGroup log-api
        WSGIScriptAlias / /var/www/log/log-api.wsgi

        ErrorLog /var/log/log-api/wsgi.log
        LogLevel info
        CustomLog /var/log/log-api/wsgi-access.log combined

        <Directory /usr/local/lib/python2.7/site-packages/monasca_log_api>
          Options Indexes FollowSymLinks MultiViews
          Require all granted
          AllowOverride None
          Order allow,deny
          allow from all
          LimitRequestBody 102400
        </Directory>

        SetEnv no-gzip 1

    </VirtualHost>

The wsgi file may look something like this:

    from monasca_log_api.server import get_wsgi_app

    application = get_wsgi_app(config_base_path='/etc/monasca')

Testing

Commandline run

To check the server from the commandline:

    python server.py

PEP8 guidelines

To check if the code follows python coding style, run the following command from the root directory of this project:

    tox -e pep8

Unit Tests

To run all the unit test cases, run the following command from the root directory of this project:

    tox -e py27   (or -e py26, -e py33)

Coverage

To generate coverage results, run the following command from the root directory of this project:

    tox -e cover

Building

To build an installable package, run the following command from the root directory of this project:

  python setup.py sdist

Documentation

To generate documentation, run the following command from the root directory of this project:

make html

That will create documentation under build folder relative to root of the project.