Monasca Events REST API
Go to file
Tong Li 7eeacb686a enable microservice
move implementation specific configurations in server.py to
v2/reference module. Making the server.py only responsible
for loading dispatchers which are configured in monasca.conf
file. This change will enable any dispatcher to be loaded
according to the configuration file. For example, to config
two dispatchers to be served on a server, a monasca.conf
file can look like the following:

[DEFAULT]
dispatcher = v2_ref_metrics
dispatcher = v2_ref_alarms

If all the reference dispatchers should be served out of
one server, then the configuration file may look like this:

[DEFAULT]
dispatcher = v2_ref_metrics
dispatcher = v2_ref_alarms
dispatcher = v2_ref_alarm_definitions
dispatcher = v2_ref_events
dispatcher = v2_ref_transforms
dispatcher = v2_ref_notifications

One can use the configuration to load any dispatchers which
may be developed by third party. This way, to load new
dispatchers, one only needs to change the configuration file.

This patch set makes the API server a true miscroservice
server.

Change-Id: I87005f8ff4807e4c818057f1e7866001482a50e1
2014-12-04 14:07:28 -05:00
docs Merge "Adding support to WEBHOOK notification" 2014-11-20 20:55:20 +00:00
etc enable microservice 2014-12-04 14:07:28 -05:00
monasca enable microservice 2014-12-04 14:07:28 -05:00
src Merge "Fixing security issue for deleting alarms" 2014-11-26 16:25:15 +00:00
.coveragerc initial python implementation 2014-09-15 13:18:10 -04:00
.gitignore initial python implementation 2014-09-15 13:18:10 -04:00
.gitreview Get initial build to work. 2014-07-15 15:35:50 -06:00
.testr.conf initial python implementation 2014-09-15 13:18:10 -04:00
LICENSE Added license file 2014-05-01 16:22:11 -07:00
README.md Use new monasca-common package names 2014-10-14 13:00:17 -06:00
babel.cfg initial python implementation 2014-09-15 13:18:10 -04:00
pom.xml Fixes validation of emails and webhooks. Fixed the incorrect indentation as well. Added unit tests as well. 2014-11-21 22:26:35 +01:00
requirements.txt Switch to MySQLdb 2014-11-18 15:19:29 -07:00
setup.cfg enable microservice 2014-12-04 14:07:28 -05:00
setup.py initial python implementation 2014-09-15 13:18:10 -04:00
test-requirements.txt Add alarm history resource 2014-11-17 15:38:47 -07:00
tox.ini Add alarm history resource 2014-11-17 15:38:47 -07:00

README.md

Overview

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

Build

Requires monasca-common from https://github.com/stackforge/monasca-common. Download and do mvn install.

mvn clean install

Usage

java -jar target/monasca-api.jar server config-file.yml

Design Overview

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

python monasca api implementation

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

sudo python setup.py install

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/monasca.ini
/etc/monasca/monasca.conf

Once the configurations are modified to match your environment, you can start up the server by following the following instructions.

To start the server, run the following command:

Running the server in foreground mode
gunicorn -k eventlet --worker-connections=2000 --backlog=1000
         --paste /etc/monasca/monasca.ini

Running the server as daemons
gunicorn -k eventlet --worker-connections=2000 --backlog=1000
         --paste /etc/monasca/monasca.ini -D

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

tox -e pep8

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)

License

Copyright (c) 2014 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.