These are some short notes on how I (successfully) installed Trac on a Synology DS209+II. The process should be similar for many other Synology servers. Please comment on any errors you find or snags you run into.
I modified my Synology server from the original Synology setup:
Configuration of Apache for Subversion
I appended following lines to /opt/etc/apache2/httpd.conf:
# Subversion
Include etc/apache2/conf.d/mod_dav_svn.conf
Also, I created a file /opt/etc/apache2/conf.d/mod_dav_svn.conf with following contents:
LoadModule dav_svn_module libexec/mod_dav_svn.so
LoadModule authz_svn_module libexec/mod_authz_svn.so
<Location /svn>
DAV svn
SVNParentPath /volume1/svn
AuthType Basic
AuthName "Subversion repository"
AuthUserFile /volume1/svn/svn-auth-file
Require valid-user
</Location>
# allow Apache to be used for authenticating Trac
<Directory /opt/share/www/trac>
AuthType Basic
AuthName "Subversion repository"
AuthUserFile /volume1/svn/svn-auth-file
Require valid-user
</Directory>
This expects a file /volume1/svn/svn-auth-file to be present. That file
contains the passwords used for Subversion (and, via Apache, Trac
authentication). This file is generated with apaches htpasswd -c command. I
used the cm too, to force md5 hashing of the passwords. Also, I added the folder /opt/share/www/trac` - this is used later on for Trac authentication, as I instruct Apache to authenticate this URL and tell Trac to use it for authentication.
Trac configuration
I am running Trac version 0.11.7. The Trac environments can be found at /volume1/trac-env. They are called "MYTRAC1" and "MYTRAC2". Access to them is via the following URLs:
Trac is run using tracd. This is configured to start automatically on system start by creation of the following file: /opt/etc/init.d/S81trac:
#!/bin/sh
# run tracd
/opt/bin/tracd -d -p 8888 -auth=*,/volume1/svn/svn-auth-file,myserver.example.com -e /volume1/trac-env
The file must be set to executable for root (see documentation for chmod), so that it will be run at system start.
Trac configuration files can be found at
- /volume1/trac-env/MYTRAC1/conf/trac.ini
- /volume1/trac-env/MYTRAC2/conf/trac.ini
Authentication via Apache
Authentication is done with the AccountManager plugin for trac (http://trac-hacks.org/wiki/AccountManagerPlugin). The website has a good explanation on how that works. See the copies of the trac.ini files for reference. I'd like to point out the last section:
[account-manager]
password_store = HttpAuthStore
authentication_url = http://myserver.example.com:8000/trac
This is where we tell Trac to use our Apache Server for authentication.
Backup
Backing up Trac
Trac is backed up with the trac-admin hotcopy command. The configuration of the backup is in /etc/crontab. It is done by executing the script /volume1/trac-env/tracbackup:
#!/bin/sh
/opt/bin/trac-admin /v9olume1/trac-env/MYTRAC1 hotcopy `date +/volumeUSB1/usbshare/TracBackup/%Y%m%d_trac_hotcopy_MYTRAC1`
/opt/bin/trac-admin /v9olume1/trac-env/MYTRAC2 hotcopy `date +/volumeUSB1/usbshare/TracBackup/%Y%m%d_trac_hotcopy_MYTRAC2`
# make sure other computers connecting to the share
# can delete these files
chmod 777 /volumeUSB1/usbshare/TracBackup/*
FIXME: these still have to be deleted regularly. I do this from my PC, so as to keep the complexity on the server minimal.
Backing up Subversion
Subversion is backed up with the svnadmin dump command, since this can then be read in from other subversion versions. The configuration of the backup is in /etc/crontab. It is done by executing the script /volume1/svn/svnbackup:
#!/bin/sh
/opt/bin/svnadmin dump /volume1/svn/MYREPO1 > `date +/volumeUSB1/usbshare/SvnBackup/%Y%m%d_svn_dump_MYREPO1`
/opt/bin/svnadmin dump /volume1/svn/MYREPO2 > `date +/volumeUSB1/usbshare/SvnBackup/%Y%m%d_svn_dump_MYREPO2`
# make sure other computers connecting to the share
# can delete these files
chmod 777 /volumeUSB1/usbshare/SvnBackup/*
FIXME: these still have to be deleted regularly. I do this from my PC, so as to keep the complexity on the server minimal.