| 1 | #! /bin/sh |
|---|
| 2 | |
|---|
| 3 | # Install required software packages |
|---|
| 4 | apt-get -y install lighttpd trac subversion apache2-utils |
|---|
| 5 | |
|---|
| 6 | # Set up directory tree. |
|---|
| 7 | for p in svn env auth; do |
|---|
| 8 | mkdir -p /srv/trac/$p/demo |
|---|
| 9 | done |
|---|
| 10 | |
|---|
| 11 | # Create an empty subversion repo |
|---|
| 12 | svnadmin create /srv/trac/svn/demo |
|---|
| 13 | |
|---|
| 14 | # Create the trac instance - prompts for some settings. |
|---|
| 15 | echo "Note: Defaults are mostly okay, svn repo is in /srv/trac/svn/demo" |
|---|
| 16 | trac-admin /srv/trac/env/demo initenv |
|---|
| 17 | |
|---|
| 18 | # Create the admin user |
|---|
| 19 | htdigest -c /srv/trac/auth/demo/users "trac demo realm" admin |
|---|
| 20 | trac-admin /srv/trac/env/demo permission add admin TRAC_ADMIN |
|---|
| 21 | |
|---|
| 22 | # Check the trac installation if you want |
|---|
| 23 | echo "You may want to take a look at the trac site at port 8000 of this host." |
|---|
| 24 | echo "Hit Ctrl-C into this shell when done!" |
|---|
| 25 | tracd --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 |
|---|
| 31 | chmod +x /usr/share/pyshared/trac/web/fcgi_frontend.py |
|---|
| 32 | # Web server needs access to the trac environment. |
|---|
| 33 | chown -R www-data /srv/trac/env |
|---|
| 34 | |
|---|
| 35 | # Create a lighty configuration for trac |
|---|
| 36 | cat << 'EOF' > /etc/lighttpd/conf-available/50-trac-demo.conf |
|---|
| 37 | server.modules += ( "mod_fastcgi" ) |
|---|
| 38 | |
|---|
| 39 | fastcgi.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 | } |
|---|
| 58 | EOF |
|---|
| 59 | |
|---|
| 60 | # Enable the trac configuration as well as the auth module |
|---|
| 61 | lighty-enable-mod auth trac-demo |
|---|
| 62 | /etc/init.d/lighttpd force-reload |
|---|