SvnTracSetupScript
From ByteWiki
WARNING: Currently incomplete!!
Here are some scripts I'm working on to automate creation of SVN/Trac projects on CentOS 4.3
Trac seens to work locally (using tracd --port 8000 /srv/tp/trac), but running it through mod_python gives the following exception in the apache2 error_log, even with 777 permission set on the specified file:
PythonHandler trac.web.modpython_frontend: File "/usr/lib/python2.3/site-packages/trac/env.py", line 129, in verifyn fd = open(os.path.join(self.path, 'VERSION'), 'r') PythonHandler trac.web.modpython_frontend: IOError: [Errno 13] Permission denied: '/srv/tp/trac/VERSION'
I suspect SELinux has something to do with it, but I hadn't heard of it until tonight so I don't really know what I'm talking about. I presume Tyler is running it?
The following look helpful, but don't seem to work for me. I've tried both methods of working around SELinux:
#!/bin/bash # setup.sh - Run once to setup your environment cat <<EOF > /etc/yum.repos.d/extra.repo [dag] name=Dag RPM Repository for Red Hat Enterprise Linux baseurl=http://apt.sw.be/redhat/el$releasever/en/$basearch/dag gpgcheck=0 enabled=0 includepkgs=clearsilver python-clearsilver trac EOF yum install -y subversion yum --enablerepo=dag install -y trac yum install -y selinux-policy-targeted-sources
#!/bin/bash # new_project.sh - Setup a new SVN/Trac project PROJECT_BASE="/srv/" PROJECT_PATH="tp" PROJECT_DESC="Test Project" PROJECT_ROOT="${PROJECT_BASE}${PROJECT_PATH}/" SVN_ROOT="${PROJECT_ROOT}svn/" TRAC_ROOT="${PROJECT_ROOT}trac/" TEMPLATES_ROOT="${PROJECT_ROOT}trac_templates" SELinux=1 # Errors E_PROJECT_EXISTS=65 if [ -e "$PROJECT_ROOT" ] then echo "Project already exists at $PROJECT_ROOT"; exit $E_PROJECT_EXISTS fi # Setup directories mkdir "$PROJECT_ROOT" svnadmin create "$SVN_ROOT" ln -s "/usr/share/trac/templates" "$TEMPLATES_ROOT" trac-admin "$TRAC_ROOT" initenv "$PROJECT_DESC" "sqlite:db/trac.db" "$SVN_ROOT" "$TEMPLATES_ROOT" # Permissions chown -R apache "$PROJECT_ROOT" chgrp -R apache "$PROJECT_ROOT" chmod -R go-rwx "$PROJECT_ROOT" if [ $SELinux ] then echo "Setting permissions for SELinux" chcon -R -u system_u -r object_r -t httpd_sys_content_t "$SVN_ROOT" "$TRAC_ROOT" fi
# /etc/http/conf.d/trac.conf # This is for testing only, and will not be used in the final version <Location /tp> Options Indexes FollowSymLinks SetHandler mod_python PythonHandler trac.web.modpython_frontend PythonOption TracEnv /srv/tp/trac PythonOption TracUriRoot /tp </Location>
