Get started on the anitya roles for frontend and backend

This commit is contained in:
Pierre-Yves Chibon 2014-09-29 10:26:52 +02:00
parent 68ffb83886
commit c5e7536b4b
7 changed files with 201 additions and 0 deletions

View file

@ -0,0 +1,41 @@
---
# Configuration for the anitya webapp
- name: clean yum metadata
command: yum clean all
tags:
- packages
- name: install needed packages
yum: pkg={{ item }} state=installed
with_items:
- anitya
- python-psycopg2
- libsemanage-python
tags:
- packages
- name: copy sundry anitya configuration
template: src={{ item.file }}
dest={{ item.location }}/{{ item.dest }}
owner=root group=root mode=0600
with_items:
- { file: anitya_admin.cfg, location: /etc/anitya, dest: anitya.cfg }
# - { file: alembic.ini, location: /etc/anitya, dest: alembic.ini }
tags:
- config
- name: create the database scheme
command: /usr/bin/python2 /usr/share/anitya/anitya_createdb.py
environment:
ANITYA_WEB_CONFIG: /etc/anitya/anitya.cfg
- name: Install the configuration file of anitya
template: src={{ item.file }}
dest={{ item.location }}/{{ item.file }}
owner=root group=root mode=0600
with_items:
- { file: anitya.cfg, location: /etc/anitya }
tags:
- config

View file

@ -0,0 +1,26 @@
# Beware that the quotes around the values are mandatory
### Secret key for the Flask application
SECRET_KEY='{{ anitya_secret_key }}'
### url to the database server:
#DB_URL=mysql://user:pass@host/db_name
#DB_URL=postgres://user:pass@host/db_name
DB_URL='postgresql://{{ anitya_db_user }}:{{ anitya_db_pass }}@{{ anitya_db_host }}/{{ anitya_db_name }}'
# List of admins based on their openid
CNUCNU_WEB_ADMINS = [
'http://ralph.id.fedoraproject.org/',
'http://pingou.id.fedoraproject.org/',
]
# Fedora OpenID endpoint
{% if env == 'staging' %}
CNUCNU_WEB_FEDORA_OPENID = 'https://id.stg.fedoraproject.org'
{% else %}
CNUCNU_WEB_FEDORA_OPENID = 'https://id.fedoraproject.org'
{% endif %}
# This is required to fix login
PREFERRED_URL_SCHEME='https'

View file

@ -0,0 +1,26 @@
# Beware that the quotes around the values are mandatory
### Secret key for the Flask application
SECRET_KEY='{{ anitya_secret_key }}'
### url to the database server:
#DB_URL=mysql://user:pass@host/db_name
#DB_URL=postgres://user:pass@host/db_name
DB_URL='postgresql://{{ anitya_db_admin }}:{{ anitya_db_admin_pass }}@{{ anitya_db_host }}/{{ anitya_db_name }}'
# List of admins based on their openid
CNUCNU_WEB_ADMINS = [
'http://ralph.id.fedoraproject.org/',
'http://pingou.id.fedoraproject.org/',
]
# Fedora OpenID endpoint
{% if env == 'staging' %}
CNUCNU_WEB_FEDORA_OPENID = 'https://id.stg.fedoraproject.org'
{% else %}
CNUCNU_WEB_FEDORA_OPENID = 'https://id.fedoraproject.org'
{% endif %}
# This is required to fix login
PREFERRED_URL_SCHEME='https'

View file

@ -0,0 +1,37 @@
---
# Configuration for the anitya webapp
- name: clean yum metadata
command: yum clean all
tags:
- packages
- name: install needed packages
yum: pkg={{ item }} state=installed
with_items:
- anitya
- python-psycopg2
- python-memcached
- libsemanage-python
- httpd
tags:
- packages
- name: Install all the configuration file of anitya
template: src={{ item.file }}
dest={{ item.location }}/{{ item.file }}
owner=apache group=apache mode=0600
with_items:
- { file: anitya.cfg, location: /etc/anitya }
- { file: anitya.conf, location: /etc/httpd/conf.d }
- { file: anitya.wsgi, location: /var/www/, dest: anitya.wsgi }
tags:
- config
notify:
- restart apache
- name: set sebooleans so anitya can talk to the db
action: seboolean name=httpd_can_network_connect_db
state=true
persistent=true

View file

@ -0,0 +1,26 @@
# Beware that the quotes around the values are mandatory
### Secret key for the Flask application
SECRET_KEY='{{ anitya_secret_key }}'
### url to the database server:
#DB_URL=mysql://user:pass@host/db_name
#DB_URL=postgres://user:pass@host/db_name
DB_URL='postgresql://{{ anitya_db_user }}:{{ anitya_db_pass }}@{{ anitya_db_host }}/{{ anitya_db_name }}'
# List of admins based on their openid
CNUCNU_WEB_ADMINS = [
'http://ralph.id.fedoraproject.org/',
'http://pingou.id.fedoraproject.org/',
]
# Fedora OpenID endpoint
{% if env == 'staging' %}
CNUCNU_WEB_FEDORA_OPENID = 'https://id.stg.fedoraproject.org'
{% else %}
CNUCNU_WEB_FEDORA_OPENID = 'https://id.fedoraproject.org'
{% endif %}
# This is required to fix login
PREFERRED_URL_SCHEME='https'

View file

@ -0,0 +1,23 @@
Alias /anitya/static /usr/lib/python2.7/site-packages/anitya/static/
WSGIDaemonProcess anitya user=apache maximum-requests=1000 display-name=anitya processes=2 threads=1
WSGISocketPrefix run/wsgi
WSGIRestrictStdout On
WSGIRestrictSignal Off
WSGIPythonOptimize 1
WSGIScriptAlias /anitya /var/www/anitya.wsgi
<Location />
WSGIProcessGroup anitya
<IfModule mod_authz_core.c>
# Apache 2.4
Require all granted
</IfModule>
<IfModule !mod_authz_core.c>
# Apache 2.2
Order deny,allow
Allow from all
</IfModule>
</Location>

View file

@ -0,0 +1,22 @@
#-*- coding: UTF-8 -*-
# The three lines below are required to run on EL6 as EL6 has
# two possible version of python-sqlalchemy and python-jinja2
# These lines make sure the application uses the correct version.
import __main__
__main__.__requires__ = ['SQLAlchemy >= 0.7', 'jinja2 >= 2.4']
import pkg_resources
import os
## Set the environment variable pointing to the configuration file
os.environ['ANITYA_WEB_CONFIG'] = '/etc/anitya/anitya.cfg'
## The following is only needed if you did not install anitya
## as a python module (for example if you run it from a git clone).
#import sys
#sys.path.insert(0, '/path/to/anitya/')
## The most import line to make the wsgi working
from anitya.app import APP as application