Trac as a windows service

43 views
Skip to first unread message

Jamie

unread,
Apr 22, 2024, 12:53:45 PMApr 22
to Trac Users
Hi all, 
Does anyone have experience with running trac as a windows service?

I've tried various methods including the python script provided in trac hacks, .bat files etc.

The issue I hit is that it starts trac ok, but stopping it stops the service but tracd keeps running in the background thus trac doesn't stop. 

Any thoughts on how to fix this or working examples would be appreciated. Just need a way to ensure trac starts and stops as a service rather than just using cmd. Stand alone server btw.

Dan

unread,
Apr 22, 2024, 2:03:06 PMApr 22
to Trac Users
I used to use Apache under Windows, but it's difficult to get everything needed for my configurations, and I've since turned to either WSL or full Linux (via Hyper-V).  Using WSL probably isn't a good idea, but I used Windows Task Scheduler to start it at bootup.

I know of people who have used non-sucking service manager to turn general applications into services, but I don't have specific experience with it myself.  I think there are other apps that do something similar.

Good Luck



jiho lee

unread,
Apr 22, 2024, 3:23:32 PMApr 22
to trac-...@googlegroups.com
Hello,

You might want to check out these two articles.


The first article explains how to register your Python program with Windows Services.

The second document describes how to get Trac to work with Gunicorn.

Instead of using the trac -d command to run trac, I think it should work with Gunicorn.

Give it a try and good luck.
------------------------------------------------------------------------------------------------------------
There is a future society, but my future is not what others do.
Dept. of Information Science, Graduate School, Korea National Open University


2024년 4월 23일 (화) 오전 1:53, Jamie <jamiet...@gmail.com>님이 작성:
--
You received this message because you are subscribed to the Google Groups "Trac Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to trac-users+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/trac-users/8842658a-5f35-44f7-a9c3-992ef60797ebn%40googlegroups.com.

Jamie

unread,
Apr 23, 2024, 3:57:26 AMApr 23
to Trac Users
Thanks for the responses, much appreciated. However I'm only using trac standalone server and nothing else. Dan unfortunately NSSM is no longer maintained.

Jiho thanks for the python link - I do have the script and it works to start the service the issue I have is with getting the service to stop while using tracd.

jiho lee

unread,
Apr 23, 2024, 6:52:29 AMApr 23
to trac-...@googlegroups.com
We recommend creating code to run using the waitress API instead of tracd.

------------------------------------------------------------------------------------------------------------
There is a future society, but my future is not what others do.
Dept. of Information Science, Graduate School, Korea National Open University


2024년 4월 23일 (화) 오후 4:57, Jamie <jamiet...@gmail.com>님이 작성:

Jun Omae

unread,
Apr 23, 2024, 8:13:48 AMApr 23
to trac-...@googlegroups.com
I do not recommend using tracd.exe as a Windows service, however you could use IIS with 
HttpPlatformHandler to serve Trac.


--

Jamie

unread,
Apr 23, 2024, 9:34:13 AMApr 23
to Trac Users
Ah ok, Thank you. I'll look into that.

jiho lee

unread,
Apr 23, 2024, 9:37:54 AMApr 23
to trac-...@googlegroups.com
If you are not using IIS, you will need to write python code to replace tracd.

I've included documentation to help you with this in the previous link.

2024년 4월 23일 (화) 오후 10:34, Jamie <jamiet...@gmail.com>님이 작성:

Jun Omae

unread,
Apr 23, 2024, 10:22:34 AMApr 23
to trac-...@googlegroups.com
> If you are not using IIS, you will need to write python code to replace tracd.

No need to write any Python code.

Example for web.config to serve http://localhost/trac
====
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.webServer>
<handlers>
<add name="httpPlatformHandler" path="*" verb="*"
modules="httpPlatformHandler" resourceType="Unspecified" />
</handlers>
<httpPlatform
processPath="<your-venv>\Scripts\tracd.exe"
arguments="-s --port=%HTTP_PLATFORM_PORT%
--basic-auth=*,<your-htpasswd-file>,Trac --base-path=/trac
<your-tracenv>"
stdoutLogEnabled="false"
startupTimeLimit="60"
processesPerApplication="4"
>
<environmentVariables>
</environmentVariables>
</httpPlatform>
</system.webServer>
</configuration>
====
> To view this discussion on the web visit https://groups.google.com/d/msgid/trac-users/CAPCiUfx6JB%2BqMrMswFy-yVhMG7ruuVKWFxcuA3dYSBtNyjxPtA%40mail.gmail.com.
Reply all
Reply to author
Forward
0 new messages