Project

General

Profile

TracMirroring » History » Version 3

Lutz Suhrbier, 05/30/2008 06:52 PM
final

1 1 Lutz Suhrbier
2
# Mirroring Trac
3 2 Lutz Suhrbier
4
5 3 Lutz Suhrbier
The motivation for this article is to describe setting up two identical Trac installations accessing the same database. One is to a [Shibboleth protected setup":http://dev.e-taxonomy.eu/trac. The other refers to the "Trac installation for EDIT developers](http://dev.e-taxonomy.eu/trac.)
6 2 Lutz Suhrbier
7
8 3 Lutz Suhrbier
The following sections describe the crucial points setting up a Trac mirror.
9 2 Lutz Suhrbier
10
11
12
## Installing Trac
13 1 Lutz Suhrbier
14 3 Lutz Suhrbier
Trac is programmed in python. So, the following packages needs to be in place before installing Trac.
15 1 Lutz Suhrbier
16 3 Lutz Suhrbier
~~~
17
apt-get install python
18
apt-get install python-mysqldb
19
apt-get install libapache2-mod-python
20
~~~
21 1 Lutz Suhrbier
22 3 Lutz Suhrbier
Furthermore, we need to enable the python module on the Apache server.
23 1 Lutz Suhrbier
24 3 Lutz Suhrbier
~~~
25
a2enmod mod_python
26
~~~
27 1 Lutz Suhrbier
28 3 Lutz Suhrbier
Next, the python setuptools are required to setup python.
29
30
~~~
31
apt-get install python-setuptools
32
~~~
33
34
Now, we are prepared to download the same Trac version as installed on the master site (0.10.4). Then, the software has to be extracted to somewhere and has to be installed running the _setup.py_ script.
35
36
~~~
37
wget http://ftp.edgewall.com/pub/trac/trac-0.10.4.tar.gz
38
tar xvfz trac-0.10.4.tar.gz
39
cd trac-0.10.4
40
python setup.py install
41
~~~
42
43
This should install the Trac system to _/usr/share/trac_.
44
45
46
## Installing plugins
47
48
49
Next, the same trac plugins as on the master must be installed on the slave too.
50
51
52
This can be done by simply copying any _.egg_ files from the master site to the directory _/usr/share/trac/plugins/_
53
54
55
Otherwise, the plugins can be downloaded from e.g. [the trac-hacks plugin page":http://trac-hacks.org/wiki/plugin and installed along the instructions on the "Trac wiki](http://trac.edgewall.org/wiki/TracPlugins.)
56
57
58
Further on, the installed plugins must be enabled within the _[[components]_|section of the trac configuration file. (see [#ConfiguringtheTracMirror Configuring the Trac Mirror]]
59
60
61
Currently, the following plugins have to be installed
62
63
* graphviz-0.6.9-py2.4.egg
64
65
* TracExtendedXmlRpc-0.1-py2.4.egg
66
67
* TracWebAdmin-0.1.2dev_r5753-py2.4.egg
68
69
* TracNavigationMenu-1.0m-py2.4.egg
70
71
* TracXMLRPC-0.1-py2.4.egg
72
73
74
75
## Installing Macros
76
77
Also, the same wiki macros have to be installed on the slave site as on the master.
78
79
80
So, the easiest way is to simply copy these macros from the master site to the directory _/usr/share/trac/wiki-macros/_
81
82
Alternatively, macros can be downloaded from [trac-hacks macros page](http://trac-hacks.org/wiki/macro.)
83
84
85
Currently, the following wiki macros have to be installed
86
87
* CSV
88
89
90
91
## Installing others
92
93
Further on, the current master site relies on several other packages, which should be installed as well
94
95
~~~
96
apt-get install python-docutils
97
apt-get install python-clearsilver
98
apt-get install graphviz
99
apt-get install python-pydot
100
apt-get install librsvg2-bin
101
~~~
102
103
104 1 Lutz Suhrbier
## Configuring the Trac Mirror
105
106 3 Lutz Suhrbier
Since, we like to setup a mirror for the EDIT Developers Wiki, we should get the master's configuration file and copy it into the subdirectory _conf_ of the EDIT project environment within trac (i.e. _/var/www/trac/edit/conf/trac.ini_)
107 1 Lutz Suhrbier
108 3 Lutz Suhrbier
Next, the Trac configuration file needs to be adapted to the mirror's environment. Here are some crucial points to take care off.
109 1 Lutz Suhrbier
110 3 Lutz Suhrbier
 components section::
111 1 Lutz Suhrbier
112 3 Lutz Suhrbier
 Take care to enable any installed plugins or macros here
113 1 Lutz Suhrbier
114 3 Lutz Suhrbier
 graphviz section::
115 1 Lutz Suhrbier
116 3 Lutz Suhrbier
 Create or change the directory given in the variable _cache_dur_
117 1 Lutz Suhrbier
118 3 Lutz Suhrbier
 project section::
119
120
 Adapt the url variable and the location of the icon.
121
122
 trac section::
123
124
 Adapt the database url (_database=postgres://<db_passwd>:<db_userid>@<db_ip>/trac_edit_) and the path to the subversion repository (_repository_dir_). **Attention:** The repository **must** be located at the same path as the master repository. Otherwise, it will not work due to the shared database configuration. Also, it is **not possible** to use *remote repositories*. Thus, a local [[SVNMirroring|Subversion repository mirror]] has to be installed on the mirror site as well.
125
126
127
128
### Subversion mirror
129
130
Please, refer to the [[SVNMirroring|Subversion repository mirror]] article.
131
132
133
134
### Templates
135
136
Additional templates from the EDIT project environment should be copied to _/var/www/trac/edit/templates_.
137
138
139
### htdocs
140
141
Additional htdocs from the EDIT project environment should be copied to _/var/www/trac/edit/htdocs_.
142
143
144
145
## Attachments
146
147
Unfortunately, Trac stores any attachment files locally in the _attachment_ subdirectory of the relating project environment (e.g. _/var/www/trac/edit/attachments_). So, they have to be transferred manually to the mirror site.
148
149
150
 **TODO:** Implement a method to synchronise the attachment file regularly. May [rsync](http://rsync.samba.org/) would be a solution to do this. Another idea is to use the subversion repository to store and access the attachments. Perhaps, there will be already an existing plugin doing this job ?
151
152
153
154
## Enabling Apache
155
156
Enabling Trac as an Apache site can be done by providing a site description e.g. like _/etc/apache2/sites-available/trac_ and to enable the site by
157
158
~~~
159
a2ensite trac
160
~~~
161
162
Here is a valid site description for trac with Shibboleth single sign-on. Make sure to adopt the PythonOption _TracEnv_ and _TracUriRoot_ to your needs.
163
164
~~~
165
<Location /trac>
166
    SetHandler mod_python
167
    PythonHandler trac.web.modpython_frontend
168
    PythonOption TracEnv /var/www/trac/edit
169
    PythonOption TracUriRoot /trac
170
171
    AuthType           shibboleth
172
    ShibRequireSession On
173
    require            valid-user
174
</Location>
175
176
Alias /_sharedtrac "/usr/share/trac/htdocs"
177
Alias /trac_htdocs "/var/www/trac/edit/htdocs"
178
<Directory "/usr/share/trac/htdocs">
179
    Options Indexes MultiViews
180
    AllowOverride None
181
    Order allow,deny
182
    Allow from all
183
</Directory>
184
185
~~~
186
187
Finally, restart apache and hopefully enjoy your trac mirror!