First try at a badges-frontend role for stg.
This commit is contained in:
parent
5053d35c18
commit
4473c17104
5 changed files with 171 additions and 0 deletions
|
@ -24,6 +24,9 @@
|
|||
user: root
|
||||
gather_facts: True
|
||||
|
||||
roles:
|
||||
- /srv/web/infra/ansible/roles/badges-frontend
|
||||
|
||||
vars_files:
|
||||
- /srv/web/infra/ansible/vars/global.yml
|
||||
- ${private}/vars.yml
|
||||
|
|
14
roles/badges-frontend/files/tahrir.conf
Normal file
14
roles/badges-frontend/files/tahrir.conf
Normal file
|
@ -0,0 +1,14 @@
|
|||
Alias /static /usr/share/tahrir/static
|
||||
|
||||
WSGIDaemonProcess tahrir user=tahrir group=tahrir maximum-requests=1000 display-name=tahrir processes=4 threads=4
|
||||
WSGISocketPrefix run/wsgi
|
||||
WSGIRestrictStdout On
|
||||
WSGIRestrictSignal Off
|
||||
WSGIPythonOptimize 1
|
||||
|
||||
WSGIScriptAlias / /usr/share/tahrir/tahrir.wsgi
|
||||
|
||||
<Location />
|
||||
WSGIProcessGroup tahrir
|
||||
</Location>
|
||||
|
15
roles/badges-frontend/files/tahrir.wsgi
Normal file
15
roles/badges-frontend/files/tahrir.wsgi
Normal file
|
@ -0,0 +1,15 @@
|
|||
import sys
|
||||
sys.stdout = sys.stderr
|
||||
|
||||
import __main__
|
||||
__main__.__requires__ = __requires__ = 'tahrir'
|
||||
import pkg_resources
|
||||
pkg_resources.require(__requires__)
|
||||
|
||||
import os
|
||||
os.environ['PYTHON_EGG_CACHE'] = '/var/www/.python-eggs'
|
||||
|
||||
from pyramid.paster import get_app, setup_logging
|
||||
ini_path = '/etc/tahrir/tahrir.ini'
|
||||
setup_logging(ini_path)
|
||||
application = get_app(ini_path, 'main')
|
63
roles/badges-frontend/tasks/main.yml
Normal file
63
roles/badges-frontend/tasks/main.yml
Normal file
|
@ -0,0 +1,63 @@
|
|||
---
|
||||
# Configuration for the tahrir webapp
|
||||
|
||||
- name: install needed packages
|
||||
yum: pkg=$item state=installed
|
||||
with_items:
|
||||
- python-tahrir
|
||||
- python-psycopg2
|
||||
tags:
|
||||
- packages
|
||||
|
||||
- name: copy tahrir app configuration
|
||||
template: >
|
||||
src=$item dest=/etc/tahrir/$item
|
||||
owner=apache group=apache mode=0600
|
||||
with_items:
|
||||
- tahrir.ini
|
||||
tags:
|
||||
- config
|
||||
notify:
|
||||
- restart apache
|
||||
|
||||
- name: copy tahrir wsgi script
|
||||
copy: >
|
||||
src=$item dest=/usr/share/tahrir/$item
|
||||
owner=apache group=apache mode=0644
|
||||
with_items:
|
||||
- tahrir.wsgi
|
||||
tags:
|
||||
- config
|
||||
notify:
|
||||
- restart apache
|
||||
|
||||
- name: copy tahrir httpd config
|
||||
copy: >
|
||||
src=$item dest=/etc/httpd/conf.d/$item
|
||||
owner=apache group=apache mode=0644
|
||||
with_items:
|
||||
- tahrir.conf
|
||||
tags:
|
||||
- config
|
||||
notify:
|
||||
- restart apache
|
||||
|
||||
- name: make badge png directory
|
||||
file: >
|
||||
path=/usr/share/badges/pngs
|
||||
state=directory
|
||||
owner=apache group=apache mode=0755
|
||||
tags:
|
||||
- config
|
||||
- assets
|
||||
|
||||
- name: copy over all our badge images
|
||||
copy: >
|
||||
src=$item
|
||||
dest=/usr/share/badges/pngs/
|
||||
owner=apache group=apache mode=0644
|
||||
with_fileglob:
|
||||
- /srv/web/infra/badges/pngs/*.png
|
||||
tags:
|
||||
- config
|
||||
- assets
|
76
roles/badges-frontend/templates/tahrir.ini
Normal file
76
roles/badges-frontend/templates/tahrir.ini
Normal file
|
@ -0,0 +1,76 @@
|
|||
[server:main]
|
||||
use = egg:pyramid#wsgiref
|
||||
host = localhost
|
||||
port = 80
|
||||
|
||||
[pipeline:main]
|
||||
pipeline =
|
||||
pyramid
|
||||
|
||||
[app:pyramid]
|
||||
|
||||
use = egg:tahrir
|
||||
|
||||
#pyramid.reload_templates = true
|
||||
pyramid.default_locale_name = en
|
||||
pyramid.includes =
|
||||
pyramid_tm
|
||||
|
||||
sqlalchemy.url = postgresql://${tahrirDBUser}:${tahrirDBPassword}@db-tahrir/tahri
|
||||
|
||||
mako.directories=tahrir:templates
|
||||
|
||||
tahrir.admin = ralph
|
||||
tahrir.pngs.uri = /usr/share/tahrir/pngs
|
||||
|
||||
{% if env == 'staging' %}
|
||||
tahrir.title = Fedora Badges (staging!)
|
||||
tahrir.base_url = badges.stg.fedoraproject.org
|
||||
tahrir.openid_identifier = https://id.stg.fedoraproject.org
|
||||
{% else %}
|
||||
tahrir.title = Fedora Badges
|
||||
tahrir.base_url = badges.fedoraproject.org
|
||||
tahrir.openid_identifier = https://id.fedoraproject.org
|
||||
{% endif %}
|
||||
|
||||
session.secret="${tahrirSessionSecret}"
|
||||
|
||||
|
||||
# Begin logging configuration
|
||||
|
||||
[loggers]
|
||||
keys = root, tahrir, sqlalchemy
|
||||
|
||||
[handlers]
|
||||
keys = console
|
||||
|
||||
[formatters]
|
||||
keys = generic
|
||||
|
||||
[logger_root]
|
||||
level = INFO
|
||||
handlers = console
|
||||
|
||||
[logger_tahrir]
|
||||
level = DEBUG
|
||||
handlers =
|
||||
qualname = tahrir
|
||||
|
||||
[logger_sqlalchemy]
|
||||
level = INFO
|
||||
handlers =
|
||||
qualname = sqlalchemy.engine
|
||||
# "level = INFO" logs SQL queries.
|
||||
# "level = DEBUG" logs SQL queries and results.
|
||||
# "level = WARN" logs neither. (Recommended for production systems.)
|
||||
|
||||
[handler_console]
|
||||
class = StreamHandler
|
||||
args = (sys.stderr,)
|
||||
level = NOTSET
|
||||
formatter = generic
|
||||
|
||||
[formatter_generic]
|
||||
format = %(asctime)s %(levelname)-5.5s [%(name)s][%(threadName)s] %(message)s
|
||||
|
||||
# End logging configuration
|
Loading…
Add table
Add a link
Reference in a new issue