~loggerhead-team/loggerhead/trunk-rich

« back to all changes in this revision

Viewing changes to start-loggerhead

  • Committer: John Arbash Meinel
  • Date: 2011-02-10 01:00:32 UTC
  • mto: This revision was merged to the branch mainline in revision 426.
  • Revision ID: john@arbash-meinel.com-20110210010032-3c1ngxr9rlnlla6o
Avoid getting a lazy object error by instantiating an
http transport before we do any other work.
Add a script which works against multiple concurrent services.

Show diffs side-by-side

added added

removed removed

Lines of Context:
13
13
# along with this program; if not, write to the Free Software
14
14
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
15
15
 
16
 
"""A script for starting the loggerhead process."""
 
16
"""
 
17
WARNING! This script has been deprecated and will go away soon!
 
18
A script for starting the loggerhead process.
 
19
"""
17
20
 
18
21
 
19
22
import logging
20
 
import logging.handlers
21
23
from optparse import OptionParser
22
24
import os
23
25
import sys
24
26
import urlparse
25
27
 
 
28
from bzrlib.plugin import load_plugins
26
29
from bzrlib.util.configobj.configobj import ConfigObj
27
30
 
28
31
from paste import httpserver
31
34
 
32
35
from loggerhead import daemon
33
36
from loggerhead.apps.config import Root
34
 
from loggerhead.trace import make_handler, setup_logging
 
37
from loggerhead.trace import setup_logging
35
38
from loggerhead.apps.error import ErrorHandlerApp
36
39
 
37
40
 
38
41
def main():
 
42
    sys.stderr.write('\n\n')
 
43
    sys.stderr.write('WARNING!!! This script has been deprecated by '
 
44
                     'serve-branches, and will be removed in the next '
 
45
                     'release. Please migrate to serve-branches and report '
 
46
                     'any missing features.\n')
 
47
    sys.stderr.write('\n\n')
 
48
 
39
49
    home = os.path.realpath(os.path.dirname(__file__))
40
50
    default_pidfile = os.path.join(home, 'loggerhead.pid')
41
51
    default_configfile = os.path.join(home, 'loggerhead.conf')
92
102
    if not options.foreground:
93
103
        sys.stderr.write('\n')
94
104
        sys.stderr.write('Launching loggerhead into the background.\n')
95
 
        sys.stderr.write('PID file: %s\n' % options.pidfile)
 
105
        sys.stderr.write('PID file: %s\n' % (options.pidfile,))
96
106
        sys.stderr.write('\n')
97
107
 
98
108
        daemon.daemonize(options.pidfile, home)
118
128
            environ['wsgi.url_scheme'] = scheme
119
129
            return orig(environ, start_response)
120
130
 
 
131
    load_plugins()
 
132
 
121
133
    try:
122
134
        httpserver.serve(
123
135
            app, host=server_host, port=server_port,