Set up mote webapp role

This commit is contained in:
Chaoyi Zha 2015-06-10 00:21:49 +00:00
parent 5b606d4a19
commit f5de255fd3
4 changed files with 159 additions and 0 deletions

72
roles/mote/tasks/main.yml Normal file
View file

@ -0,0 +1,72 @@
---
# Configuration for the mote webapp
- name: install needed packages
yum: pkg={{ item }} state=present
with_items:
- mote
tags:
- packages
- name: copy sundry mote configuration
template: src={{ item.file }}
dest={{ item.location }}/{{ item.dest }}
owner=apache group=apache mode=0600
with_items:
- { file: mote_config.py, location: /etc/mote, dest: config.py }
- { file: alembic.ini, location: /etc/nuancier, dest: alembic.ini }
changed_when: "1 != 1"
tags:
- config
notify:
- restart apache
- name: create the cache folder where nuancier creates the thumbnails
action: file state=directory
path=/var/cache/nuancier/cache
owner=apache group=apache mode=0700
tags:
- setup
- name: replace the mote configuration file by the one with the normal user
template: src={{ item.file }}
dest="{{ item.location }}/{{ item.file }}"
owner=apache group=apache mode=0600
changed_when: "1 != 1"
with_items:
- { file: mote_config.py, location: /etc/mote, dest: config.py }
- { file: mote.conf, location: /etc/httpd/conf.d }
- { file: mote.wsgi, location: /usr/share/mote }
tags:
- config
notify:
- restart apache
- restart memcached
- name: set sebooleans so nuancier can talk to the db
action: seboolean name=httpd_can_network_connect_db
state=true
persistent=true
- name: apply selinux type to static files
file: >
dest=/usr/lib/python2.7/site-packages/mote/static/
setype=httpd_sys_content_t
state=directory
recurse=yes
- name: apply selinux type to meetbot files
file: >
dest=/srv/web/meetbot/
setype=httpd_sys_content_t
state=directory
recurse=yes
- name: set sebooleans so apache can use memcached
action: seboolean name=httpd_can_network_memcache
state=true
persistent=true
- name: apply selinux type to the wsgi file
file: >
dest=/usr/share/mote/mote.wsgi
setype=httpd_sys_content_t

View file

@ -0,0 +1,24 @@
# Apache configuration file for mote
Alias /static /usr/lib/python2.7/site-packages/mote/static
WSGIDaemonProcess mote user=apache maximum-requests=1000 display-name=mote processes=2 threads=1
WSGISocketPrefix run/wsgi
WSGIRestrictStdout On
WSGIRestrictSignal Off
WSGIPythonOptimize 1
WSGIScriptAlias / /usr/share/mote/mote.wsgi
<Location />
WSGIProcessGroup mote
<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,24 @@
#-*- 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__ = ['jinja2 >= 2.4']
import pkg_resources
import os
#Set the environment variable pointing to the configuration file
os.environ['MOTE_CONFIG_FOLDER'] = '/etc/mote/'
# The following is only needed if you did not install mote
# as a python module (for example if you run it from a git clone).
# import sys
# sys.path.insert(0, '/path/to/mote/')
# The most import line to make the wsgi working
from mote import app as application
from mote import soke
# Generate cache and store in memcached
soke.run()

View file

@ -0,0 +1,39 @@
'''
Crawler Configuration
'''
log_endpoint = "/srv/web/meetbot"
#log_endpoint = "/home/user/mote/test_data/meetbot"
# Fedora has a "teams" folder which contains
# logs from meetings started with a certain team name
# for instance, `#startmeeting famna` will save in "/teams/famna"
# Folders not in "teams" reflect the channel name of the meeting
log_team_folder = "teams"
# Directories to ignore in crawling the logs.
# These folders are ignored. The "meetbot" folder is
# an infinite loop on Fedora's meetbot instance.
ignore_dir = "meetbot"
# Location where raw logs/minutes are stored (remote location)
meetbot_prefix = "http://meetbot.fedoraproject.org"
# Time (in seconds) after which the log/meeting cache expires
cache_expire_time = 60 * 60 * 1
'''
Development Configuration
'''
enable_debug = True
app_port = 5000
'''
General Configuration
'''
app_host = "127.0.0.1"
admin_groups = ["sysadmin-mote"]
memcached_ip = "127.0.0.1:11211"