root/misc/setup-trac-demo

Revision 3, 1.9 KB (checked in by torsten, 3 years ago)

Add a script to set up trac on lighttpd.

Line 
1#! /bin/sh
2
3# Install required software packages
4apt-get -y install lighttpd trac subversion apache2-utils
5
6# Set up directory tree.
7for p in svn env auth; do
8  mkdir -p /srv/trac/$p/demo
9done
10
11# Create an empty subversion repo
12svnadmin create /srv/trac/svn/demo
13
14# Create the trac instance - prompts for some settings.
15echo "Note: Defaults are mostly okay, svn repo is in /srv/trac/svn/demo"
16trac-admin /srv/trac/env/demo initenv
17
18# Create the admin user
19htdigest -c /srv/trac/auth/demo/users "trac demo realm" admin
20trac-admin /srv/trac/env/demo permission add admin TRAC_ADMIN
21
22# Check the trac installation if you want
23echo "You may want to take a look at the trac site at port 8000 of this host."
24echo "Hit Ctrl-C into this shell when done!"
25tracd --port 8000 \
26  --auth=demo,/srv/trac/auth/demo/users,"trac demo realm" \
27  /srv/trac/env/demo
28
29# Fix the permissions
30# See http://bugs.debian.org/510441
31chmod +x /usr/share/pyshared/trac/web/fcgi_frontend.py
32# Web server needs access to the trac environment.
33chown -R www-data /srv/trac/env
34
35# Create a lighty configuration for trac
36cat << 'EOF' > /etc/lighttpd/conf-available/50-trac-demo.conf
37server.modules   += ( "mod_fastcgi" )
38
39fastcgi.server += ("/trac" =>
40        ((
41          "socket" => "/tmp/trac-fastcgi.sock",
42          "bin-path" => "/usr/share/pyshared/trac/web/fcgi_frontend.py",
43          "check-local" => "disable",
44          "max-procs" => 3,
45          "bin-environment" => ("TRAC_ENV" => "/srv/trac/env/demo")
46        ))
47)
48
49$HTTP["url"] =~ "^/trac/login$" {
50        auth.backend = "htdigest",
51        auth.backend.htdigest.userfile = "/srv/trac/auth/demo/users",
52        auth.require = ("" => (
53            "method"  => "digest",
54            "realm"   => "trac demo realm",
55            "require" => "valid-user"
56        ))
57}
58EOF
59
60# Enable the trac configuration as well as the auth module
61lighty-enable-mod auth trac-demo
62/etc/init.d/lighttpd force-reload
Note: See TracBrowser for help on using the browser.