Skip to content
This repository
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 126 lines (97 sloc) 4.572 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125
== link:index.html[Index] -> link:cookbook.html[Cookbook]
///////////////////////////////////////////////////////////////////
Last checked:
* Cherokee: 1.2.0
* Trac 0.12
* 2011/02/23
///////////////////////////////////////////////////////////////////

Cookbook: Setting up Trac
-------------------------

This recipe will install link:http://trac.edgewall.org[Trac]: an
integrated SCM and Project Management solution that gets along very
well with Cherokee.

It is written in Python and can work with Cherokee either using HTTP
or SCGI protocols. The recipe will address the second scenario because
it is slightly more complex. Should you wish to run it via HTTP,
Cherokee would only have to relay the requests to Trac acting as an
link:modules_handlers_proxy.html[HTTP reverse proxy] and no other
configuration would be needed on that end.

Trac
~~~~
The software requirements are Python-2.5, easy_install and
SQLite-3.3.4 or above. Flup is also required unless you want to use
the HTTP-proxy method, and SQLite can be replaced by PostreSQL or
MySQL if you wish to do so.

On Debian based Linux distributions, just a couple of commands issued
as `root` would suffice to provide the requirements and install Trac.

.Quick install
----
apt-get install python-genshi python-setuptools python-pysqlite2 python-flup
easy_install Trac
----

The package names could slightly vary on different distributions.

The next thing would be defining a project environment:

.Project creation
----
$ trac-admin /path/to/project initenv
----

Of course, the path should be changed to whatever suits your
needs. You will be prompted for more details.

If you want to configure authentication or simply need more details,
refer to the link:http://trac.edgewall.org/wiki/TracInstall[Trac
installation instructions] on the official site.

Cherokee
~~~~~~~~
The configuration on Cherokee's side is quite simple. In fact, the
configuration of Cherokee is so simple that you can find the
application in the Market and have it deployed within seconds. You
will be asked for the minimal information required, and everything
else will be handled for you.

By now, your Trac installation should be up and running. Try it out!

.Complete Trac installation
image::media/images/cookbook_trac.png[Trac]

If you used the Market, you can skip the rest of the document. It only
details what manual steps must be taken.

You will only need to know that you can spawn Trac as an SCGI process.

.Command to launch Trac
-------
/usr/bin/tracd --single-env --daemonize --protocol=scgi /
--hostname=localhost --port=4433 /path/to/project
-------

You can either start it manually, or better yet, automatically by
letting Cherokee spawn the server whenever it is down.
The process is fairly simple.

First we will set up an link:config_info_sources.html[information
source] with a local interpreter.

.Trac information source
image::media/images/cookbook_trac_info.png[Information source]

.Information sources
[cols="20%,80%",options="header"]
|=========================================================================
|Host |Interpreter
|localhost:4433 |/usr/bin/tracd --single-env --protocol=scgi \
                 --hostname=localhost --port=4433 /path/to/project/
|=========================================================================

If the port was not reachable, the `interpreter` command would be
launched and the process would be reinstantiated. Note that, in the
definition of the information source, you will have to manually launch
the `spawner` if you use a `Remote host` as `Information source`
instead of a `Local interpreter`.

After doing this, we will just have to create a new rule managed by
the SCGI handler to access Trac. It can be created in a new virtual
server, `trac.example.net` for instance, or as a `Directory` rule for
a specific path such as `/trac`.

.Rules
image::media/images/cookbook_trac_rules.png[Rules]

As you can see, we are opting for the first approach and will only
need two rules. The `default` will use the `SCGI handler` as detailed
above, associated to the previously created information source.

.SCGI handler
image::media/images/cookbook_trac_scgi.png[SCGI handler]

The second one will be there to serve the few static files needed to
correctly display the Trac interface. Just create it as `Directory`
type rule for `/chrome/common` and set it to the `Static files`
handler and with a `Document root` that points to the appropriate
files: `/usr/share/trac/htdocs/`

.Static files
image::media/images/cookbook_trac_static.png[Static files]
Something went wrong with that request. Please try again.