Trac: Difference between revisions
(→Developers: add python info for mac) |
(→Developers: add trac project create steps) |
||
Line 22: | Line 22: | ||
==== Python ==== | ==== Python ==== | ||
''Mac OS X comes with a pre-installation of Python, usually one or two years old'' [http://wiki.python.org/moin/MacPython/PythonDistributionsForMac]. Mac OS 10.6 (Snow Leopard) has 2.6.1 version of Python. This is adequate for developing Trac on Mac. Trac officially supports any Python version >=2.5 and <3.0 [http://trac.edgewall.org/wiki/0.13/TracInstall#MandatoryDependencies]. | * ''Mac OS X comes with a pre-installation of Python, usually one or two years old'' [http://wiki.python.org/moin/MacPython/PythonDistributionsForMac]. Mac OS 10.6 (Snow Leopard) has 2.6.1 version of Python. This is adequate for developing Trac on Mac. Trac officially supports any Python version >=2.5 and <3.0 [http://trac.edgewall.org/wiki/0.13/TracInstall#MandatoryDependencies]. | ||
* [http://docs.uabgrid.uab.edu/wiki/Python#Custom_Installation_of_Python_Packages_.28.24HOME.29 Configure Python path] for custom install of packages to your $HOME | |||
==== Install Setuptools ==== | |||
* Download setuptools. Choose the appropriate version, ie., for Python-2.6, [http://pypi.python.org/packages/2.6/s/setuptools/setuptools-0.6c11-py2.6.egg#md5=bfa92100bd772d5a213eedd356d64086 download setuptools-0.6c11-py2.6.egg] | |||
<pre> | |||
$ cd ~/Library/Python/2.6/site-packages/ | |||
wget http://pypi.python.org/packages/2.6/s/setuptools/setuptools-0.6c11-py2.6.egg#md5=bfa92100bd772d5a213eedd356d64086 | |||
</pre> | |||
* Make the setuptools package executable | |||
<pre> | |||
chmod +x setuptools-0.6c11-py2.6.egg | |||
</pre> | |||
* Run setuptools as a shell script. This will install '''easy_install''' to ''~/bin'' | |||
<pre> | |||
sh setuptools-0.6c11-py2.6.egg | |||
</pre> | |||
==== Install Trac ==== | |||
* EasyInstall the latest development version of Trac, which is currently, Trac-0.13dev-r10355. '''Note''': the latest dev version of Trac auto-installs its dependencies ie., Genshi, which was not a feature for Trac-0.12 and earlier installs. | |||
<pre> | |||
easy_install Trac==dev | |||
</pre> | |||
* This will install '''tracd''' and '''trac-admin''' to ''~/bin'' | |||
==== Create a Trac project ==== | |||
NOTE: Directory structure mentioned below is just a recommendation. Can customize it to any desired location | |||
* Create a directory for trac meta data | |||
<pre> | |||
mkdir -p ~/project-tmd/sites | |||
</pre> | |||
* Create a directory with project name. Replace ''<myproject>'' | |||
<pre> | |||
project_name=<myproject> | |||
cd ~/project-tmd/sites/ | |||
mkdir $project_name | |||
</pre> | |||
* Create a trac environment for the above project. '''NOTE''': mention full paths when invoking '''trac-admin''' command | |||
<pre> | |||
trac-admin /Users/pnm/project-tmd/sites/myproject1 \ | |||
initenv \ | |||
myproject1 \ | |||
sqlite:db/trac.db \ | |||
git | |||
/home/git/repositories/myproject1sourcecode.git \ | |||
</pre> | |||
* '''git''' corresponds to the ''repository type'', can be mercurial, svn etc. '''/home/git/repositories/myproject1sourcecode.git''' corresponds to the ''source code repository for your project''. This can be a local repository or mounted over a shared file system. | |||
==== Run Trac on Web Server ==== | |||
* ''Trac provides various options for connecting to a "real" web server: CGI, FastCGI, mod_wsgi and mod_python'' [http://trac.edgewall.org/wiki/0.13/TracInstall#RunningTraconaWebServer]. Here we will look at running Trac as a simple CGI script. ''trac.cgi'' is a Python script which loads the appropriate Python code. This can be generated using the '''deploy''' option of ''trac-admin''. | |||
<pre> | |||
trac-admin /Users/pnm/project-tmd/sites/myproject1 deploy /tmp/deploy | |||
cd ~/project-tmd | |||
mv /tmp/deploy/* . | |||
</pre> | |||
* ''trac.cgi'' will be in the '''cgi-bin''' folder inside the given path. Make sure it is executable by your web server. This command also copies static resource files to a '''htdocs''' directory of a given destination. | |||
<pre> | |||
$ cd ~/project-tmd | |||
$ ls | |||
cgi-bin htdocs sites | |||
$ chmod +x cgi-bin/* | |||
</pre> | |||
* Copy ''trac.cgi'' to ~/Sites | |||
<pre> | |||
cp ~/project-tmd/cgi-bin/trac.cgi ~/Sites/. | |||
</pre> | |||
==== XAMPP ==== | ==== XAMPP ==== | ||
# [http://docs.uabgrid.uab.edu/wiki/XAMPP Install and configure XAMPP for Mac] | # [http://docs.uabgrid.uab.edu/wiki/XAMPP Install and configure XAMPP for Mac] | ||
# Edit ''/Applications/XAMPP/etc/httpd.conf'' with the following | |||
# Edit ''/Applications/XAMPP/etc/httpd.conf'' with the following <pre><Location /trac> | <pre> | ||
<Location /trac> | |||
SetEnv TRAC_ENV_PARENT_DIR /Users/pnm/project-tmd/sites | SetEnv TRAC_ENV_PARENT_DIR /Users/pnm/project-tmd/sites | ||
SetEnv PYTHONPATH /Users/pnm/Library/Python/2.6/site-packages | SetEnv PYTHONPATH /Users/pnm/Library/Python/2.6/site-packages | ||
Line 37: | Line 116: | ||
ScriptAlias /trac /Users/pnm/Sites/trac.cgi | ScriptAlias /trac /Users/pnm/Sites/trac.cgi | ||
</pre> | |||
# Start xampp's apache, either through the xampp control or command line. '''NOTE''': xampp needs ''root'' permission to start apache, but will switch to the current user. | |||
<pre> | |||
$ sudo /Applications/XAMPP/xamppfiles/bin/httpd -k start | |||
</pre> | |||
# Browsing to http://localhost/trac should bring up a list of trac projects created within the ~/project-tmd/sites directory (a link for each project). So, for the above created project (myproject1), the url will be http://localhost/trac/myproject1 | |||
== References == | == References == |
Revision as of 21:13, 3 December 2010
Introduction
Trac is an open source, web-based project management and bug-tracking tool (source:Wikipedia). Trac is built on python and provides a web interface to version control systems such as Subversion, Git, Mercurial etc. With its wiki markup capability, Trac serves as a great annotation tool for a project's source code.
End Users
For end users interested in using Trac as a wiki, ticket/bug reporting tool send an email to...
Coming soon, a self servicing web interface for provisioning a trac instance(TBD, a landing page...)
Developers
For developers, interested in customizing Trac (theme, plugins etc), setting up a development environment in one's own space without much fuss and moving parts, is of primary concern. This brings down to two essential components for developing for Trac,
NOTE: Though there may be any number of ways to set up an AMP stack, recommended here is one easy way which has cross-platform capability ie., XAMPP developed by Apache Friends.
Mac OS X
Python
- Mac OS X comes with a pre-installation of Python, usually one or two years old [1]. Mac OS 10.6 (Snow Leopard) has 2.6.1 version of Python. This is adequate for developing Trac on Mac. Trac officially supports any Python version >=2.5 and <3.0 [2].
- Configure Python path for custom install of packages to your $HOME
Install Setuptools
- Download setuptools. Choose the appropriate version, ie., for Python-2.6, download setuptools-0.6c11-py2.6.egg
$ cd ~/Library/Python/2.6/site-packages/ wget http://pypi.python.org/packages/2.6/s/setuptools/setuptools-0.6c11-py2.6.egg#md5=bfa92100bd772d5a213eedd356d64086
- Make the setuptools package executable
chmod +x setuptools-0.6c11-py2.6.egg
- Run setuptools as a shell script. This will install easy_install to ~/bin
sh setuptools-0.6c11-py2.6.egg
Install Trac
- EasyInstall the latest development version of Trac, which is currently, Trac-0.13dev-r10355. Note: the latest dev version of Trac auto-installs its dependencies ie., Genshi, which was not a feature for Trac-0.12 and earlier installs.
easy_install Trac==dev
- This will install tracd and trac-admin to ~/bin
Create a Trac project
NOTE: Directory structure mentioned below is just a recommendation. Can customize it to any desired location
- Create a directory for trac meta data
mkdir -p ~/project-tmd/sites
- Create a directory with project name. Replace <myproject>
project_name=<myproject> cd ~/project-tmd/sites/ mkdir $project_name
- Create a trac environment for the above project. NOTE: mention full paths when invoking trac-admin command
trac-admin /Users/pnm/project-tmd/sites/myproject1 \ initenv \ myproject1 \ sqlite:db/trac.db \ git /home/git/repositories/myproject1sourcecode.git \
- git corresponds to the repository type, can be mercurial, svn etc. /home/git/repositories/myproject1sourcecode.git corresponds to the source code repository for your project. This can be a local repository or mounted over a shared file system.
Run Trac on Web Server
- Trac provides various options for connecting to a "real" web server: CGI, FastCGI, mod_wsgi and mod_python [3]. Here we will look at running Trac as a simple CGI script. trac.cgi is a Python script which loads the appropriate Python code. This can be generated using the deploy option of trac-admin.
trac-admin /Users/pnm/project-tmd/sites/myproject1 deploy /tmp/deploy cd ~/project-tmd mv /tmp/deploy/* .
- trac.cgi will be in the cgi-bin folder inside the given path. Make sure it is executable by your web server. This command also copies static resource files to a htdocs directory of a given destination.
$ cd ~/project-tmd $ ls cgi-bin htdocs sites $ chmod +x cgi-bin/*
- Copy trac.cgi to ~/Sites
cp ~/project-tmd/cgi-bin/trac.cgi ~/Sites/.
XAMPP
- Install and configure XAMPP for Mac
- Edit /Applications/XAMPP/etc/httpd.conf with the following
<Location /trac> SetEnv TRAC_ENV_PARENT_DIR /Users/pnm/project-tmd/sites SetEnv PYTHONPATH /Users/pnm/Library/Python/2.6/site-packages SetEnv PYTHON_EGG_CACHE /Users/pnm/Library/Python/2.6/site-packages </Location> ScriptAlias /trac /Users/pnm/Sites/trac.cgi
- Start xampp's apache, either through the xampp control or command line. NOTE: xampp needs root permission to start apache, but will switch to the current user.
$ sudo /Applications/XAMPP/xamppfiles/bin/httpd -k start
- Browsing to http://localhost/trac should bring up a list of trac projects created within the ~/project-tmd/sites directory (a link for each project). So, for the above created project (myproject1), the url will be http://localhost/trac/myproject1