Changes between Version 23 and Version 24 of TracOnGentoo
- Timestamp:
- Mar 21, 2005, 10:37:42 AM (19 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
TracOnGentoo
v23 v24 36 36 I wanted to use Trac for each development project I had, and configure the Apache 2 webserver on my Gentoo Linux box to create a (name-based) virtual host that would hold every Trac instance (more information on virtual hosts can be found here). The following is what I did, as root, to make the whole thing work. 37 37 38 Say the development vhost is known as dev.domain.tld. Basically I wanted to access to each project website via http://dev.domain.tld/projectX/. 39 1. Emerging Trac 38 Say the development vhost is known as dev.domain.tld. Basically I wanted to access to each project website via http://dev.domain.tld/projectX/. 39 40 === 1. Emerging Trac === 40 41 41 42 Since mod_python support is a new feature of 0.7.1 and is still experimental, I'm not going to use it and I'll stick with a simple CGI installation. You'll see that using a CGI installation together with webapp-config on a single vhost causes a restriction: the version of every Trac instance has to be unique. Using mod_python may throw away this restriction, I'll update this document as soon as I test it. 42 43 {{{ 43 44 emerge trac 44 45 }}} 45 46 Obviously, I had to edit /etc/portage/package.keywords to make stuff available to Portage, because I'm running a stable (x86) version of Gentoo. 46 47 48 {{{ 47 49 app-text/silvercity ~x86 48 50 dev-libs/clearsilver ~x86 49 51 www-apps/trac ~x86 50 51 2. Installing each instance of Trac 52 }}} 53 54 === 2. Installing each instance of Trac === 52 55 53 56 Say I have now a bunch of projects, known as project1, project2, ... I use the webapp-config tool to install each instance of Trac 0.7.1: 54 57 {{{ 55 58 webapp-config -I -h dev.domain.tld -d project1/trac trac 0.7.1 56 59 webapp-config -I -h dev.domain.tld -d project2/trac trac 0.7.1 57 60 ... 61 }}} 58 62 59 63 Don't forget the /trac part for the directory path. … … 62 66 63 67 Furthermore, a symlink (or hardlink) to trac.cgi is created each time in /var/www/dev.domain.tld/cgi-bin/, regardless of the instance. This webapp-config issue can be restricting if you want to install different versions of Trac on the same vhost, because this way you get only one trac.cgi per vhost. As a result, you need to install the same version of Trac everywhere on your vhost. 64 3. Setting up Subversion repositories and Trac environments 68 69 === 3. Setting up Subversion repositories and Trac environments === 65 70 66 71 Now, let's create Subversion repositories, one for each project we have. 67 3.1. Creating Subversion repositories 72 ==== 3.1. Creating Subversion repositories ==== 68 73 69 74 Let's say we want our repositories to live under /var/svn/. Issue the following commands to create a repository for project1: … … 79 84 }}} 80 85 Repeat these steps for each project you have. 81 3.2. Creating Trac environments 86 87 ==== 3.2. Creating Trac environments ==== 82 88 83 89 Each project needs a Trac environment too, and we want them to live under /var/lib/trac/. If it doesn't already exist, we create the directory: … … 94 100 }}} 95 101 Repeat the above steps for each project you have. 96 4. Configuring Apache 102 103 === 4. Configuring Apache === 97 104 98 105 Here is my configuration for the name-based vhost. 99 4.1. Vhost configuration 106 ==== 4.1. Vhost configuration ==== 100 107 101 108 The first part of the configuration is relative to the vhost itself: … … 123 130 }}} 124 131 Here I set the name-based vhost and the access policies. Note that +Indexes on htdocs/ isn't needed; however, in case webapp-config created symlinks, +FollowSymLinks is necessary, both on htdocs/ and cgi-bin/. 125 4.2. Per-project configuration 132 133 ==== 4.2. Per-project configuration ==== 126 134 127 135 Next, there are per-project specific directives that define a project. This example has to be repeated for each project. … … 168 176 }}} 169 177 As you can see, I make a big use of Locations and Aliases. Now, some comments. 170 4.2.1. Trac stuff 178 179 ===== 4.2.1. Trac stuff ===== 171 180 172 181 We need several directives to make Trac work. The first thing is to set the TRAC_ENV environment variable. This variable indicates to trac.cgi the location of the Trac environment corresponding to project1 in the filesystem. Actually, I'm storing every Trac environment under /var/lib/trac/, so the projectX Trac environment can be found under /var/lib/trac/projectX/. … … 208 217 }}} 209 218 Ok, that should be enough to use Trac. Point a browser to http://dev.domain.tld/project1 and voila. 210 4.2.2. External components to Trac 219 220 ===== 4.2.2. External components to Trac ===== 211 221 212 222 Then I felt the need to add external pages to Trac, like a Doxygen component that would contain the generated documentation from the code source of project1. I wanted to find this documentation under /project1/dox. … … 241 251 242 252 Instructions for limiting the write access to the repository can be found on the SVN Book. I'm using the same authentication scheme than the previous one, to be consistent between Trac users and SVN users. 243 4.2.3. Integrating these external components inside Trac 253 254 ===== 4.2.3. Integrating these external components inside Trac ===== 244 255 245 256 We can use the per-project templates of Trac to integrate, for example, the Doxygen documentation inside Trac. They are located under /var/lib/trac/project1/templates/. We may want to insert a link to /project1/dox in the header, and have the following site_header.cs: … … 262 273 }}} 263 274 This way, we can create a /var/www/dev.domain.tld/htdocs/project1/trac/css/project1.css file (among with symlinks), and personalize the Trac layout. These per-projects file won't be deleted by webapp-config, so it's a good thing. 264 5. Conclusion 275 276 === 5. Conclusion === 265 277 266 278 By copy/pasting the configuration for one project, we can set up as many projects as we want, each with their own web space, Subversion access, authentication scheme (users referential and authentication method) and layout.