Index: bin/uwsgi_start
===================================================================
--- bin/uwsgi_start	(revision 5934220e8f050e9340a94fdac726e865b31fea7e)
+++ bin/uwsgi_start	(revision 5934220e8f050e9340a94fdac726e865b31fea7e)
@@ -0,0 +1,24 @@
+#!/bin/sh
+#
+# Start uwsgi, loading the config from the ini file in etc/
+
+
+case "$1" in
+    'staging')
+        uwsgi --ini etc/uwsgi_staging.ini
+        echo "Started uwsgi, check var/log/uwsgi/uwsgi.log for more info"
+        ;;
+    'production')
+        uwsgi --ini etc/uwsgi_production.ini
+        echo "Started uwsgi, check var/log/uwsgi/uwsgi.log for more info"
+        ;;
+    *)
+        if [ $1 ]; then
+            echo "[error] $1 is not a valid environment"
+        else
+            echo "[error] No env name provided"
+        fi
+        echo "Valid env names: staging production"
+        exit 1
+        ;;
+esac
Index: bin/uwsgi_stop
===================================================================
--- bin/uwsgi_stop	(revision 5934220e8f050e9340a94fdac726e865b31fea7e)
+++ bin/uwsgi_stop	(revision 5934220e8f050e9340a94fdac726e865b31fea7e)
@@ -0,0 +1,6 @@
+#!/bin/sh
+#
+# Stop a running uwsgi service, if it has been started
+
+kill -15 `cat var/run/uwsgi.pid`
+echo "Stopped uwsgi"
Index: etc/staging.wsgi
===================================================================
--- etc/staging.wsgi	(revision 5934220e8f050e9340a94fdac726e865b31fea7e)
+++ etc/staging.wsgi	(revision 5934220e8f050e9340a94fdac726e865b31fea7e)
@@ -0,0 +1,8 @@
+import os
+os.environ['CHAMELEON_CACHE'] = '/home/staging/tmp/chameleon'
+os.environ['PYTHON_EGG_CACHE'] = '/home/staging/tmp/egg_cache'
+
+from pyramid.paster import get_app, setup_logging
+ini_path = '/home/staging/repos/OpenWorkouts-current/staging.ini'
+setup_logging(ini_path)
+application = get_app(ini_path, 'main')
Index: etc/uwsgi_staging.ini
===================================================================
--- etc/uwsgi_staging.ini	(revision 5934220e8f050e9340a94fdac726e865b31fea7e)
+++ etc/uwsgi_staging.ini	(revision 5934220e8f050e9340a94fdac726e865b31fea7e)
@@ -0,0 +1,22 @@
+[uwsgi]
+socket = 192.168.1.2:7779
+; stats = 192.168.1.2:8779
+uid = 1001
+gid = 1001
+daemonize = $(PWD)/var/log/uwsgi/uwsgi.log
+pidfile = $(PWD)/var/run/uwsgi.pid
+processes = 2
+threads = 10
+master = true
+lazy = true
+ftok = %p
+virtualenv = $(PWD)/../../env
+env = PYTHON_EGG_CACHE=$(PWD)/../../tmp/egg_cache
+manage-script-name = true
+mount=/=$(PWD)/../../wsgi/ow.wsgi
+; disable requests log (GET/POST)
+disable-logging = true
+; set the log file for all the other logging
+logto = $(PWD)/var/log/uwsgi/uwsgi.log
+; SIGTERM exists, instead of a dirty reload
+die-on-term = true
Index: staging.ini
===================================================================
--- staging.ini	(revision 5934220e8f050e9340a94fdac726e865b31fea7e)
+++ staging.ini	(revision 5934220e8f050e9340a94fdac726e865b31fea7e)
@@ -0,0 +1,64 @@
+###
+# app configuration
+# https://docs.pylonsproject.org/projects/pyramid/en/latest/narr/environment.html
+###
+
+[app:main]
+use = egg:ow
+
+pyramid.reload_templates = false
+pyramid.debug_authorization = false
+pyramid.debug_notfound = false
+pyramid.debug_routematch = false
+pyramid.default_locale_name = en
+
+# ZODB connection
+zodbconn.uri = zeo://%(here)s/var/zeo/zeo.sock?blob_dir=%(here)s/var/zeo/blobs&shared_blob_dir=true&connection_pool_size=20
+
+retry.attempts = 3
+
+###
+# wsgi server configuration
+###
+
+[server:main]
+use = egg:waitress#main
+listen = localhost:9999
+
+###
+# logging configuration
+# https://docs.pylonsproject.org/projects/pyramid/en/latest/narr/logging.html
+###
+
+[loggers]
+keys = root, ow
+
+[handlers]
+keys = filelog, console
+
+[formatters]
+keys = generic
+
+[logger_root]
+level = WARN
+handlers = filelog
+
+[logger_ow]
+level = WARN
+handlers = filelog
+qualname = ow
+
+[handler_console]
+class = StreamHandler
+args = (sys.stderr,)
+level = NOTSET
+formatter = generic
+
+[handler_filelog]
+class = FileHandler
+args = ('%(here)s/var/log/openworkouts.log', 'a')
+level = DEBUG
+formatter = generic
+
+[formatter_generic]
+format = %(asctime)s %(levelname)-5.5s [%(name)s:%(lineno)s][%(threadName)s] %(message)s
Index: var/log/README
===================================================================
--- var/log/README	(revision 5934220e8f050e9340a94fdac726e865b31fea7e)
+++ var/log/README	(revision 5934220e8f050e9340a94fdac726e865b31fea7e)
@@ -0,0 +1,1 @@
+OpenWorkout log files
Index: var/run/README
===================================================================
--- var/run/README	(revision 5934220e8f050e9340a94fdac726e865b31fea7e)
+++ var/run/README	(revision 5934220e8f050e9340a94fdac726e865b31fea7e)
@@ -0,0 +1,1 @@
+PID files for separate process like uwsgi go into this directory
