Add the beginning of a role for nuancier.
This commit is contained in:
parent
e186f6feec
commit
8c0bb9b136
4 changed files with 96 additions and 0 deletions
22
roles/nuancier/tasks/main.yml
Normal file
22
roles/nuancier/tasks/main.yml
Normal file
|
@ -0,0 +1,22 @@
|
|||
---
|
||||
# Configuration for the nuancier webapp
|
||||
|
||||
- name: install needed packages
|
||||
yum: pkg=$item state=installed
|
||||
with_items:
|
||||
- nuancier-lite
|
||||
tags:
|
||||
- packages
|
||||
|
||||
- name: copy sundry nuancier configuration
|
||||
template: >
|
||||
src={{ item.file }} dest={{ item.location }}/{{ item.file }}
|
||||
owner=apache group=apache mode=0600
|
||||
with_items:
|
||||
- { file: nuancier.cfg, location: /etc/nuancier }
|
||||
- { file: nuancier.conf, location: /etc/httpd/conf.d }
|
||||
- { file: nuancier.wsgi, location: /usr/share/nuancier }
|
||||
tags:
|
||||
- config
|
||||
notify:
|
||||
- restart apache
|
44
roles/nuancier/templates/nuancier.cfg
Normal file
44
roles/nuancier/templates/nuancier.cfg
Normal file
|
@ -0,0 +1,44 @@
|
|||
# Beware that the quotes around the values are mandatory
|
||||
|
||||
import os
|
||||
|
||||
### Secret key for the Flask application
|
||||
SECRET_KEY='{{ nuancier_secret_key }}'
|
||||
|
||||
### url to the database server:
|
||||
DB_URL='postgres://{{ nuancier_db_user }}:{{ nuancier_db_pass }}@{{ nuancier_db_host }}/{{ nuancier_db_name }}'
|
||||
|
||||
### The FAS groups in which the admin of nuancier-lite are
|
||||
### This can either be a single group or multiple, defined between
|
||||
### parenthesis.
|
||||
ADMIN_GROUP=('sysadmin-nuancier', 'sysadmin-main')
|
||||
|
||||
|
||||
### Static folder
|
||||
### The folder containing the css, javascript as well as the pictures
|
||||
### candidates and the cache of those pictures.
|
||||
### This directory should be somewhere where apache can access, it's
|
||||
### proposed in '/var/www/nuancier'
|
||||
STATIC_FOLDER = '/var/www/nuancier'
|
||||
|
||||
### Pictures folder
|
||||
### The folder in which are located the pictures of the different elections.
|
||||
### This folder does not have to be writable by the application but should be
|
||||
### readable.
|
||||
### /!\ It should be the full path to this folder
|
||||
PICTURE_FOLDER = os.path.join(STATIC_FOLDER, 'pictures')
|
||||
|
||||
### Cache folder
|
||||
### The folder in which the application will generate thumbnails of the pictures
|
||||
### selected for an election.
|
||||
### This folder *must* be *writable* by the application.
|
||||
### /!\ It should be the full path to this folder
|
||||
CACHE_FOLDER = os.path.join(STATIC_FOLDER, 'cache')
|
||||
|
||||
### Size of the thumbnails (keeping the ratio)
|
||||
### In order to reduce the loading page of the election page that might contains
|
||||
### more than hundreds pictures, the application generates thumbnails of each
|
||||
### pictures.
|
||||
### The application will keep the ratio intact and just make sure that either
|
||||
### length or width of the picture fit the length and width specified below.
|
||||
THUMB_SIZE = (256, 256)
|
14
roles/nuancier/templates/nuancier.conf
Normal file
14
roles/nuancier/templates/nuancier.conf
Normal file
|
@ -0,0 +1,14 @@
|
|||
Alias /static /var/www/nuancier/static
|
||||
|
||||
WSGIDaemonProcess nuancier maximum-requests=1000 display-name=nuancier processes=4 threads=4
|
||||
WSGISocketPrefix run/wsgi
|
||||
WSGIRestrictStdout On
|
||||
WSGIRestrictSignal Off
|
||||
WSGIPythonOptimize 1
|
||||
|
||||
WSGIScriptAlias / /usr/share/nuancier/nuancier.wsgi
|
||||
|
||||
<Location />
|
||||
WSGIProcessGroup nuancier
|
||||
</Location>
|
||||
|
16
roles/nuancier/templates/nuancier.wsgi
Normal file
16
roles/nuancier/templates/nuancier.wsgi
Normal file
|
@ -0,0 +1,16 @@
|
|||
#-*- 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['NUANCIER_CONFIG'] = '/etc/nuancier/nuancier.cfg'
|
||||
|
||||
# The most import line to make the wsgi working
|
||||
from nuancier import APP as application
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue