bump to 0.15_32
[bse.git] / INSTALL.pod
CommitLineData
41b9d8ec
TC
1=head1 NAME
2
3 BSE installation guide.
4
5
6=head1 SYSTEM REQUIREMENTS
7
8=over 4
9
10=item *
11
12perl 5.005_03 or later
13
14=item *
15
16mysql 3.22. or later
17
18=item *
19
20GnuPG or PGP 5 or 6
21
22=item *
23
24a web host:
25
26=over 4
27
28=item *
29
30with telnet or ssh access
31
32=item *
33
34that runs your CGI scripts as your user
35
36=item *
37
38that runs your CGI scripts with the current working directory
39set to the directory that contains the CGI script.
40
41=back
42
43=back
44
45You will need at least the following Perl modules installed:
46
47=over 4
48
49=item *
50
51DBI
52
53=item *
54
55DBD::mysql
56
57=item *
58
59Digest::MD5
60
61=item *
62
63Apache::Session
64
54806969
TC
65=item *
66
220c179a
TC
67Storable (and this requires Log::Agent sometimes)
68
69=item *
70
54806969
TC
71HTML::Parser
72
220c179a
TC
73=item *
74
75URI::Escape
76
77=item *
78
79HTML::Entities
80
41b9d8ec
TC
81=back
82
83and their dependants. If you use the CPAN shell to install these then
84the dependants will be installed automatically.
85
86All other modules are either supplied or standard with perl.
87
88I assume you know how to use a text editor, and have a basic knowledge
89of how directories work, and know enough perl to be able to edit
90constants.
91
92=head1 PLANNING
93
94You need to know:
95
96=over 4
97
98=item *
99
100the layout of directories on your web host: where CGI programs go
101(cgi-bin), where's the root of the document tree (htdocs), and where
102can you safely keep static data (datapath). The names in parentheses
103() will be used in this documentation.
104
105=item *
106
107how you want your site to look, presumably as one or more HTML files
108and associated style sheets.
109
110=item *
111
112order processing information: the email address and public key of
113the user who will be receiving the order emails. The email address
114and private key of the sender of the order emails (though this can be
115generated during installation.
116
117=back
118
119=head1 EXTRACT FILES
120
121Telnet or ssh to the web host.
122
123Extract the archive into a working directory:
124
125 mkdir work
126 cd work
127 tar xzf workpath/bse-0.04.tar.gz
128
129The directories in the archive are:
130
131 bse/ Base directory
132 bse/schema Database schema definitions (and some test data)
133 bse/site Laid out site
134 bse/site/htdocs Document root
135 bse/site/cgi-bin CGI programs
136 bse/site/templates Sample page templates
137 bse/site/data Static site data (currently just the stopwords list)
138 bse/site/docs Documentation
139 bse/site/util Utilities (currently just initial.pl)
140
141If you are running your own host, or have sufficient control over
142Apache, you may want to extract the archive in it's final directory
143and simply create a new <VirtualHost..> that uses the extracted
144directories. If so, skip Copy Files.
145
146
147=head1 COPY FILES
148
149Replacing the names as decribed in L<PLANNING>
150
151 # the base documents
152 mkdir htdocs/admin
153 cp -R workpath/site/htdocs htdocs/
154 # page templates (you will need to modify these) and static data
155 mkdir datadir/templates
156 cp -R workpath/site/templates datadir/templates/
157 cp -R workpath/site/data datadir/
158 # cgi
159 cp -R workpath/site/cgi-bin cgi-bin/
160
161
162=head1 CONFIGURATION
163
164Most configuration information is kept in Constants.pm, which is in
165the cgi-bin/modules directory:
166
167 vi cgi-bin/modules/Constants.pm
168
169=head2 Database
170
171$DB should be the name of your mysql database.
172
173$UN and $PW should be your mysql login name and password.
174
175=head2 Directory structure
176
177If your directory structure matches that of the archive, this is
178simple, set $BASEDIR to point to the site directory. The other
179variables are set based on that layout.
180
181Otherwise, set:
182
183=over 4
184
185=item $TMPLDIR
186
187to the directory you are keeping document templates in,
188'datapath/templates/' if you followed L<COPY FILES>
189
190=item $CONTENTBASE
191
192to the directory you are keeping the site document files in, 'htdocs/'
193if you followed L<COPY FILES>.
194
195=item $IMAGEDIR
196
197to the directory that image files are kept in. This should be left as
198$CONTENTBASE . 'images/'
199
200=item $DATADIR
201
202to the directory containing F<stopwords.txt>
203
204=back
205
206B<Warning:> these paths I<must> be kept as absolute directories. They
207must the directories as seen by the running CGI scripts.
208
209
210=head2 Site name
211
212You should set $URLBASE and $SECURLBASE to the URLs used to access
213your site in normal and SSL (https). If you currently don't have secure access setup, you can use the same non-secure URL for both.
214
215B<Warning:> You I<must> set the $SECURLBASE to a secure URL and
216regenerate the site before accepting orders on the site.
217
218=head2 Level defaults
219
220This is probably the most complex item to configure.
221
222The %LEVEL_DEFAULTS hash describes how your site will look from the
223administration interface. It has little effect on how the site looks
224from a user's perspective, except of course, that it sets defaults for
225some items.
226
227Each level of your site needs an entry in the hash, with the top level
228being 0 to indicate the whole site. This top-level should only have
229the C<display> keyword defined.
230
231Each level except for level 0 should have the following keywords defined:
232
233=over 4
234
235=item *
236
237C<display> defines how the articles at this level is described when
238adding new articles.
239
240=item *
241
242C<template> is the default template name used for that level. It
243should exist in the levels directory under your template directory.
244
245=item *
246
247C<threshold> is the default threshold used when a new article is
248created at that level. Thresholds are used to control whether child
249article are rendered inline, or as summaries.
250
251=back
252
253=head2 Link Titles
254
255If you set $LINK_TITLES to non-zero, then the links created for the
256C<article link> and C<url article> tags will include the title as a
257translated suffix. This allows some search engines to index on the
258URL as well as the content of the document. Without this suffix the
259url contains no useful indexable information.
260
261For this to work under Apache you will need the following in a
262.htaccess file in the htdocs/a directory:
263
264 RewriteEngine On
265 RewriteRule ^([0-9]+\.html)/[0-9a-zA-Z_]*$ ./$1 [T=text/html]
266
267=head2 Search options
268
269In geneal the search engine will generate a search index for all
270listed articles, and exclude unlisted articles.
271
272You have some control over the indexing. Set @SEARCH_INCLUDE to the
273ids of sections that should be indexed, even if not listed. Set
274@SEARCH_EXCLUDE to the ids of sections that should not be indexed.
275
276@SEARCH_EXCLUDE overrides @SEARCH_INCLUDE.
277
278Set $SEARCH_LEVEL to the lowest-level (highest number) of the articles
279to be indexed. Lower level articles will still be indexed, but
280searches for them will find their parent article (or I<their> parent
281article, if it still isn't a low enough level.)
282
283$SEARCH_ALL is used as the name of the entry in the drop-down list of
284sections generated by the <:list:> tag on the search template.
285
286=head2 Deletion control
287
288Some articles are critical to the operation of your site. If the
289article's id is in @NO_DELETE it cannot be deleted.
290
291=head2 The Shop
292
293This is probably the second hardest item to configure.
294
295It isn't necessary to configure this section until you need to use the
296shop.
297
298$SHOP_CRYPTO should be set to the supplied class that uses your
299installed encryption software. Note that currently only Squirrel::GPG
300has been tested in production. (Patches welcome on the other modules.)
301
302$SHOP_SIGNING_ID should be the user id of the key to use for signing
303orders.
304
305$SHOP_GPG, $SHOP_PGPE and $SHOP_PGP are the locations of the specified
306executables, for GunPG, PGP5 and PGP6 respectively. They only need to
307be set if the executable isn't in the PATH when the shop.pl runs.
308
309$SHOP_SENDMAIL needs to be set to the name of sendmail or a compatible
310program.
311
312$SHOP_FROM will be used as the sender of the order emails.
313
314Processed, encrypted orders will be $SHOP_TO_NAME and $SHOP_TO_EMAIL.
315There must be a public key in the keyring, which has been signed by
316the private key $SHOP_SIGNING_ID (or whatever your default private
317signing key is.)
318
319You can set $SHOP_EMAIL_ORDER to 0 to prevent the order being emailed
320as above. A confirmation email is still sent to the person who made
321the order. This is only really for testing, since only the encrypted
322email contains the credit card number and expiry date.
323
324=head2 Maintenance Tools
325
326$DATA_EMAIL is the email address of a person that the
327I<Dump database to email> page will send the MySQL database dump to.
328
329$MYSQLDUMP is the location of the MySQL C<mysqldump> tool. If this
330isn't in the PATH you will need to add this here.
331
332=head1 DATABASE SETUP
333
334=head2 Schema load
335
336You need to install the database schema. Presumably you have already
337created a user and database for the new site (or your host has.)
338
339To install the schema and the base data:
340
341 mysql -u youruserl -p yourdatabase <bse.sql
342
343You will be asked for your password.
344
345=head2 Base data load
346
347Change directory to the util directory in your workpath.
348
349If you moved the files you will need to edit initial.pl to change the line:
350
351 use lib '../cgi-bin/modules';
352
353so that it will specify the correct modules directory.
354
355You may want to simply set PERL5LIB to your new modules director instead:
356
357 PERL5LIB=cgi-bin/modules
358 export PERL5LIB
359
360Once you've done that, you can run initial.pl:
361
362 perl initial.pl
363
364B<Warning:> Do not run this after your site is up and has articles you
365want to keep. This will delete all existing articles from your site.
366
367
368=head1 TEMPLATE SETUP
369
370See the site/docs/templates.pod (or .html).
371
372
373=head1 SECURITY
374
375Since your web host runs your CGI programs as you, you can make
376Constants.pm readble only by you.
377
378You will need to protect the htdocs/admin and cgi-bin/admin
379directories with .htaccess files. For example:
380
381 AuthType Basic
382 AuthName "Administrator Only"
383 AuthUserFile "somepath/users.dat"
384 require valid-user
385
386The AuthUserFile needs to point to a file accessible by the user that
387the web server runs as. So it won't work if you use your home
388directory.