<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta http-equiv="Content-type" content="text/html; charset=utf-8" /> <meta http-equiv="Content-Language" content="en-us" /> <meta name="ROBOTS" content="ALL" /> <meta http-equiv="imagetoolbar" content="no" /> <meta name="MSSmartTagsPreventParsing" content="true" /> <meta name="Keywords" content="cherokee web server httpd http" /> <meta name="Description" content="Cherokee is a flexible, very fast, lightweight Web server. It is implemented entirely in C, and has no dependencies beyond a standard C library. It is embeddable and extensible with plug-ins. It supports on-the-fly configuration by reading files or strings, TLS/SSL (via GNUTLS or OpenSSL), virtual hosts, authentication, cache friendly features, PHP, custom error management, and much more." /> <link href="media/css/cherokee_doc.css" rel="stylesheet" type="text/css" media="all" /> </head> <body> <h2 id="_a_href_index_html_index_a_8594_a_href_cookbook_html_cookbook_a"><a href="index.html">Index</a> → <a href="cookbook.html">Cookbook</a></h2> <div class="sectionbody"> </div> <h2 id="_cookbook_setting_up_trac">Cookbook: Setting up Trac</h2> <div class="sectionbody"> <div class="paragraph"><p>This recipe will install <a href="http://trac.edgewall.org">Trac</a>: an integrated SCM and Project Management solution that gets along very well with Cherokee.</p></div> <div class="paragraph"><p>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 <a href="modules_handlers_proxy.html">HTTP reverse proxy</a> and no other configuration would be needed on that end.</p></div> <h3 id="_trac">Trac</h3><div style="clear:left"></div> <div class="paragraph"><p>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.</p></div> <div class="paragraph"><p>On Debian based Linux distributions, just a couple of commands issued as <tt>root</tt> would suffice to provide the requirements and install Trac.</p></div> <div class="listingblock"> <div class="title">Quick install</div> <div class="content"> <pre><tt>apt-get install python-genshi python-setuptools python-pysqlite2 python-flup easy_install Trac</tt></pre> </div></div> <div class="paragraph"><p>The package names could slightly vary on different distributions.</p></div> <div class="paragraph"><p>The next thing would be defining a project environment:</p></div> <div class="listingblock"> <div class="title">Project creation</div> <div class="content"> <pre><tt>$ trac-admin /path/to/project initenv</tt></pre> </div></div> <div class="paragraph"><p>Of course, the path should be changed to whatever suits your needs. You will be prompted for more details.</p></div> <div class="paragraph"><p>If you want to configure authentication or simply need more details, refer to the <a href="http://trac.edgewall.org/wiki/TracInstall">Trac installation instructions</a> on the official site.</p></div> <h3 id="_cherokee">Cherokee</h3><div style="clear:left"></div> <div class="paragraph"><p>The configuration on Cherokee’s side is quite simple. In fact, the configuration of Cherokee is so simple that you only have to click on the Trac Wizard with Cherokee-Admin. You will be asked for the minimal information required, and everything else will be handled for you.</p></div> <div class="paragraph"><p>By now, your Trac installation should be up and running. Try it out!</p></div> <div class="imageblock"> <div class="content"> <img src="media/images/cookbook_trac.png" alt="media/images/cookbook_trac.png" /> </div> <div class="image-title">Complete Trac installation</div> </div> <div class="paragraph"><p>If you used the Wizard, you can skip the rest of the document. It only details what manual steps must be taken. You might find it interesting to know exactly what the wizard does for you, though.</p></div> <div class="paragraph"><p>You will only need to know that you can spawn Trac as an SCGI process.</p></div> <div class="listingblock"> <div class="title">Command to launch Trac</div> <div class="content"> <pre><tt>/usr/bin/tracd --single-env --daemonize --protocol=scgi / --hostname=localhost --port=4433 /path/to/project</tt></pre> </div></div> <div class="paragraph"><p>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.</p></div> <div class="paragraph"><p>First we will set up an <a href="config_info_sources.html">information source</a> with a local interpreter.</p></div> <div class="imageblock"> <div class="content"> <img src="media/images/cookbook_trac_info.png" alt="media/images/cookbook_trac_info.png" /> </div> <div class="image-title">Trac information source</div> </div> <div class="tableblock"> <table rules="all" width="100%" frame="border" cellspacing="0" cellpadding="4"> <caption class="title">Information sources</caption> <col width="20%" /> <col width="80%" /> <thead> <tr> <th align="left" valign="top">Host </th> <th align="left" valign="top">Interpreter</th> </tr> </thead> <tbody> <tr> <td align="left" valign="top"><p class="table">localhost:4433</p></td> <td align="left" valign="top"><p class="table">/usr/bin/tracd --single-env --daemonize --protocol=scgi \ --hostname=localhost --port=4433 /path/to/project/</p></td> </tr> </tbody> </table> </div> <div class="paragraph"><p>If the port was not reachable, the <tt>interpreter</tt> 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 <tt>spawner</tt> if you use a <tt>Remote host</tt> as <tt>Information source</tt> instead of a <tt>Local interpreter</tt>.</p></div> <div class="paragraph"><p>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, <tt>trac.example.net</tt> for instance, or as a <tt>Directory</tt> rule for a specific path such as <tt>/trac</tt>.</p></div> <div class="imageblock"> <div class="content"> <img src="media/images/cookbook_trac_rules.png" alt="media/images/cookbook_trac_rules.png" /> </div> <div class="image-title">Rules</div> </div> <div class="paragraph"><p>As you can see, we are opting for the first approach and will only need two rules. The <tt>default</tt> will use the <tt>SCGI handler</tt> as detailed above, associated to the previously created information source.</p></div> <div class="imageblock"> <div class="content"> <img src="media/images/cookbook_trac_scgi.png" alt="media/images/cookbook_trac_scgi.png" /> </div> <div class="image-title">SCGI handler</div> </div> <div class="paragraph"><p>The second one will be there to serve the few static files needed to correctly display the Trac interface. Just create it as <tt>Directory</tt> type rule for <tt>/chrome/common</tt> and set it to the <tt>Static files</tt> handler and with a <tt>Document root</tt> that points to the appropriate files: <tt>/usr/share/trac/htdocs/</tt></p></div> <div class="imageblock"> <div class="content"> <img src="media/images/cookbook_trac_static.png" alt="media/images/cookbook_trac_static.png" /> </div> <div class="image-title">Static files</div> </div> </div> <div id="footer"> <div id="footer-text"> </div> </div> </body> </html>