Running Trac as a windows service

127 views
Skip to first unread message

Chris

unread,
Apr 5, 2007, 9:25:58 AM4/5/07
to trac-...@googlegroups.com
I would like to run trac as a windows service.

I'm running
trac 0.10.3.1
tracd
windows 2k

I found an article about this at Trac-hacks.org (http://www.trac-hacks.org/wiki/WindowsServiceScript). I downloaded the script, and the patch to update the script to 0.10.

I can install the service and it shows up as a windows service. When I try to start the service, it fails, with this message in the event log:

The instance's SvcRun() method failed
File "C:\Program Files\Python24\Lib\site-packages\win32\lib\win32serviceutil.py", line 785, in SvcRun
self.SvcDoRun()
File "C:\Program Files\Python24\Scripts\tracservice.py", line 94, in SvcDoRun
self.httpd = self.trac_init()
File "C:\Program Files\Python24\Scripts\tracservice.py", line 143, in trac_init
wsgi_app = TracEnvironMiddleware(dispatch_request,
exceptions.NameError: global name 'dispatch_request' is not defined

Any ideas as to what this means?

Or any suggestions for other ways to do this?

Thanks,

Chris

jmt4b04d4v

unread,
Apr 5, 2007, 5:47:41 PM4/5/07
to Trac Users
Hi, no idea about http://www.trac-hacks.org/wiki/WindowsServiceScript,
(anxious for reading) but I used another tool for installing tracd as
service, NTWrapper (http://www.duodata.de/ntwrapper/), they have a
'''Lite''' dist ''{{{Freeware for noncommercial use}}}''.

I used it first, as I was using a subversion ''version'' prior to
1.4.x, also used with trac with minor effort (I'm migrating to linux
now).

If you're interesed, ask me.

Good luck ;-), jmt4b04d4v

dy20...@sneakemail.com

unread,
Apr 6, 2007, 6:38:31 AM4/6/07
to trac-...@googlegroups.com

This turned out to be an editing error on my part, when manually applying the patch. This script does work as advertised...

Chris

bos...@gmail.com

unread,
Apr 10, 2007, 9:02:21 AM4/10/07
to Trac Users
Hi,
I found this Windows Service Script on track-hacks.org and applied
given patch. Everything looked OK till I tried to login. Error
message showed saying problem with authentication. When running same
environment with tracd with (almost) the same parameters I can log
in. Anybody experiencing something similar?
I also tried but could not find script writer.
Regards,

Erik Bray

unread,
Apr 10, 2007, 9:13:18 AM4/10/07
to trac-...@googlegroups.com
Well what exactly does the error message say? How do you have
authentication configured? When you say "almost" the same parameters,
what parameters are different?

bos...@gmail.com

unread,
Apr 10, 2007, 10:17:53 AM4/10/07
to Trac Users
Erik,
The error message says:

Internal Error
Authentication information not available. Please refer to the
installation documentation.

When I run Trac using tracd command line is:
tracd.py --port 8000 --auth *,f:\trac\users.htdigest,trac -e f:\trac

With tracservice.py :

PYTHON = r'C:\Python24\python.exe'
INSTANCE_HOME = r'f:\trac\eeg'
ENVIRONMENT_HOME = r'f:\trac'
REALM = 'trac'

# Trac options (see C:\Python24\Scripts\tracd)
OPTS = [
#use auth for all projects, hence '*'
( '--auth', (r'*,%s\users.htdigest,%s' % (ENVIRONMENT_HOME,
REALM) ) ),
( '--port', '8000' ),
( '--env-parent-dir', ENVIRONMENT_HOME),
]

LOG_DIR = r'%s\log' % INSTANCE_HOME

# Trac instance(s)
ARGS = [ INSTANCE_HOME, ]


I made users.htdigest using script provided on trac's
wiki TracStandalone.

Thx in advance,

Erik Bray

unread,
Apr 11, 2007, 12:35:51 PM4/11/07
to trac-...@googlegroups.com
Huh, well it seems that error gets raised if the req.remote_user
variable isn't set when logging in.

From trac/web/auth.py:
121 if not req.remote_user:
122 raise TracError(html("Authentication information not
available. "
123 "Please refer to the ",
124 html.a('installation documentation',
125 title="Configuring Authentication",
126 href=req.href.wiki('TracInstall') +
127
"#ConfiguringAuthentication"), "."))

Why it wouldn't be set I'm not sure.

On 4/10/07, bos...@gmail.com <bos...@gmail.com> wrote:
>

bos...@gmail.com

unread,
Apr 11, 2007, 1:07:07 PM4/11/07
to Trac Users
Erik,
Thank you for your time.
I looked also in code but had no clue way this happened i.e. why this
request req is bad. That's way I searched on trac-hacks.org for
author, assuming he could know something more. This script is "stolen"
from Turbo Gears or smth, I guess it needs more tinkering.

Anyway I installed Trac as service using Windows 2003 Resource Kits'
SrvAny.exe
and I can log in.

thanks again.


Erik Bray

unread,
Apr 11, 2007, 1:19:23 PM4/11/07
to trac-...@googlegroups.com
Yeah, I think it's most likely a bug in that script. It looks like it
actually reimplements a large part of tracd's main routine, so there
could be something it's not doing right. I was about to say you
should try to contact the author, but I guess you've already worked it
out ;)

boskom

unread,
May 28, 2007, 4:15:25 AM5/28/07
to Trac Users
Andrew said:
> I couldnt get trac to work using Windows 2003 Resource Kits'
> SrvAny.exe, can you tell me how you did it? I am running Win XP SP2, Python 2.4, tracd > 0.10

I also use Python 2.4, Trac 0.10 on Windows 2003 but it is the same
for XP.
What have I done to enable Trac as Windows service is following:

1. Install Windows 2003 Resource Kits.
* Refer to Help and follow directions for SrvAny.exe
2. Make Service:

c:\> "c:\Program Files\Windows Resource Kits\Tools\instsrv.exe" Trac
"c:\Program Files\Windows Resource Kits\Tools\srvany.exe"

3. Using regedit in HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet
\Services\Trac make key Parameters with new String Value: Application
with value e.g. f:\trac\start-trac.bat
4. Start service using administration tools
5. For additional settings like working directory, parameters,
environment variables refer to Windows 2003 Resource Kit help.


Reply all
Reply to author
Forward
0 new messages