forked from nlplab/brat
-
Notifications
You must be signed in to change notification settings - Fork 1
/
installation.html
242 lines (176 loc) · 8.36 KB
/
installation.html
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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
<html lang="en-US" xml:lang="en-US" xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>brat manual</title>
<link rel="stylesheet" type="text/css" href="style.css"/>
<link rel="stylesheet" type="text/css" href="jquery-theme/jquery-ui-redmond.css"/>
<link rel="shortcut icon" href="../favicon.ico"/>
</head>
<style type="text/css">
</style>
<body>
<div id="manual-main" class="center">
<div id="header" class="ui-widget-header rounded">
<span><a href="index.html">home</a></span>
<span style="color:lightblue" class="unselectable">|</span>
<span><a href="introduction.html">introduction</a></span>
<span style="color:lightblue" class="unselectable">|</span>
<span><a href="case-studies.html">examples</a></span>
<span style="color:lightblue" class="unselectable">|</span>
<span><a href="features.html">features</a></span>
<span style="color:lightblue" class="unselectable">|</span>
<span><a href="installation.html">installation</a></span>
<span style="color:lightblue" class="unselectable">|</span>
<span><a href="manual.html">manual</a></span>
<div id="menulogo" class="logo unselectable">brat</div>
</div>
<h1>brat installation</h1>
<p>This page describes how to install a brat server and its
third-party dependencies.
</p>
<p><b>Please note</b>: you do not need to install brat to try it out;
brat runs in your browser and a live demo system usable with any
<a href="supported-browsers.html">supported browser</a> is
linked form the <a href="index.html">brat home page</a>.
<p>
<p>If you wish to set up your own local brat installation for your
annotation project, please follow the instructions below.
</p>
<h2>Installing the brat server</h2>
<p>brat is a served through a web server and we currently develop
against Apache 2.x. These instructions primarily assume that Apache,
but we do have also LigHTTPD configuration files in the repository if
you prefer this alternative.</p>
<pre><code>tar xzf brat.tar.gz
</code></pre>
<p>Enter the brat directory:</p>
<pre><code>cd brat
</code></pre>
<p>When running brat it needs to read and write data to several directories,
let's create them.</p>
<pre><code>mkdir data work
</code></pre>
<p>We now need to set the permissions of the directories so that they can be
read and written by the webserver. The command-line below is likely to give
you the Apache 2 group if you have Apache currently running. If not, see the
"Finding Your Apache 2 Group" section of this document:</p>
<pre><code>groups `ps aux | grep apache | grep -v 'grep' \
| cut -d ' ' -f 1 | grep -v 'root' | head -n 1` \
| cut -d : -f 2 | sed 's|\ ||g'
</code></pre>
<p>Then simply change the group of the directories (change <code>${YOUR_APACHE_GROUP}</code>
into the output you got above) and set the correct permissions:</p>
<pre><code>sudo chgrp -R ${YOUR_APACHE_GROUP} data work
chmod -R g+rwx data work
</code></pre>
<p>If you can't succeed with the above or you are not concerned with security (say
that it is a single-user system), you can run the command below instead or
refer to your operating system manual and look-up Apache 2 for their
instructions on how to get the Apache group. This will make the directories
write-able and read-able by every user on your system:</p>
<pre><code>chmod 777 data work
</code></pre>
<p>Extract all the library dependencies.</p>
<pre><code>( cd server/lib && tar xfz simplejson-2.1.5.tar.gz )
</code></pre>
<p>Put a configuration in place.</p>
<pre><code>cp config_template.py config.py
</code></pre>
<p>Edit the configuration to suit your environment (additional instructions are
in the file).</p>
<pre><code>vim config.py
</code></pre>
<p>Your installation should now be ready, just place your data in the <code>data</code>
directory and make sure it has the right permissions using <code>chmod</code> as you did
above. If your data consists of no prior annotations and only <code>.txt</code> files,
create the annotation files (<code>.ann</code>) as below.</p>
<pre><code>( find data -name '*.txt' | sed -e 's|\.txt||g' \
| xargs -I {} touch '{}.ann' )
</code></pre>
<h2>Installing third-party components</h2>
<p>This part largely focuses on Ubuntu, but use your *NIX-fu to turn it into what
you need if you don't have the misfortune to have the
"Brown Lunix Distribution".</p>
<h4>Apache 2.x</h4>
<p>brat supports <a href="http://www.fastcgi.com/">FastCGI</a> which can speed up your installation by
roughly x10 since you won't have to invoke the Python interpreter for every
request. If you want to use FastCGI as opposed to CGI keep an eye out for
configuration comments regarding it. For FastCGI you need the <a href="http://trac.saddi.com/flup">flup</a>
Python library:</p>
<pre><code>( cd server/lib/ && tar xfz flup-1.0.2.tar.gz )
</code></pre>
<p>Install Apache 2.x if you don't have it already:</p>
<pre><code>sudo apt-get install apache2
</code></pre>
<p>Let's edit the httpd.conf.</p>
<pre><code>sudo vim /etc/apache2/httpd.conf
</code></pre>
<p>If you are installing brat into your home directory, add the following lines.</p>
<pre><code><Directory /home/*/public_html>
AllowOverride Options Indexes FileInfo
AddType application/xhtml+xml .xhtml
AddType font/ttf .ttf
# For CGI support
AddHandler cgi-script .cgi
# Comment out the line above and uncomment the line below for FastCGI
#AddHandler fastcgi-script fcgi
</Directory>
# For FastCGI, Single user installs should be fine with anything over 8
#FastCgiConfig -maxProcesses 16
</code></pre>
<p>If you are not installing into your home directory adjust the above lines
accordingly. If you installed into your home directory make sure that you have
the <code>userdir</code> module enabled.</p>
<pre><code>sudo a2enmod userdir
</code></pre>
<p>For FastCGI you also want to install its module and then add it and the
<code>rewrite</code> module that we use to redirect the CGI requests to FastCGI:</p>
<pre><code>sudo apt-get install libapache2-mod-fastcgi
sudo a2enmod fastcgi
sudo a2enmod rewrite
</code></pre>
<p>The final FastCGI step is detailed in <code>.htaccess</code> in the brat installation
directory, which involves uncommenting and configuring the <code>rewrite</code> module.</p>
<p>Finally tell Apache 2.x to load your new configuration.</p>
<pre><code>sudo /etc/init.d/apache2 reload
</code></pre>
<h4>Finding Four Apache 2 Group</h4>
<p>Ideally you should set all permissions as needed for the Apache 2 group, but
finding it can be painful.</p>
<p>Find out what the Apache group name is, it is usually <code>apache</code> or <code>www-data</code>;
it can be found in <code>apache2.conf</code> or <code>httpd.conf</code> under <code>/etc/apache2/</code> or
<code>/etc/httpd/</code>. Let's assume it's www-data. Then:</p>
<pre><code>sudo chgrp -R www-data data work
chmod -R g+rwx data work
</code></pre>
<p>Actually, due to the joy of Linux segmentation you can find the group
elsewhere as well. Here is a small heuristic that works on at least two
Linux distributions:</p>
<pre><code>locate --regex '(apache2|httpd)\.conf$' | xargs cat | grep 'Group'
</code></pre>
<p>If what you get from this looks funky (like a variable), say with a leading $, try this:</p>
<pre><code>locate envvars | grep -E '(apache2|httpd)' | grep '/etc/' \
| xargs cat | grep -i 'group'
</code></pre>
<p>If this doesn't work either dive into <code>/etc/group</code> and hope that you can find
something that at least looks like <code>apache</code> or <code>www-data</code>:</p>
<pre><code>cat /etc/group | cut -d : -f 1 | sort
</code></pre>
<h3>On a Mac</h3>
<p>On a Mac, Apache configuration is quite different, and Aptitude is not
available.</p>
<h4>Setting up Apache</h4>
<p>Install brat into <code>~/Sites</code>. Edit
<code>/private/etc/apache2/users/$USER.conf</code>. Then invoke <code>sudo apachectl reload</code>.
The default user and group name for Apache is <code>_www</code> (as found in
<code>/private/etc/apache2/httpd.conf</code>), for use in <code>chgrp</code>.</p>
<h2>Back-ups</h2>
<p>There is a script that you can use with good old <code>cron</code>.
Do as follows.</p>
<p>Add a line like the one below to the crontab for your Apache user:</p>
<pre><code>0 5 * * * ${PATH_TO_BRAT_INSTALLATION}/tools/backup.py
</code></pre>
<p>You will now have a back-up made into your work directory every morning at
five o'clock.</p>
</body>
</div>
</html>