2

I just installed a copy of Trac 1.0 using easy_install-2.6, but am having trouble deciphering the "Deploy Trac" section of the Install documentation.

After issuing easy_install-2.6 Trac=1.0, I then created my environment as so:

trac-admin /www/virtualhosts/trac initenv

Next, I set permissions:

chown -R apache.apache /www/virtualhosts/trac/

My /etc/httpd/conf.d/trac.conf file looks like this:

<Location /trac>
   SetHandler mod_python
   PythonHandler trac.web.modpython_frontend
   # "/www/virtualhosts/svn/trac" is the folder you gave to trac-admin initenv earlier
   PythonOption TracEnv /www/virtualhosts/trac
   # "/trac" is the same as the Location above
   PythonOption TracUriRoot /trac
   # "/tmp" should be some writable temporary directory
   SetEnv PYTHON_EGG_CACHE /tmp 
   # "trac" can be any string, but must be the same for all
   # Trac instances on the same Apache install
   PythonInterpreter trac
</Location>
<Location /trac/login>
   AuthType Basic
   AuthName "Trac User"
   AuthUserFile /www/virtualhosts/trac/conf/trac.htpasswd
   Require valid-user
</Location>

I reloaded the httpd config with:

service httpd reload

Seeing no errors, I opened up the Trac installation by pointing my browser to http://my.site/trac/. The Trac application loads OK.

In the documentation, there is a section on Deploying Trac. This is where I am a little fuzzy. Is my installation of trac not already deployed? Or is this an additional step?

Second, under Mapping Static Resources, the documentation explains how to alias two directories: chrome, and site. At the beginning of the Apache ScriptAlias example the docs provide this command:

trac-admin /var/trac/env deploy /path/to/trac/htdocs/common

I do not have /var/trac/env on my system. I cannot find where this directory was created, unless it was supposed to have been set up during initial installation of Trac 1.0.

Can someone explain what needs to happen to get the chrome/site directories created? I understand these are aliased with Apache, but I'm not getting the command I quoted right above, where trac-admin uses something in /var/trac/env. That directory doesn't exist, so I am unable to issue that deploy command.

I will need the chrome/site aliases working in order to install a plugin.

a coder
  • 7,530
  • 20
  • 84
  • 131

2 Answers2

4

For one thing, don't use mod_python. It's not being maintained any longer and it has some known issues. Setting up your server to use WSGI will give you a much better experience.

Regarding the deploy command in particular, the Trac documentation could indeed be a bit more clear. I believe both of those directory paths are just placeholders and don't have anything to do with the paths used in the documentation up to this point. They're merely there to match up with the paths used in the config file examples that follow it.

Based on the information you gave and my notes from when I set up my Trac system, try this command instead:

trac-admin /www/virtualhosts/trac deploy /www/virtualhosts/trac/deploy

That should create a deploy subdirectory in your Trac directory and populate it with "cgi-bin" and "htdocs" subfolders. From there, simply modify your Apache config files depending on what type of deployment you are doing (more details on the FastCGI and WSGI pages).

bta
  • 43,959
  • 6
  • 69
  • 99
  • and I see the `trac.wsgi` file under cgi-bin. Thanks. – a coder Oct 08 '12 at 11:36
  • Ok - I give up. After enabling mod_wsgi, apache returned segmentation faults. I'd really love if this project were written in PHP, and that it came with a WYSIWIG editor by default. – a coder Oct 08 '12 at 12:51
  • @a coder- I agree that the text-based configuration can be a bit annoying. A segfault sounds like your problem might be with your Apache setup and not with Trac. What OS are you running? – bta Oct 08 '12 at 13:14
  • RHEL 5 with Apache2. Trac 1.0 was installed with easy_install-2.6. I installed python26-mod_wsgi (standard mod_wsgi produced errors in checkconfig). – a coder Oct 08 '12 at 13:16
  • Commenting out the mod_wsgi configurations in apache's config files stops the Segmentation faults. This is an existing web server which works fine otherwise. – a coder Oct 08 '12 at 13:51
  • 1
    @acoder- Make sure that Apache is **not** still trying to load `mod_python`. There are known issues when both `mod_python` and `mod_wsgi` are activated at the same time. The [WSGI docs](http://code.google.com/p/modwsgi/wiki/InstallationIssues) say that this is even more of a problem on older OSes. – bta Oct 08 '12 at 21:36
  • I removed mod_python and python25-mod_python (uninstalled via package manager), tested and reloaded config, and still get seg fault errors. – a coder Oct 09 '12 at 10:48
2

/var/trac/env was meant /path/to/trac-env, that translates in your case to /www/virtualhosts/svn/trac - the real place of your "Trac enviroment" on disc.

The deploy directive actually creates new directories and extracts static content into it, Trac's als well as Trac plugin resources as you already know. You may call it repeatedly, whenever you update trac/htdocs content. And you can even use one such trac/htdocs/common for multiple Trac envs served by the same Trac version. Just make sure to check directory permissions to ensure read access from the web-server process.

chrome/site is not a real directory at all, just a reference to directory <trac-env>/htdocs.

Still there are some plugins, that need to get unpacked to work correctly, so you'll need to setup a cache directory too.

hasienda
  • 2,390
  • 1
  • 13
  • 16