Project

General

Profile

TracMirroring » History » Version 6

Lutz Suhrbier, 05/30/2008 07:05 PM

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 6 Lutz Suhrbier
Trac is programmed in python, runs on Apache2, relies on a subversion repository and our mirror site is running against a postgres database. So, the following packages needs to be in place before installing Trac.
15 1 Lutz Suhrbier
16 3 Lutz Suhrbier
~~~
17 1 Lutz Suhrbier
apt-get install python
18
apt-get install libapache2-mod-python
19 6 Lutz Suhrbier
apt-get install python-psycopg2
20
apt-get install python-subversion
21 3 Lutz Suhrbier
~~~
22 1 Lutz Suhrbier
23 3 Lutz Suhrbier
Furthermore, we need to enable the python module on the Apache server.
24 1 Lutz Suhrbier
25 3 Lutz Suhrbier
~~~
26
a2enmod mod_python
27
~~~
28 1 Lutz Suhrbier
29 3 Lutz Suhrbier
Next, the python setuptools are required to setup python.
30
31
~~~
32
apt-get install python-setuptools
33
~~~
34
35
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.
36
37
~~~
38
wget http://ftp.edgewall.com/pub/trac/trac-0.10.4.tar.gz
39
tar xvfz trac-0.10.4.tar.gz
40
cd trac-0.10.4
41
python setup.py install
42
~~~
43
44
This should install the Trac system to _/usr/share/trac_.
45
46
47
## Installing plugins
48
49
50
Next, the same trac plugins as on the master must be installed on the slave too.
51
52
53
This can be done by simply copying any _.egg_ files from the master site to the directory _/usr/share/trac/plugins/_
54
55
56
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.)
57
58
59
Further on, the installed plugins must be enabled within the _[[components]_|section of the trac configuration file. (see [#ConfiguringtheTracMirror Configuring the Trac Mirror]]
60
61
62
Currently, the following plugins have to be installed
63
64
* graphviz-0.6.9-py2.4.egg
65
66
* TracExtendedXmlRpc-0.1-py2.4.egg
67
68
* TracWebAdmin-0.1.2dev_r5753-py2.4.egg
69
70
* TracNavigationMenu-1.0m-py2.4.egg
71
72
* TracXMLRPC-0.1-py2.4.egg
73
74
75
76
## Installing Macros
77
78
Also, the same wiki macros have to be installed on the slave site as on the master.
79
80
81
So, the easiest way is to simply copy these macros from the master site to the directory _/usr/share/trac/wiki-macros/_
82
83
Alternatively, macros can be downloaded from [trac-hacks macros page](http://trac-hacks.org/wiki/macro.)
84
85
86
Currently, the following wiki macros have to be installed
87
88
* CSV
89
90
91
92
## Installing others
93
94
Further on, the current master site relies on several other packages, which should be installed as well
95
96
~~~
97
apt-get install python-docutils
98
apt-get install python-clearsilver
99
apt-get install graphviz
100
apt-get install python-pydot
101
apt-get install librsvg2-bin
102
~~~
103
104
105 1 Lutz Suhrbier
## Configuring the Trac Mirror
106
107 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_)
108 1 Lutz Suhrbier
109 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.
110 1 Lutz Suhrbier
111 3 Lutz Suhrbier
 components section::
112 1 Lutz Suhrbier
113 3 Lutz Suhrbier
 Take care to enable any installed plugins or macros here
114 1 Lutz Suhrbier
115 3 Lutz Suhrbier
 graphviz section::
116 1 Lutz Suhrbier
117 3 Lutz Suhrbier
 Create or change the directory given in the variable _cache_dur_
118 1 Lutz Suhrbier
119 3 Lutz Suhrbier
 project section::
120
121
 Adapt the url variable and the location of the icon.
122
123
 trac section::
124
125
 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.
126
127
128
129
### Subversion mirror
130
131 4 Lutz Suhrbier
A local mirror of the master's subversion repository will be needed to run the Trac mirror. Please, refer to the [[SVNMirroring|Subversion repository mirror]] article.
132 3 Lutz Suhrbier
133
134
135
### Templates
136
137
Additional templates from the EDIT project environment should be copied to _/var/www/trac/edit/templates_.
138
139
140
### htdocs
141
142
Additional htdocs from the EDIT project environment should be copied to _/var/www/trac/edit/htdocs_.
143
144
145
146
## Attachments
147
148
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.
149
150
151
 **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 ?
152
153
154
155
## Enabling Apache
156
157
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
158
159
~~~
160
a2ensite trac
161
~~~
162
163 5 Lutz Suhrbier
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.
164 3 Lutz Suhrbier
165
~~~
166
<Location /trac>
167
    SetHandler mod_python
168
    PythonHandler trac.web.modpython_frontend
169
    PythonOption TracEnv /var/www/trac/edit
170
    PythonOption TracUriRoot /trac
171
172
    AuthType           shibboleth
173
    ShibRequireSession On
174
    require            valid-user
175
</Location>
176
177
Alias /_sharedtrac "/usr/share/trac/htdocs"
178
Alias /trac_htdocs "/var/www/trac/edit/htdocs"
179
<Directory "/usr/share/trac/htdocs">
180
    Options Indexes MultiViews
181
    AllowOverride None
182
    Order allow,deny
183
    Allow from all
184
</Directory>
185
186
~~~
187
188 1 Lutz Suhrbier
Finally, restart apache and hopefully enjoy your trac mirror!
189 4 Lutz Suhrbier
190
191
192
## Troubleshooting
193
194
195
### Different Subversion Repository UUIDs
196
197
Whenever Trac comes up with an error message enforcing you to run _trac-admin resync_, then take a look at the log file in _/var/www/trac/edit/logs/trac.log_. If there is a line stating that the repository uuid does not match, then this problem could be solved by [[SVNMirroring#Modifyingrepositorysuuid|setting the same repository uuid]] as on the master repository.