DEPRECATED, Monasca Log REST API
Go to file
Ken'ichi Ohmichi 4fcbb8e96c Switch to use test_utils.call_until_true
test.call_until_true has been deprecated since Newton on Tempest side,
and now Tempest provides test_utils.call_until_true as the stable
library method. So this patch switches to use the stable method before
removing old test.call_until_true on Tempest side.

Change-Id: Idfbd20c31246ec884ad10f9fce42816ce5f15bf3
2017-02-14 09:32:42 +00:00
devstack Use openstack/monasca-kibana-plugin repo in devstack 2017-02-13 10:43:28 +00:00
doc/source Migrate testing to ostestr and adding docs 2017-01-17 12:53:54 +01:00
documentation Migrate testing to ostestr and adding docs 2017-01-17 12:53:54 +01:00
etc/monasca Integration with oslo.context 2017-01-09 05:36:03 +00:00
monasca_log_api Updated from global requirements 2017-01-26 08:02:03 +01:00
monasca_log_api_tempest Switch to use test_utils.call_until_true 2017-02-14 09:32:42 +00:00
tools Add Constraints support 2016-12-04 18:28:02 +01:00
.coveragerc Migrate testing to ostestr and adding docs 2017-01-17 12:53:54 +01:00
.gitignore Adjust monasca-log-api devstack to Xenial 2016-12-07 10:18:09 +00:00
.gitreview Update .gitreview for new namespace 2015-10-17 22:30:49 +00:00
.testr.conf Migrate testing to ostestr and adding docs 2017-01-17 12:53:54 +01:00
LICENSE Add log api functionality 2015-08-21 14:30:43 +02:00
README.md Fixing filename to start server 2017-02-13 03:50:35 +00:00
requirements.txt Updated from global requirements 2017-01-26 08:02:03 +01:00
setup.cfg Migrate testing to ostestr and adding docs 2017-01-17 12:53:54 +01:00
setup.py Manual sync with requirements 2016-08-26 06:32:07 +02:00
test-requirements.txt Updated from global requirements 2017-02-10 05:51:18 +00:00
tox.ini Make monasca-log-api work with Python 3.5 2017-01-18 13:41:29 +01:00

README.md

Team and repository tags

Team and repository tags

Overview

monasca-log-api is a RESTful API server that is designed with a layered architecture layered architecture.

The full API Specification can be found in docs/monasca-log-api-spec.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
    /etc/monasca/log-api-logging.conf

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-config.ini

Running the server as daemons with Gunicorn:

    gunicorn -k eventlet --worker-connections=2000 --backlog=1000
             --paste /etc/monasca/log-api-config.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
    tox -e py35

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:

    tox -e docs

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

Architectural layers

Requests flow through the following architectural layers from top to bottom:

  • Resource
    • Serves as the entrypoint into the service.
    • Responsible for handling web service requests, and performing structural request validation.
  • Application
    • Responsible for providing application level implementations for specific use cases.
  • Domain
    • Contains the technology agnostic core domain model and domain service definitions.
    • Responsible for upholding invariants and defining state transitions.
  • Infrastructure
    • Contains technology specific implementations of domain services.

Documentation

License

# Copyright 2015 kornicameister@gmail.com
# Copyright 2015-2017 FUJITSU LIMITED
#
# 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.