First draft of statscache backend config.

This commit is contained in:
Ralph Bean 2015-11-02 15:25:17 +00:00
parent d6b0908bcf
commit 025f73b606
4 changed files with 127 additions and 2 deletions

View file

@ -63,5 +63,5 @@
handlers:
- include: "{{ handlers }}/restart_services.yml"
#roles:
# TODO -- include statscache/backend here
roles:
- statscache/backend

View file

@ -0,0 +1,35 @@
---
# Configuration for the notifications consumer
- name: install needed packages
yum: pkg={{ item }} state=present
with_items:
- statscache-consumer
- statscache-plugins
- python-psycopg2
- libsemanage-python
tags:
- notifs
- notifs/backend
- name: copy database configuration
template: >
src={{ item }} dest=/etc/fedmsg.d/{{ item }}
owner=fedmsg group=fedmsg mode=0600
with_items:
- statscache.py
notify:
- restart fedmsg-hub
tags:
- notifs
- notifs/backend
- name: copy the alembic configuration for DBAs
template: >
src=alembic.ini dest=/usr/share/statscache/alembic.ini
owner=root group=sysadmin-dba mode=0660
notify:
- restart fedmsg-hub
tags:
- notifs
- notifs/backend

View file

@ -0,0 +1,53 @@
# A generic, single database configuration.
[alembic]
# path to migration scripts
script_location = /usr/share/statscache/alembic/
# template used to generate migration files
# file_template = %%(rev)s_%%(slug)s
# max length of characters to apply to the
# "slug" field
#truncate_slug_length = 40
# set to 'true' to run the environment during
# the 'revision' command, regardless of autogenerate
# revision_environment = false
sqlalchemy.url = postgres://statscache:{{statscache_db_password}}@db01/statscache
# Logging configuration
[loggers]
keys = root,sqlalchemy,alembic
[handlers]
keys = console
[formatters]
keys = generic
[logger_root]
level = WARN
handlers = console
qualname =
[logger_sqlalchemy]
level = WARN
handlers =
qualname = sqlalchemy.engine
[logger_alembic]
level = INFO
handlers =
qualname = alembic
[handler_console]
class = StreamHandler
args = (sys.stderr,)
level = NOTSET
formatter = generic
[formatter_generic]
format = %(levelname)-5.5s [%(name)s] %(message)s
datefmt = %H:%M:%S

View file

@ -0,0 +1,37 @@
import datetime
config = {
"statscache.datagrepper.profile": False,
# Consumer stuff
"statscache.consumer.enabled": True,
"statscache.sqlalchemy.uri": "postgres://statscache:{{statscache_db_password}}@db01/statscache",
# stats models will go back at least this far (current value arbitrary)
"statscache.consumer.epoch": datetime.datetime(year=2015, month=8, day=8),
# stats models are updated at this frequency
"statscache.producer.frequency": datetime.timedelta(seconds=1),
# Configuration of web API
"statscache.app.maximum_rows_per_page": 100,
"statscache.app.default_rows_per_page": 100,
# Turn on logging for statscache
"logging": dict(
loggers=dict(
statscache={
"level": "DEBUG",
"propagate": False,
"handlers": ["console"],
},
statscache_plugins={
"level": "DEBUG",
"propagate": False,
"handlers": ["console"],
},
),
),
}