Search code examples
pythonauthenticationtractracd

Starting TRAC server with multiple independant projects


I'm running a TRAC server (tracd service) with 3 independant projects configured. Each project has an own password file in order to keep the user management independant. TRAC is started as a Windows service as described on https://trac.edgewall.org/wiki/0.11/TracStandalone It seems that starting the TRAC server does not work if the string length of the key 'AppParameters' in HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\tracd\Parameters is too long. The maximum key lenght seems to be around 260 characters.

The TRAC server can be started successfully using following 'AppParameters' key:

C:\Python27\Scripts\tracd-script.py -p 80 --auth=',C:\Trac\Moisture\conf\.htpasswd,mt.com' --auth=',C:\Trac\Balances\conf\.htpasswd,mt.com' --auth=',C:\Trac\Weights\conf\.htpasswd,mt.com' C:\Trac\Moisture C:\Trac\Balances C:\Trac\Weights

The TRAC server does not start with following 'AppParameters' key:

C:\Python27\Scripts\tracd-script.py -p 80 --auth='Moisture,C:\Trac\Moisture\conf\.htpasswd,mt.com' --auth='Balances,C:\Trac\Balances\conf\.htpasswd,mt.com' --auth='Weights,C:\Trac\Weights\conf\.htpasswd,mt.com' C:\Trac\Moisture C:\Trac\Balances C:\Trac\Weights

If I add a fourth project it is not possible to start the TRAC server anymore because the string is too long. Is this problem known? Is there a workaround?


Solution

  • You can also shorten your command by using the -e option for specifying the Trac environment parent directory rather than explicitly listing each Environment path.

    A more extensive solution:

    You could run the service with nssm.

    1. Install nssm and put it on your path. I installed using chocolatey package manager: choco install -y nssm.
    2. Create a batch file, run_tracd.bat:

      C:\Python27-x86\Scripts\tracd.exe -p 8080 env1

    3. Run nssm install tracd:

      enter image description here

    4. Run nssm start tracd

    You don't have to do it exactly like this. You could avoid the bat file and enter the parameters in the nssm GUI. I'm not Windows expert, but I like having the bat file because it's easier to edit. However, there may be security concerns that I'm unaware of or it may be more robust to put the parameters in the nssm GUI (you don't have to worry about accidental deletion of the bat file). The following also works for me:

    enter image description here