Skip to content

Commit

Permalink
Merge pull request #234 from Alignak-monitoring-contrib/develop+inits…
Browse files Browse the repository at this point in the history
…cript#92

Add uwsgi file with config file, update uwsgi to write request log in…
  • Loading branch information
mohierf committed Jan 19, 2017
2 parents 26ff14d + 7d8d6da commit aca57da
Show file tree
Hide file tree
Showing 9 changed files with 55 additions and 16 deletions.
1 change: 1 addition & 0 deletions bin/alignak-backend-uwsgi
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
uwsgi --ini /usr/local/etc/alignak-backend/uwsgi.ini
10 changes: 0 additions & 10 deletions bin/alignak_backend.py

This file was deleted.

26 changes: 26 additions & 0 deletions bin/rc.d/alignak-backend
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/bin/sh

# $FreeBSD$
#
# PROVIDE: alignak_backend
# REQUIRE: LOGIN
# KEYWORD: shutdown

. /etc/rc.subr

name="alignak_backend"
rcvar="alignak_backend_enable"

alignak_backend_configfile="/usr/local/etc/alignak-backend/uwsgi.ini"
command="/usr/local/bin/uwsgi"
command_interpreter="/usr/local/bin/python2.7"
pidfile="/var/run/alignak_backend.pid"
command_args="--ini ${alignak_backend_configfile} -d /dev/null --pidfile ${pidfile}"

required_files="${alignak_backend_configfile}"

load_rc_config "${name}"

[ -z "${alignak_backend_enable}" ] && alignak_backend_enable="NO"

run_rc_command "$1"
1 change: 0 additions & 1 deletion bin/run.sh

This file was deleted.

8 changes: 4 additions & 4 deletions docs/configuration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ You define the values for each methods (GET, POST, PATCH, DELETE). An example::
MongoDB access
--------------

You need to fill information about the MongoDB to access it in goal to store and get data.
You need to fill information about the MongoDB used to store and retrieve data.

The hostname of the server where the MongoDB run::

Expand All @@ -99,7 +99,7 @@ The username and password to access MongoDB and the database defined previously:
Timeseries databases
--------------------

To activate the timeseries database feeding from the backend, one need to activate the timeseries scheduler.
To activate the timeseries database feeding from the backend, you need to activate the timeseries scheduler.

Activate the scheduler to push performance data to the configured database::

Expand All @@ -112,8 +112,8 @@ Activate the scheduler to create Grafana panels for the host/service performance
Livesynthesis history
---------------------

To have history of livesynthesis (all 1 minutes) for xx minutes, need to activate the history scheduler.
To have history of livesynthesis (every minute) during xx minutes, you need to activate the history scheduler.

To activate, define number of minutes you want history, *0* to disable, example for 30 minutes::
To activate, define the number of minutes you want to keep history, *0* to disable, example for 30 minutes::

"SCHEDULER_LIVESYNTHESIS_HISTORY": 30
2 changes: 2 additions & 0 deletions docs/install.rst
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ If you want to run with uwsgi, you need to install uwsgi and its python plugin (
Install with pip
----------------

**Note** that installing with pip is not the recommended way for a production server. This is more intended to small environments and development

With pip
~~~~~~~~

Expand Down
3 changes: 3 additions & 0 deletions docs/run.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ Run
Production mode
---------------

**UPDATE NEEDED** As of now an uwsgi configuration file is provided to ease running the backend with uwsgi Web server!

First create a file anywhere on your system, named 'alignakbackend.py' and containing::

from alignak_backend.app import app
Expand All @@ -27,6 +29,7 @@ Maybe, you will have to add the python plugin on some Linux distributions (Debia

Alignak-backend runs on port 80 as specified in arguments, so you should use ``http://ip:80/`` or ``http://ip/`` as a base URL for the API.


Developer mode
--------------

Expand Down
13 changes: 13 additions & 0 deletions etc/uwsgi.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[uwsgi]
http-socket = 0.0.0.0:5000
plugin = python
plugin = logfile
module = alignak_backend.app:app
enable-threads = true
processes = 4
req-logger = file:/usr/local/var/log/alignak_backend-access.log
logger = file:/usr/local/var/log/alignak_backend-error.log
memory-report = true
# uid = root
# guid = root
buffer-size = 32768
7 changes: 6 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@

package = import_module('alignak_backend')

data_files = [('etc/alignak-backend', ['etc/settings.json', 'etc/uwsgi.ini']),
('bin', ['bin/alignak-backend-uwsgi'])]
if 'bsd' in sys.platform or 'dragonfly' in sys.platform:
data_files.append(('etc/rc.d', ['bin/rc.d/alignak-backend']))

setup(
name=__pkg_name__,
version=__version__,
Expand All @@ -46,7 +51,7 @@
packages=find_packages(),

# Where to install distributed files
data_files = [('etc/alignak-backend', ['etc/settings.json'])],
data_files = data_files,

# Dependencies (if some) ...
install_requires=[
Expand Down

0 comments on commit aca57da

Please sign in to comment.