Welcome Guest | Login

Trac Hosting: How to set up a Trac environment with HostingRails.com



This is a wiki article created by HostingRails users. Please login or signup to make edits.


Trac is a software development tool used to 'trac' issues and record bugs, tasks, changesets, etc.. in an easy wiki format.  It communicates with your SVN respository, so you will need to have multi-user SVN setup so apache owns your respositories.  

Step 1:
Create trac.domain.com via your cPanel

Step 2:
Create a mysql db called trac1 and a dbuser called tracuser1 with a password you can easily remember (be sure to actually assign the user to the database, which is a third step)

Step 3:
Make sure multi-user SVN is setup (or ready to be setup)

Step 4:
[~]# mkdir trac_env1
[~]# trac-admin /home/username/trac_env1 initenv
You will be prompted for some info:

Set project name the same as the repository you're using this for...

database string is mysql://username_tracuser1:dbpassword@localhost/username_trac1

/path/to/svn will be something like /home/username/svn/projectname

Use defaults for the others.

Step 5:
in your ~/public_html/cgi-bin make a file called projectname.cgi and inside it place the following:
#!/usr/local/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2003-2004 Edgewall Software
# Copyright (C) 2003-2004 Jonas Borgström <jonas@edgewall.com>
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution. The terms
# are also available at http://trac.edgewall.org/wiki/TracLicense.
#
# This software consists of voluntary contributions made by many
# individuals. For the exact contribution history, see the revision
# history and logs, available at http://trac.edgewall.org/log/.
#
# Author: Jonas Borgstrom <jonas@edgewall.com>

try:
   import os
   os.environ['TRAC_ENV'] = "/home/username/trac_env1"
   from trac.web import cgi_frontend
   cgi_frontend.run()
except SystemExit:
   raise
except Exception, e:
   import sys
   import traceback

   print>>sys.stderr, e
   traceback.print_exc(file=sys.stderr)

   print 'Status: 500 Internal Server Error'
   print 'Content-Type: text/plain'
   print
   print 'Oops...'
   print
   print 'Trac detected an internal error:', e
   print
   traceback.print_exc(file=sys.stdout)
BE SURE to replace username with your HostingRails account username as indicated in bold.

Step 6:
Make this file chmod 755 (e.g. chmod 755 projectname.cgi) so its executable. In addition, if you have this file in your SVN repository and deploy it via Capistrano, make sure it has the svn property "eol-style" to "native".

Step 7:
Email support with the subject as TRAC VHOST SETUP and include:

1) Your trac domain (URL)
2) the path to your trac_env1
3) the name of your projectname.cgi file - this cannot be renamed afterwards so choose wisely. :)    

They will then get you setup so you can access your Trac via trac.yourdomain.com/trac/projectname.cgi

---

Note, if you wish you have multiple Tracs on your account. Be sure to follow each step of this tutorial again and follow the conventions used to increment the trac_env digits up.  


Optional: Set up TracWebAdmin (for Trac 0.10, which is the current HostingRails version)

Step 8: install TracWebAdmin
from your HostingRails account,
cd ~/tmp
svn co http://svn.edgewall.com/repos/trac/sandbox/webadmin/
cd webadmin
python setup.py egg_info
python setup.py bdist_egg
cp dist/TracWebAdmin-0.1.2dev_r5753-py2.4.egg ~/trac_env1/plugins  (note: the actual filename may be different, depending on the build)

Step 9: give at least one user TRAC_ADMIN rights
cd ~
trac-admin trac_env1/ permission add svnuser TRAC_ADMIN

ALSO: remember to add these two lines to your trac.ini file:
[components]
webadmin.* = enabled

Otherwise the plugin won't be enabled

Optional: Step 10: change default date format
Modify your projectname.cgi file in the following way:
    os.environ['TRAC_ENV'] = "/home/username/trac_env1"
   os.environ['LC_TIME'] = "xx_YY"
   from trac.web import cgi_frontend
where xx_YY is a locale code, for example pl_PL results in ISO 8601 date format (year-month-day).

-------------------
Trac Web Admin appears to now be enabled by default. I didn't need to do steps 8 and 9. Note that the installation also includes AccountManager so that you don't have to set up all accounts yourself. See the plugins tab on the Admin page."



Hello Guest! In order to edit this article you must be an active client with us, please log in or sign up today!






Contributing Author(s):
William
Ledermann
Seth
Gcnovus
Happyspots
Marick
Wojtek