moksha/middleware/middleware.py | 2 production/nginx/moksha.conf | 36 +++ production/orbited.cfg | 37 +++ production/rabbitmq/rabbitmq-codegen-amqp-codegen.patch | 16 + production/rabbitmq/run | 22 ++ production/sample-production.ini | 176 ++++++++++++++++ production/stable-reqs.txt | 72 ++++++ 7 files changed, 360 insertions(+), 1 deletion(-)
New commits: commit c0beda722e33018ba15e41537b53de4a5e84728d Author: Luke Macken lmacken@redhat.com Date: Sun Mar 15 11:33:50 2009 -0400
Make our middleware work with apps that don't have a config or sqlalchemy uri
diff --git a/moksha/middleware/middleware.py b/moksha/middleware/middleware.py index 6056715..972ec24 100644 --- a/moksha/middleware/middleware.py +++ b/moksha/middleware/middleware.py @@ -328,7 +328,7 @@ class MokshaMiddleware(object):
""" for name, app in moksha.apps.items(): - sa_url = app['config'].get('sqlalchemy.url') + sa_url = app.get('config', {}).get('sqlalchemy.url', None) if sa_url: if app['config']['__file__'] == get_moksha_config_path(): # Moksha's apps don't specify their own SA url
commit 733e1be4103a8aab38026080e8d5de366467f3e2 Author: Luke Macken lmacken@redhat.com Date: Sat Mar 14 19:22:35 2009 -0400
Add a production orbited config with epoll enabled
diff --git a/production/orbited.cfg b/production/orbited.cfg new file mode 100644 index 0000000..c4c1eaf --- /dev/null +++ b/production/orbited.cfg @@ -0,0 +1,37 @@ +[listen] +http://:9000 +#https://localhost:443 + +# This enables Orbited's built-in MorbidQ message queue. +# Comment this out if to use your own, eg: RabbitMQ +stomp://:61613 + +[access] +* -> localhost:61613 +* -> irc.freenode.net:6667 + +[global] +# Enables the use of the proxy through the Orbited.TCPSocket JavaScript object. +proxy.enabled = 1 + +#reactor=select # All platforms +reactor=epoll # Linux +#reactor=kqueue # OS X/FreeBSD + +#session.ping_interval = 30 +#session.ping_timeout = 30 + +# this doesn't seem to be working? +# lock this file while running to prevent two daemons from starting +#pid.location = orbited.pid + +#[ssl] +#key=/etc/orbited/ssl.key +#crt=/etc/orbited/ssl.crt + +#[logging] +#debug=STDERR,debug.log +##info=STDERR,info.log +#access=STDERR,info.log +#warn=STDERR,error.log +#error=STDERR,error.log
commit 6308427344e5db0350bf5e0e28c25469cc3c38bd Author: Luke Macken lmacken@redhat.com Date: Sat Mar 14 19:18:51 2009 -0400
Separate out our production configurations and dependencies
diff --git a/production/nginx/moksha.conf b/production/nginx/moksha.conf new file mode 100644 index 0000000..dad866a --- /dev/null +++ b/production/nginx/moksha.conf @@ -0,0 +1,36 @@ +upstream backend { + server 127.0.0.1:8084; +} + +server { + listen 80; + location / { + #ssi on; + proxy_set_header X_FORWARDED_PROTO $scheme; + proxy_set_header X_FORWARDED_HOST $host; + proxy_set_header X_FORWARDED_FOR $remote_addr; + + if ($request_method != GET) { + proxy_pass http://backend; + } + + set $memcached_key $request_uri; + + memcached_pass localhost:11211; + + default_type text/html; + error_page 404 502 = /dynamic; + } + + location /dynamic { + #ssi on; + proxy_set_header X_FORWARDED_PROTO $scheme; + proxy_set_header X_FORWARDED_HOST $host; + proxy_set_header X_FORWARDED_FOR $remote_addr; + proxy_pass http://backend; + } + +} + + + diff --git a/production/rabbitmq/rabbitmq-codegen-amqp-codegen.patch b/production/rabbitmq/rabbitmq-codegen-amqp-codegen.patch new file mode 100644 index 0000000..91e3285 --- /dev/null +++ b/production/rabbitmq/rabbitmq-codegen-amqp-codegen.patch @@ -0,0 +1,16 @@ +--- rabbitmq-codegen/amqp_codegen.py.orig 2009-03-06 19:33:25.000000000 -0500 ++++ rabbitmq-codegen/amqp_codegen.py 2009-03-06 19:33:39.000000000 -0500 +@@ -183,10 +183,11 @@ + fn(amqp_spec) + except: + remove(out_file) +- raise +- finally: + sys.stdout = stdout + f.close() ++ raise ++ sys.stdout = stdout ++ f.close() + + if not len(sys.argv) == 4: + usage() diff --git a/production/rabbitmq/run b/production/rabbitmq/run new file mode 100755 index 0000000..a2d975c --- /dev/null +++ b/production/rabbitmq/run @@ -0,0 +1,22 @@ +#!/bin/bash + +if [ ! -d rabbitmq-server ]; then + hg clone http://hg.rabbitmq.com/rabbitmq-server +fi +if [ ! -d rabbitmq-codegen ]; then + hg clone http://hg.rabbitmq.com/rabbitmq-codegen + patch -p0 < rabbitmq-codegen-amqp-codegen.patch +fi +if [ ! -d rabbitmq-stomp ]; then + hg clone http://hg.rabbitmq.com/rabbitmq-stomp +fi + +pushd /usr/lib*/erlang/erts-*/bin >/dev/null +export PATH=$PATH:`pwd` +popd >/dev/null + +(cd rabbitmq-server; make) +pushd rabbitmq-stomp >/dev/null +make +su -c 'make start_server' +popd >/dev/null diff --git a/production/sample-production.ini b/production/sample-production.ini new file mode 100644 index 0000000..b287a2d --- /dev/null +++ b/production/sample-production.ini @@ -0,0 +1,176 @@ +# +# moksha - Pylons development environment configuration +# +# The %(here)s variable will be replaced with the parent directory of this file +# +# This file is for deployment specific config options -- other configuration +# that is always required for the app is done in the config directory, +# and generally should not be modified by end users. + +[DEFAULT] +debug = false +# Uncomment and replace with the address which should receive any error reports +#email_to = you@yourdomain.com +smtp_server = localhost +error_email_from = paste@localhost + +## +## Moksha-specific configuration options +## + +# Where to store the feed caches. +feed_cache = postgres://moksha:m0ksh4@localhost/moksha_feeds + +# +# Feed Streamer settings +# + +# Max age (in seconds) of each feed in the cache +feed.max_age = 900 + +# Timeout in seconds for the web request +feed.timeout = 30 + +# The number of simultaneous connections +feed.deferred_groups = 10 + +# Where to initialize and store our application databases. %s is the app name. +app_db = sqlite:///%s.db + +# The location of our Orbited server +orbited_host = localhost +orbited_port = 9000 + +# Stomp broker configuration. +stomp_broker = localhost +stomp_port = 61613 +stomp_user = guest +stomp_pass = guest + +# Optional AMQP Broker. +#amqp_broker = guest/guest@localhost + +# Documentation directory +docs_dir = /srv/moksha/docs + +# Moksha chat configuration + +# Use a built-in IRC server +#chat.backend = irc://localhost:9999 +#chat.builtin = true +chat.backend = irc://irc.freenode.net:6667 +chat.rooms = default +chat.default.staticRoomName = moksha +chat.default.roomAssignmentMode = static +chat.default.display.greeting = Moksha Chat +#chat.default.display.floating = true +#chat.default.display.floatingToggle = false +#chat.default.display.width = 400 +#chat.default.display.height = 300 +#chat.default.display.theme = simple +#chat.default.display.resizable = true + +[server:main] +use = egg:Paste#http +host = 0.0.0.0 +port = 8080 + +[app:main] +use = egg:moksha +full_stack = true +#lang = ru +cache_dir = %(here)s/data +beaker.session.key = moksha +beaker.session.secret = somesecret + +beaker.cache.type = ext:memcached +beaker.cache.url = localhost:11211 + +# If you'd like to fine-tune the individual locations of the cache data dirs +# for the Cache data, or the Session saves, un-comment the desired settings +# here: +#beaker.cache.data_dir = %(here)s/data/cache +#beaker.session.data_dir = %(here)s/data/sessions + + + +# pick the form for your database +# %(here) may include a ':' character on Windows environments; this can +# invalidate the URI when specifying a SQLite db via path name +sqlalchemy.url=postgres://moksha:m0ksh4@localhost/moksha +# sqlalchemy.url=mysql://username:password@hostname:port/databasename + + +# If you have sqlite, here's a simple default to get you started +# in development + +#sqlalchemy.url = sqlite:///%(here)s/devdata.db +sqlalchemy.echo = true +sqlalchemy.echo_pool = false +sqlalchemy.pool_recycle = 3600 + +# WARNING: *THE LINE BELOW MUST BE UNCOMMENTED ON A PRODUCTION ENVIRONMENT* +# Debug mode will enable the interactive debugging tool, allowing ANYONE to +# execute malicious code after an exception is raised. +#set debug = false + +# Logging configuration +# Add additional loggers, handlers, formatters here +# Uses python's logging config file format +# http://docs.python.org/lib/logging-config-fileformat.html + +[loggers] +keys = root, moksha, sqlalchemy, tg, auth, pylons + +[handlers] +keys = console + +[formatters] +keys = generic + +# If you create additional loggers, add them as a key to [loggers] +[logger_root] +level = INFO +handlers = console + +[logger_moksha] +level = DEBUG +handlers = +qualname = moksha + +[logger_tg] +level = INFO +handlers = +qualname = tg + +# repoze.who is noisy by default +[logger_auth] +level = WARNING +handlers = +qualname = auth + + +[logger_pylons] +level = INFO +handlers = +qualname = pylons + +[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.) + +# If you create additional handlers, add them as a key to [handlers] +[handler_console] +class = StreamHandler +args = (sys.stderr,) +level = NOTSET +formatter = generic + +# If you create additional formatters, add them as a key to [formatters] +[formatter_generic] +format = %(asctime)s,%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s +datefmt = %H:%M:%S diff --git a/production/stable-reqs.txt b/production/stable-reqs.txt new file mode 100644 index 0000000..b411195 --- /dev/null +++ b/production/stable-reqs.txt @@ -0,0 +1,72 @@ +AddOns==0.6 +Beaker==1.2.3 +BytecodeAssembler==0.3 +DecoratorTools==1.7 +Extremes==1.1.1 +FormEncode==1.2.1 +Genshi==0.5.1 +Jinja==1.2 +Mako==0.2.4 +## FIXME: could not find svn URL in dependency_links for this package: +PEAK-Rules==0.5a1.dev-r2582 +Paste==1.7.2 +PasteDeploy==1.3.3 +PasteScript==1.7.3 +Paver==1.0a4 +Pygments==1.0 +Pylons==0.9.7 +Routes==1.10.3 +SQLAlchemy==0.5.2 +Sphinx==0.5.1 +SymbolType==1.0 +Tempita==0.2 +## FIXME: could not find svn URL in dependency_links for this package: +ToscaWidgets==0.9.5dev-20081026 +TurboGears2==2.0b7 +TurboJson==1.2 +Twisted==8.2.0 +WebError==0.10.1 +WebFlash==0.1a8dev1 +WebHelpers==0.6.4 +WebOb==0.9.6.1 +WebTest==1.1 +#WidgetBrowser==0.1 +boto==1.6b +decorator==3.0.0 +demjson==1.4 +docutils==0.5 +feedcache==1.3 +feedparser==4.1 +lxml==2.2beta4 +meld3==0.6.5 +#-e git+git+ssh://git.fedorahosted.org/git/moksha@03438a82c9b26b700834e9e17d31ab8c6ace8d1a#egg=moksha-0.1dev-py2.5-dev +morbid==0.8.4 +nose==0.10.4 +orbited==0.7.7 +pyprof2calltree==1.1.0 +repoze.profile==0.8 +repoze.squeeze==0.3 +repoze.tm2==1.0a3 +repoze.what==1.0.5 +repoze.what-pylons==1.0rc3 +repoze.what-quickstart==1.0 +repoze.what.plugins.sql==1.0rc1 +repoze.who==1.0.10 +repoze.who-friendlyform==1.0b3 +repoze.who-testutil==1.0b2 +repoze.who.plugins.sa==1.0rc1 +shove==0.1.5 +simplejson==2.0.8 +## FIXME: could not find svn URL in dependency_links for this package: +sqlalchemy-migrate==0.5.1.dev-r479 +stomper==0.2.2 +tg.devtools==2.0b7 +transaction==1.0a1 +tw.forms==0.9.2 +tw.jquery==0.9.4.2 +uuid==1.30 +zope.interface==3.5.0 +zope.sqlalchemy==0.4 +pysqlite==2.4.1 +pyOpenSSL==0.8 +