question on deploying multiple trac instances using .wsgi

29 views
Skip to first unread message

Fernan Aguero

unread,
Feb 8, 2019, 3:10:19 PM2/8/19
to Trac Users
Hi

I have a situation where I think I may benefit from running several trac instances from a single .wsgi script but am confused from reading the docs on what would happen if not all trac instances are accessed in the same way. 

Right now, I'm in a situation where some trac instances are accessed through their own URL/subdomain (e.g. examples trac1 and trac2 below), where some others are accessed behind the same domain (examples trac3-trac5 below), using the TRAC_ENV_PARENT_DIR, as described in the docs.

However, notwithstanding these different access routes, they are all installed and deployed consistently to the same hierarchy of directories. 

What confuses me is that from the point of view of trac-admin, they're all under the same TRAC_ENV_PARENT_DIR.  However from the standpoint of the Apache web sever (the URL used to access the resource), they are not. Maybe there's no reason to be confused?

My setup: 

trac1 
/var/lib/trac/trac1 deployed to /var/www/trac1
accessed at trac.domain1.com

trac2
/var/lib/trac/trac2 deployed to /var/www/trac2
accessed at trac.domain2.com

trac3
/var/lib/trac/trac3 deployed to /var/www/trac3

trac4
/var/lib/trac/trac4 deployed to /var/www/trac4

trac5
/var/lib/trac/trac5 deployed to /var/www/trac5

Summary: 
all trac proj environments live under /var/lib/trac 
all are deployed to /var/www


Question:
Is it OK to just run them all off a single trac.wsgi from e.g. 
/var/www/cgi-bin/?

What would happen with this setup if I try to access e.g.
my.domain3.com/trac/trac1? I'd think this is just an innocuous side-effect ...  

Thanks for sharing your wisdom, 

Cheers,


--
fernan
Message has been deleted

RjOllos

unread,
Feb 11, 2019, 11:56:08 PM2/11/19
to Trac Users
Yes, should work fine. Use the generic trac.wsgi generated by deploy and don't edit it. Instead, set the appropriate environment variables in the Apache configuration. 

You need a VirualHost directive with the ServerName set for each of: trac.domain1.comtrac.domain2.com and my.domain3.com. For the first two you can use "SetEnv trac.env_path ... " to specify the environment dir (assuming you have mod_env), for the third you can use "SetEnv trac.env_parent_dir ... "
 
What would happen with this setup if I try to access e.g.
my.domain3.com/trac/trac1? I'd think this is just an innocuous side-effect ...  

I think it will serve the environment for trac1. However, you can put a ".tracignore" file in trac.env_parent_dir and list the environments to ignore when serving my.domain3.com.

It looks like the .tracignore feature is not documented. I will add some documentation soon.

RjOllos

unread,
Mar 25, 2019, 10:26:44 PM3/25/19
to Trac Users
Reply all
Reply to author
Forward
0 new messages