Changeset 1887
- Timestamp:
- 02/03/07 23:48:24 (1 year ago)
- Files:
-
- swish_website/README (modified) (10 diffs)
- swish_website/bin/build (modified) (9 diffs)
- swish_website/etc/httpd.conf.tt (added)
- swish_website/etc/swish.config (modified) (1 diff)
- swish_website/lib/config/site (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
swish_website/README
r1886 r1887 8 8 to review and then check in. 9 9 10 Prerequisites 11 ------------- 12 13 HTML-Parser-3.56 14 HTML-Tree-3.23 15 HTML-FillInForm-1.06 16 hypermail-2.1.8 17 Pod-POM-0.17 18 swish-e-2.4.5 19 Template-Toolkit-2.15 20 21 There are likely other dependencies, depending on your systems base 22 configuration. 23 24 Note, the versions were the current CPAN versions and don't necessarily reflect 25 dependencies. 26 27 10 28 Overview 11 29 -------- 12 30 13 31 The website generation has a few dependencies. There are scripts to generate 14 the various parts. 32 the various parts. Here's an overview of what's needed before the site can be 33 generated. 15 34 16 35 - swish-e current release source … … 21 40 22 41 - archive (hypermail) 42 Not actually required to build the site, as the site just 43 points to the hypermail archive. But, might in the future 44 use a single script to display the archive then it would be 45 a true dependency. 46 23 47 currently, procmail feeds new posts to hypermail to 24 48 add new posts to the archive. The posts are also archived 25 49 in the "mbox" directory by month in mbox format. 26 50 27 - archive index51 - indexes 28 52 When the archive is updated a flag is set and then cron 29 can re-index the hypermail archive. 53 can re-index the hypermail archive. Also, the index of 54 the site is needed, but first need the site... 30 55 31 56 - swish-daily … … 41 66 ------------------- 42 67 43 /<top level dir> 68 A "top level dir" contains a number of directories. This top level 69 directory will be called $ROOT below. 70 71 $ROOT/ 44 72 45 73 swish_daily_build/ - where the daily builds are created … … 55 83 indexes/ - indexes for the archive and website 56 84 57 swish_website/ - source for building the site (more below)58 59 85 pubilc_html - bulk of generated website. 60 86 61 87 62 Apache's DocumentRoot is pubilc_html, and swish-daily and distribution 63 are Aliased. See httpd.conf. 88 Of those directories, public_html is the site's Document Root, 89 and "archive", "distribution", and "swish-daily" are aliased 90 in the Apache configuration. 91 92 The names of the directors do not have to be as shown above and don't 93 even need to all be under the same directory. But, if the names above 94 are used then the site build script can be invoked with simpler arguments. 95 96 64 97 65 98 … … 73 106 But, to build a daily tarball that include the HTML docs the website code 74 107 needs to be installed. 108 109 So, the swish_website needs to be checked out from subversion first. 75 110 76 111 The swish-e configure script looks for the program "build-swish-docs" in the … … 92 127 The website isn't generated yet, but the code is needed before 93 128 building the daily tarballs. 129 130 This example places swish_website below $ROOT. This is not a requirement, 131 but is nice if you want to keep everything in one place. 94 132 95 133 cvn co http://svn.swish-e.org/swish_website/ $ROOT/swish_website … … 192 230 193 231 232 233 public_html 234 ----------- 235 Now the website can be created. The bin/build script is used 236 to generate the website. The script will detect when files 237 need to be generated, or passing --all will tell it to generate 238 the complete site. 239 240 There are a lot of options, and running build --help will list them. 241 The same build script is used when building from cvs to generate the 242 html docs for the tarball. 243 244 If the directories above are all in $ROOT and use the same names as 245 above, then the script can be called like this: 246 247 $ROOT/swish_website/bin/build --root $ROOT --all 248 249 (The --all is optional) 250 251 This is the same as calling the script and explicitly setting 252 all the directories: 253 254 255 $ROOT/swish_website/bin/build \ 256 --dest $ROOT/public_html \ 257 --indexes $ROOT/indexes \ 258 --swishsrc $ROOT/swish_release_build/latest_swish_build/source \ 259 --develsrc $ROOT/swish_daily_build/latest_swish_build/source \ 260 --download $ROOT/distribution \ 261 --daily $ROOT/swish-daily \ 262 --all 263 264 265 266 httpd.conf 267 ---------- 268 269 Setting up Apache is just a matter of pointing 270 Apache at public_html, and creating aliases 271 for the distribution, swish-daily, and the archive directories. 272 273 The same bin/build script can be used to generate an httpd.conf file. 274 275 $ROOT/swish_website/bin/build --root $ROOT --apache > httpd.conf 276 277 278 For debugging locally, say just the web site 279 280 281 $ROOT/swish_website/bin/build \ 282 --root $ROOT \ 283 --apache \ 284 --port 8080 \ 285 --ipaddr `hostname` \ 286 --domain `hostname` \ 287 --nodev_site \ 288 --nolists_site \ 289 --nosvn_site \ 290 > httpd.test 291 292 The only reason to disable sites might be if you don't have 293 the modules installed locally. 294 295 296 194 297 indexes 195 298 ------- … … 198 301 another for the website. 199 302 200 The web site is not created yet, so it cannot be indexed. 303 304 This create the index of the archive 201 305 202 306 mkdir $ROOT/indexes … … 214 318 215 319 216 public_html 217 ----------- 218 Now the website can be created. The bin/build script is used 219 to generate the website. The script will detect when files 220 need to be generated, or passing --all will tell it to generate 221 the complete site. 222 223 There are a lot of options, and running build --help will list them. 224 The same build script is used when building from cvs to generate the 225 html docs for the tarball. 226 227 The site must be told where to find all the directories created above. 228 It determines where the source files are relative to the location of the 229 script, but must be told everything else: 230 231 232 $ROOT/swish_website/bin/build \ 233 --dest=$ROOT/public_html \ 234 --archive=$ROOT/indexes \ 235 --swishsrc=$ROOT/swish_release_build/latest_swish_build/source \ 236 --develsrc=$ROOT/swish_daily_build/latest_swish_build/source \ 237 --download=$ROOT/distribution \ 238 --daily=$ROOT/swish-daily \ 239 --all 240 241 242 Luckily, there's a build script that does all that, and also indexes 243 the site. 244 245 246 indexes -- part 2 247 ----------------- 248 249 Once the site is it's time to build the index of the web site. 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 Site layout 270 ----------- 320 This creates the index of the website. The site is spidered, 321 so Apache must be running. 322 323 This uses the spider installed with swish-e -- and runs the spider 324 via the swish config (instead of piping the spider's output to swish). 325 Therefore, must cd to the website directory: 326 327 328 cd $ROOT/swish_website && \ 329 SWISH_SITE=http://bumby.com:8080 \ 330 SPIDER_QUIET=1 \ 331 swish-e \ 332 -c etc/swish.config \ 333 -f $ROOT/indexes/index.swish-e \ 334 -S prog \ 335 -v0 336 337 338 339 340 341 342 Crontab 343 ------- 344 345 TODO 346 Cron is used for a number of tasks. The user running cron needs to 347 have write access to the $ROOT directory. 348 349 Cron is used for: 350 351 1) create the daily builds 352 2) cvs update the website and rebuild if necessary (including reindexing) 353 3) cvs update an rebuild the website nightly using --all, just for good measure 354 4) reindex when new archives messages have been added 355 356 357 8,15,37,45 * * * * . $HOME/.bashrc && rm time_to_index 2>/dev/null && cd swish/search && perl index_hypermail.pl ../archive | swish-e -c swish.conf -S prog -i stdin -v0 358 33 3-19 * * * . $HOME/.bashrc && cd $HOME/swish/swish_website && ./build.sh 359 55 1 * * * . $HOME/.bashrc && swish-daily.pl --tardir=$HOME/swish/swish-daily --topdir=$HOME/swish/swish_daily_build || echo "Check Swish Daily Build" 360 20 2 * * * . $HOME/.bashrc && cd $HOME/swish/swish_website && ./build.sh -all 361 362 363 364 Procmail 365 -------- 366 367 TODO 368 369 Procmail is used to look for email messages from the swish-e list. 370 A message is saved to the mbox directory and piped to hypermail 371 to be included in the html archive. A flag is set to let cron 372 know that the archive needs to be re-indexed. 373 374 # ===== Debugging Settings ======== 375 376 # Set log file location 377 LOGFILE=$HOME/procmail.log 378 379 # Set on for debug -- Extended diags 380 # Options: VERBOSE=off|on 381 VERBOSE=off 382 383 384 # Writes From_ and Subject, deliver folder, and length if on 385 # Options: LOGABSTRACT=all|no 386 LOGABSTRACT=all 387 388 SHELL=/bin/sh 389 HYPERMAIL=/home/bmoseley/local/bin/hypermail 390 ARCHIVE_DIR=/home/bmoseley/swish 391 FILENUM=`/bin/date -u +%Y%m` 392 393 394 :0 395 * ^TOusers@lists.swish-e.org 396 { 397 # chdir to the archive directory 398 MAILDIR=$ARCHIVE_DIR 399 400 # Save the archived mbox message 401 :0wc: 402 | gzip -c >> mbox/swish_$FILENUM.gz 403 404 # update the hypermail archive 405 # This probably should be done with cron, not when the mail comes in. 406 :0wc 407 | $HYPERMAIL -i -u -c hypermailrc -d archive 408 409 # Set flag that it needs to be indexed 410 :0ih 411 | touch $HOME/time_to_index 412 } 413 414 :0 415 ! moseley@hank.org 416 417 418 419 Note: Sat Feb 3 20:36:10 PST 2007 420 Some of the content below has not be reviewed 421 and may be inaccurate. 422 423 424 425 swish_website layout 426 -------------------- 427 428 Here's an overview of the files that are used to build the website. 271 429 272 430 ./ 273 431 -> src - web source docs. 274 -> public_html - output files. This is DocumentRoot275 distribution - symlink to the swish-releases tarball directory[1]276 swish-daily - symlink to swish-daily tarball directory277 432 -> bin - bin/build script and other utilities 278 433 -> lib/config - site config templates. … … 282 437 -> lib/pod_toc - top-level index for pod docs 283 438 284 [1] these two (three including the "old" dir) directories are read when285 building the index listings for the downloads, plus they must be available via286 the /distribution and /swish-daily URLs. Originally, these were outside of287 document root (public_html) in dirs_public and accessed with Alias in288 httpd.conf. And lib/config/site set their locations for generating the289 index.html pages listing the files.290 291 292 Requirements293 ------------294 295 Swish-e must be installed on the system and the program296 swish-config must be in the path -- this is used to find where297 helpers (e.g. perl modules) are installed.298 299 300 Building the site301 -----------------302 303 Check out the "swish_website" project from CVS. Once checked out you need to304 initialize a few directories, and then build the site.305 306 $ cd swish_website307 $ mkdir -p public_html dirs_public/download/old dirs_public/swish-daily308 $ bin/build -swishsrc=$HOME/swish-e -develsrc=$HOME/swish-e -archive=archive/index.swish-e309 310 (Or symlink as needed -- which is what I did.)311 312 Also in lib/config/site you might want to define where swish-daily and313 the download dirs are set. Currently to /distribution and /swish-daily.314 The download and swish-daily pages link files to those dirs.315 316 You need Template Toolkit, Pod::POM (from CPAN) and anything else it317 complains about.318 319 Those output directories can be overridden. see bin/build --help for320 help. "dirs_public" can be set in lib/conifg/site.321 322 From the top-level directory* (where this README file is located)323 run:324 325 bin/build -all -swishsrc=$HOME/swish-e -v326 327 (assuming that's where the swish-e source is located)328 329 That builds both the website and the pod docs and writes them330 to the "public_html" directory.331 332 * Actually, from anywhere -- directories are determined relative to333 where the /bin/build program is found.334 335 Running without the -all switch will cause only the changed files to be336 rebuilt. Normally you run with -all.337 338 Note: the docs/index.html file can only be correctly built if ALL the pods339 are processed (using -all). So do not rm public_html/docs/index.html and expect340 it to be rebuilt automatically.341 342 For a bit more info, run:343 344 bin/build -help345 439 346 440 swish_website/bin/build
r1886 r1887 4 4 use warnings; 5 5 use FindBin qw'$Bin $RealBin'; 6 use Template; 6 7 7 8 … … 72 73 73 74 75 my @argv = @ARGV; # save for later. 76 77 78 my %default_paths = ( # relative to --root 79 dest => 'public_html', 80 indexes => 'indexes', 81 swishsrc => 'swish_release_build/latest_swish_build/source', 82 develsrc => 'swish_daily_build/latest_swish_build/source', 83 download => 'distribution', 84 daily => 'swish-daily', 85 archive => 'archive', 86 ); 87 88 89 74 90 75 91 my %default_config = ( 76 ignore => [ '.svn', '\b(CVS|RCS)\b', '^#', '\.gz$', '\.swp$'], 77 copy => [ '\.(pdf|gif|png|jpe?g|htaccess)$' ], 78 include => ['lib' ], 79 src => $src_default, 80 # dest => $dest_default, 81 # poddest => $poddest_default, 82 websitesrc => 'src' # default website source directory relative to -src 92 ignore => [ '.svn', '\b(CVS|RCS)\b', '^#', '\.gz$', '\.swp$'], 93 copy => [ '\.(pdf|gif|png|jpe?g|htaccess)$' ], 94 include => ['lib' ], 95 src => $src_default, 96 websitesrc => 'src', # default website source directory relative to -src 83 97 # added to INCLUDE_PATH 98 web_site => 1, 99 dev_site => 1, 100 lists_site => 1, 101 svn_site => 1, 84 102 ); 85 103 … … 91 109 $0 usage: 92 110 93 1) build complete website (including pods) 94 95 $0 -swishsrc=\$HOME/swish-e 96 97 which, with showing the defaults, is the same as 98 99 $0 \\ 100 --swishsrc=\$HOME/swish-e \\ 101 --src=$default_config{src} \\ 102 --dest=$default_config{dest} \\ 103 --poddest=$default_config{poddest} 104 105 2) build just website without pods 106 107 $0 108 109 which uses defaults as above but without specifying the source for pods. 110 111 112 3) build pods in a separate location (skips website) 113 114 $0 --swishsrc=\$HOME/swish-e --poddest=\$HOME/swish-e/html 115 116 If --poddest is not set to \$src/docs (the default) then menu links 117 to non-pod files will point to http://swish-e.org. Needed for stand-along 118 processing. 119 120 121 111 This script is used to build the swish-e website. It is 112 also used to build the html documentation from the subversion 113 repository for the swish-e release tarball. 114 115 Please see the README for details of building the site, but in 116 short, to build the site: 117 118 bin/build --root \$ROOT --all 119 120 Will build the site, but assumes all required directories are 121 located in \$ROOT, and the website will also be output \$ROOT/public_html. 122 123 As mentioned above, just the documentation can be written using this 124 program. Use the --poddest options along to just write the pods. 125 When --poddest doesn't not fall within the location of the website the 126 program assumes it's writing docs for the tarball, and links are adjusted 127 to point to the main swish-e website. 128 129 Options: 130 131 -root=<dir> = If set, will try and set all the following 132 using defaults below the directory specified. 133 See README. 134 -all = don't check timestamps on destination files 135 Will generate all files, not just ones with 136 dates newer than the output files. 137 -verbose = verbose 138 -debug = eh, debuging output 139 -dryrun = Don't write output file. 140 141 142 If not using the default locations, these can be set specifically: 143 144 -dest=<dir> = destination directory for website 145 -indexes=<dir> = Path to directory where indexes are stored 146 -swishsrc=<dir> = toplevel directory of swish-e source package 147 -develsrc=<src> = Directory of development. 148 -download=<dir> = Path to directory where downloads are located 149 -daily=<dir> = Path to directory where daily builds are located 150 -archive=<dir> = Path to the hypermail archive 151 152 -- Normally not needed -- 122 153 -src=<dir> = top-level directory of website source 123 154 Default: $default_config{src} 124 155 \$src/src and \$src/lib are INCLUDE_PATH 125 -dest=<dir> = destination directory for website126 Default: $default_config{dest}127 -swishsrc=<dir> = toplevel directory of swish-e source package128 156 -poddest = where pods are stored (must set -swishsrc) 129 157 Setting poddest will disable website generation 130 Default: $default_config{poddest}131 158 -podonly = says do not write website files, only pod files 132 159 (set automatically when -poddest != website dir 133 -all = don't check timestamps on destination files 134 -verbose = verbose 135 -debug = eh, debuging output 136 -dryrun = Don't write output file. 160 137 161 -websitesrc = default dir where website src content is located 138 162 Default: $default_config{websitesrc} 139 163 Should never be used. 140 164 141 -develsrc=<src> = Directory of development.142 143 -archive=<dir> = Path to directory where indexes are stored144 -download=<dir> = Path to directory where downloads are located145 -daily=<dir> = Path to directory where daily builds are located146 165 147 166 -- options you don't need -- … … 153 172 154 173 174 -- Apache config file generation - 175 (Defaults are set in the template and may not match below) 176 177 -apache = Only generate Apache configuration file. 178 The file is sent to stdout. 179 180 domain = Override the domain name [swish-e.org] 181 module_dir = Location of Apache modules [modules] 182 user = Apache user [apache] 183 group = Apache group [apache] 184 logs = Location of log files [logs] 185 pid_file = Location of apache pid file [run/httpd.pid] 186 ipaddr = IP address for Listen statement [*] 187 port = Port to listen on [80] 188 trac_doc_root = Path do DocumentRoot for trac [/opt/trac/htdocs] 189 trac_env = Trac environment [/opt/trac] 190 trac_password = Trac password file [/opt/svn/swish/conf/dav_svn.passwd] 191 svn_repo = Path to Subversion Repository [/opt/svn/swish] 192 193 web_site = Boolean to include website [true] 194 dev_site = Boolean to include trac site [true] 195 lists_site = Boolean to include mailman site [true] 196 svn_site = Boolean to include svn repo [true] 197 198 155 199 Script exits false (1) if no files are actually processed. 156 200 Exits false even if -all -dryrun is used. … … 164 208 165 209 my @options = qw( 166 src=s 167 dest=s 168 swishsrc=s 169 poddest=s 170 verbose|v 171 debug 172 all|a 173 ignore=s@ 174 copy=s@ 175 include=s 176 podonly 177 dryrun|n 178 websitesrc=s 179 abslinks 180 develsrc=s 181 archive=s 182 download=s 183 daily=s 184 check 210 src=s 211 dest=s 212 root=s 213 swishsrc=s 214 poddest=s 215 verbose|v 216 debug 217 all|a 218 ignore=s@ 219 copy=s@ 220 include=s 221 podonly 222 dryrun|n 223 websitesrc=s 224 abslinks 225 develsrc=s 226 indexes=s 227 download=s 228 daily=s 229 check 230 231 apache 232 domain=s 233 module_dir=s 234 user=s 235 group=s 236 logs=s 237 pid_file=s 238 ipaddr=s 239 port=i 240 241 trac_doc_root=s 242 trac_env=s 243 trac_password=s 244 245 svn_repo=s 246 247 web_site! 248 dev_site! 249 lists_site! 250 svn_site! 251 185 252 ); 186 253 … … 205 272 206 273 274 275 # Set defaults 276 277 if ( $config->{root} ) { 278 my $root = File::Spec->rel2abs( $config->{root} ); 279 280 for my $option ( keys %default_paths ) { 281 next if $config->{$option}; 282 my $dir = File::Spec->catfile( $root, $default_paths{$option} ); 283 284 if ( -d $dir ) { 285 $config->{$option} = $dir; 286 } else { 287 warn "Could not set option '--$option=$dir': $!\n"; 288 } 289 } 290 } 291 292 293 207 294 $config->{poddest} = File::Spec->catfile( $config->{dest}, 'docs' ) 208 295 unless $config->{poddest}; 296 297 298 # Generate apache config 299 if ( $config->{apache} ) { 300 301 my $tt = Template->new( 302 INCLUDE_PATH => File::Spec->catfile( $config->{src}, 'etc' ), 303 ); 304 305 my $stash = { 306 %$config, 307 script => $0, 308 arguments => join( ' ', @argv ), 309 }; 310 311 my $template = $config->{template} || 'httpd.conf.tt'; 312 313 $tt->process( $template, $stash ) || die $tt->error; 314 315 exit 0; 316 } 317 209 318 210 319 … … 270 379 271 380 272 # Build include paths - reverse so -includ =foo will be pre-pended to path381 # Build include paths - reverse so -include=foo will be pre-pended to path 273 382 my @includes = map { 274 383 File::Spec->file_name_is_absolute( $_ ) … … 332 441 333 442 334 # Test the list archivedirectory335 if ( $config-> archive) {336 my $index = File::Spec->rel2abs( $config-> archive);337 die " List archive index [$index]not a directory\n" unless -d $index;338 $config->{ archive} = $index;443 # Test the list indexes directory 444 if ( $config->indexes ) { 445 my $index = File::Spec->rel2abs( $config->indexes ); 446 die "indexes setting of [$index] is not a directory\n" unless -d $index; 447 $config->{indexes} = $index; 339 448 } 340 449 … … 760 869 no strict 'refs'; 761 870 for (@$options ) { 762 next unless /(^[a-zA-Z ]+)/;871 next unless /(^[a-zA-Z_]+)/; 763 872 my $method = $1; 764 873 *{$method} = sub { return shift->{$method} || undef }; swish_website/etc/swish.config
r1601 r1887 9 9 PropertyNames section 10 10 11 IndexFile public_html/search/index.swish-e12 11 13 12 # Add these metanames to allow searching list archive, too swish_website/lib/config/site
r1886 r1887 36 36 swish = { 37 37 current_version = this.swish_current_version || '2.4.5' 38 index_file = 'index.swish-e'39 archive_index = self.config. archive38 index_file = self.config.indexes _ '/archive.swish-e' 39 archive_index = self.config.indexes _ '/index.swish-e' 40 40 version = this.swish_version 41 41 };
