Initial commit, with 'host' server example.

Even that isn't quite complete, but I'm anxious to test other things..
This commit is contained in:
Lance Edgar 2015-11-15 20:22:01 -06:00
commit cf06a1987d
17 changed files with 571 additions and 0 deletions

View file

@ -0,0 +1,3 @@
# -*- mode: apache -*-
WSGIPythonHome /srv/envs/BASELINE

View file

@ -0,0 +1,49 @@
# -*- mode: apache -*-
<VirtualHost *:80>
ServerName pod.localhost
DocumentRoot /srv/pod/
<Directory /srv/pod/>
Options +Indexes
Require all granted
</Directory>
# Forbid directory browsing of POD images; there are just too many.
<DirectoryMatch "^/srv/pod/pictures/gtin/gtin-\d{3}">
Options -Indexes
</DirectoryMatch>
ErrorLog ${APACHE_LOG_DIR}/error.log
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
<VirtualHost *:443>
ServerName pod.localhost
DocumentRoot /srv/pod/
<Directory /srv/pod>
Options +Indexes
Require all granted
</Directory>
# Forbid directory browsing of POD images; there are just too many.
<DirectoryMatch "^/srv/pod/pictures/gtin/gtin-\d{3}">
Options -Indexes
</DirectoryMatch>
SSLEngine on
SSLCertificateFile /etc/ssl/certs/ssl-cert-snakeoil.pem
SSLCertificateKeyFile /etc/ssl/private/ssl-cert-snakeoil.key
ErrorLog ${APACHE_LOG_DIR}/error.log
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/ssl_access.log combined
BrowserMatch "MSIE [2-6]" \
nokeepalive ssl-unclean-shutdown \
downgrade-1.0 force-response-1.0
BrowserMatch "MSIE [17-9]" ssl-unclean-shutdown
</VirtualHost>

View file

@ -0,0 +1,17 @@
#!/bin/bash
# This hook is run after a new virtualenv is created and before it is activated.
cat >$1/pip.conf <<EOF
[global]
allow-external = PIL
allow-unverified = PIL
log-file = $WORKON_HOME/$1/pip.log
EOF
cat >$1/bin/postactivate <<EOF
export PIP_CONFIG_FILE=$WORKON_HOME/$1/pip.conf
EOF
cat >$1/bin/postdeactivate <<EOF
unset PIP_CONFIG_FILE
EOF

View file

@ -0,0 +1,120 @@
######################################################################
#
# Rattail config for 'host' server
#
######################################################################
##############################
# Rattail
##############################
[rattail]
timezone.default = America/Chicago
[rattail.config]
configure_logging = true
[rattail.db]
default.url = postgresql://rattail:%(password_postgresql_rattail)s@localhost/rattail
[rattail.mail]
smtp.server = localhost
templates = rattail:templates/mail
default.from = rattail@localhost
default.to = root@localhost
default.subject = [Rattail] Automated email
[rattail.pod]
pictures.gtin.root_url = http://pod.localhost/pictures/gtin
pictures.gtin.root_path = /srv/pod/pictures/gtin
####################
# alembic
####################
[alembic]
script_location = rattail.db:alembic
version_locations = rattail.db:alembic/versions
##############################
# Logging
##############################
[loggers]
keys = root, exc_logger, beaker, txn, sqlalchemy, django_db, flufl_bounce
[handlers]
keys = file, console, email
[formatters]
keys = generic, console
[logger_root]
handlers = file, console
level = DEBUG
[logger_exc_logger]
qualname = exc_logger
# Set this to 'email' in order to enable the Pyramid exception logger.
handlers =
level = ERROR
[logger_beaker]
qualname = beaker
handlers =
# By default the 'beaker' logger is a bit noisy, this helps.
level = INFO
[logger_txn]
qualname = txn
handlers =
# By default the 'txn' logger is a bit noisy, this helps.
level = INFO
[logger_sqlalchemy]
qualname = sqlalchemy.engine
handlers =
# Uncomment this to make SQLAlchemy log the SQL as it is executed.
#level = INFO
[logger_django_db]
qualname = django.db.backends
handlers =
# If you use the Django ORM at all, this will help to cut down on logging
# noise. Set this to DEBUG if you do wish Django to log the SQL as it is
# executed.
level = INFO
[logger_flufl_bounce]
qualname = flufl.bounce
handlers =
# By default the 'flufl.bounce' logger is a bit noisy, this helps.
level = WARNING
[handler_file]
class = handlers.RotatingFileHandler
args = ('/var/log/rattail/rattail.log', 'a', 1000000, 20, 'utf_8')
formatter = generic
[handler_console]
class = StreamHandler
args = (sys.stderr,)
formatter = console
[handler_email]
class = handlers.SMTPHandler
args = ('localhost', 'rattail@localhost', ['root@localhost'], "[Rattail] Logging")
formatter = generic
level = ERROR
[formatter_generic]
format = %%(asctime)s %%(levelname)-5.5s [%%(name)s][%%(threadName)s] %%(funcName)s: %%(message)s
datefmt = %%Y-%%m-%%d %%H:%%M:%%S
[formatter_console]
format = %%(levelname)-5.5s [%%(name)s][%%(threadName)s] %%(message)s

View file

@ -0,0 +1,40 @@
# -*- mode: apache -*-
WSGIDaemonProcess rattail user=rattail group=rattail
<VirtualHost *:80>
ServerName rattail.localhost
WSGIScriptAlias / /srv/envs/rattail/app/rattail.wsgi
<Directory /srv/envs/rattail/app/>
WSGIProcessGroup rattail
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
<VirtualHost *:443>
ServerName rattail.localhost
WSGIScriptAlias / /srv/envs/rattail/app/rattail.wsgi
<Directory /srv/envs/rattail/app/>
WSGIProcessGroup rattail
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/ssl_access.log combined
SSLEngine on
SSLCertificateFile /etc/ssl/certs/ssl-cert-snakeoil.pem
SSLCertificateKeyFile /etc/ssl/private/ssl-cert-snakeoil.key
BrowserMatch "MSIE [2-6]" \
nokeepalive ssl-unclean-shutdown \
downgrade-1.0 force-response-1.0
BrowserMatch "MSIE [17-9]" ssl-unclean-shutdown
</VirtualHost>

View file

@ -0,0 +1,9 @@
# -*- coding: utf-8; mode: python -*-
from __future__ import unicode_literals
import site
site.addsitedir('/srv/envs/rattail/lib/python2.7/site-packages')
from pyramid.paster import get_app
application = get_app('/srv/envs/rattail/app/web.conf')

View file

@ -0,0 +1,44 @@
######################################################################
#
# Tailbone Website
#
######################################################################
##############################
# Rattail
##############################
[rattail.config]
include = %(here)s/rattail.conf
####################
# Pyramid
####################
[app:main]
use = egg:Tailbone
pyramid.reload_templates = true
pyramid.debug_all = true
pyramid.default_locale_name = en
pyramid.includes = pyramid_debugtoolbar
beaker.session.type = file
beaker.session.data_dir = %(here)s/sessions/data
beaker.session.lock_dir = %(here)s/sessions/lock
beaker.session.secret = some-gobbledy-gook
beaker.session.key = rattail
# Hack so rattail can find this file from within WSGI app.
edbob.config = %(here)s/web.conf
##############################
# Logging
##############################
[handler_file]
args = ('/srv/envs/rattail/app/log/web.log', 'a', 1000000, 20, 'utf_8')