Troubleshoot Trac One-Click Install

From DreamHost
Revision as of 14:22, 26 October 2010 by Mrsdonovan (Talk | contribs) (Fixed section headings)

Jump to: navigation, search

Header OCI.png

The One-Click installs of Trac are still evolving, but right of the bat you should follow the instructions that were emailed to you and edit trac.ini. Make sure you set an htdocs directory!


Can I track multiple subversion repositories with one trac installation? Or do I need an install per repository?
Multiple projects in one environment are possible with Trac 0.12, which is in beta test as of May 2010.


Are there good alternatives to htaccess authentication for Dreamhost users?

  • AuthOpenID is a great solution to allow users to authenticate without updating an htaccess file(follow link for install).
  • Another solution is to use the TracAccountManager plugin.
  • Solution 1 is a Hack, and not recommended, see warning below.

Solution 1

Hack taken from:

"It's not the best way (uses basic http auth, no anonymous users and cannot logout without destroying session), but it works..."

  • Find your .htaccess file (it's in the root of wherever you installed your trac project) and add the following lines:
AuthUserFile /home/your_username/svn/your_repository_name.passwd
AuthName "Trac Access"
AuthType Basic
Require valid-user
  • Then you may also need to run:
trac-admin /path/to/trac/project permission add your-username TRAC_ADMIN

See also this useful blog post on this method, including how to deal with the "Missing or invalid form token. Do you have cookies enabled?" error message

Solution 2

This solution is fairly simple and allows users to login using a webpanel and register accounts. You can find more on the TracAccountManager plugin here.

Log in to the shell and type the following commands.

svn checkout
cd 0.11
python bdist_egg
ls dist

You should see something like: TracAccountManager-0.2.1dev_r5836-py2.4.egg inside dist folder


Replace "TRACACCOUNTMANAGERBUILD" with what you saw in the ls dist command

cd ~/PATH/TO/TRAC/conf

Now using your favorite editor you'll need to add the following lines to trac.ini:

password_file = /home/USERNAME/svn/SVNREPO.passwd
password_store = HtPasswdStore

Replace USERNAME with your shell login and SVNREPO with the name of your SVN repository.

Save and exit from the editor. If you've already enabled htaccess with your Trac site you can skip this next command. Otherwise, type the following:

trac-admin .. permission add anonymous TRAC_ADMIN

Important: Remember that you did this and remove it when you are done!

Now go to your Trac site and head to the admin panel. Enable the TracAccountManager plugin, and all the components you like, I'd recommend reading the TracAccountManager plugin wiki for what they do. Specifically though, make sure the LoginModule is checked, and if you want to allow new users, check the RegistrationModule as well.

Click Apply changes.

Next, on the left under the Accounts heading, go to Configuration and change the dropdown next to HtPasswdStore to "1" and click "Save". Now if you go to Users you should see a list of users who have access to your svn.

Now head back to your shell, its time to do one last final edit to the trac.ini file. Open trac.ini in your favorite editor again. Under the "components" section you should see something like this:

acct_mgr.admin.* = enabled
acct_mgr.api.* = enabled
acct_mgr.db.* = enabled
acct_mgr.htfile.* = enabled
acct_mgr.http.* = enabled
acct_mgr.notification.* = enabled
acct_mgr.pwhash.* = enabled
acct_mgr.svnserve.* = enabled
acct_mgr.web_ui.* = enabled

You need to add the following line to the bottom of that list:

trac.web.auth.loginmodule = disabled

Now if you have previously enabled htaccess with trac you'll need to remove the appropriate lines from the .htaccess file. And if you have given anonymous TRAC_ADMIN status, you can remove it through the web panel with the new plugin.

Troubleshooting Problems

  • Take a look at ... wiki/TracPermissions and run trac-admin
  • If your Subversion repository was marked as "private", Trac will enable a browser to anonymous users of your source code.
  • When you login initially trac sets 2 cookies, after a while one cookie is destroyed but you still seem to be able to stay logged in(one of the cookies seems to still be set), but without the ability to save edit pages or the ability to log out, so your totally trapped with a useless system. Error message is:
 Error: Bad Request
 Missing or invalid form token. Do you have cookies enabled?
  • This issue seemed to disappear when I removed an extra '/' from the htdocs_location in trac.ini. I'm not positive that this is the underlying problem, however. -Wtowns
  • I fixed this issue by removing the extra '/' as well. -craymondson
  • If you are using AccoutManager plugin, and your login link disappeared (it happened for me on June 9th, 2010), that is because your server's python was updated to newer version. So, you need to recompile AccountManager python egg and copy that to plugins dir of your trac instance (or whatever you did last time).

Fixing 404 errors for .js files

After the one click install you might receive 404 for .js files. The fix for it is rather simple: add a rewrite condition exclusion for ".js" requests, so they won't go to the fastcgi handler. In order to do that edit the .htaccess file in your trac folder:

 nano ~/{path to your trac directory}/.htaccess

and add the bold line under the regular line:

 RewriteCond $1 !^(.*).png$
 RewriteCond $1 !^(.*).js$

(Ticket #3188777 sent to support regarding this) -AmitayD

This step is not likely required anymore since new installs automatically do this. If you have edited the SVN.passwd file and/or saved it you will need to change the group ownership back to dhapache or permissions of the file to 644 according to dreamhost support. --Ericraue 19:09, 21 January 2010 (UTC)

"Missing or invalid form token. Do you have cookies enabled?"

  • the .htaccess file installed by the one-click install has an error.
  • This blog post outlines how to work around it.

"No handler matched request to /index.php"

Did you recently install an SSL certificate on your domain? For whatever reason, you can now only login to your Trac install through https. Put in your htaccess file the following:

RewriteCond %{SERVER_PORT} 80
RewriteCond %{REQUEST_URI} <trac subdirectory>
RewriteRule ^(.*)$ https://<>/<trac subdirectory>/$1 [R,L]

Replace <trac subdirectory> and <> with something more appropriate. The code will automatically rewrite any http access to https and your Trac login will now work!