Search code examples
apachepluginsinstallationtrac

Deploying Trac 1.0 with Apache - 'chrome' and 'site' folders MIA


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.


Solution

  • 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).