Skip to content

Instantly share code, notes, and snippets.

@masaki
Created May 29, 2011 11:48
Show Gist options
  • Save masaki/997683 to your computer and use it in GitHub Desktop.
Save masaki/997683 to your computer and use it in GitHub Desktop.
Trac-0.12 installation
# -*- coding: utf-8 -*-
# file: trac-install.sh
# prepare
yum install sqlite sqlite-devel mod_wsgi
easy_install pysqlite Babel Genshi pytz docutils
# or `yum install python-sqlite2 babel python-genshi pytz python-docutils`
# setup
wget http://www.i-act.co.jp/project/products/downloads/Trac-0.12.2.ja1.zip
unzip Trac-0.12.2.ja1.zip
pushd Trac-0.12.2.ja1
python setup.py extract_messages
python setup.py update_catalog -l ja
python setup.py install
[ -d "/etc/trac" ] || mkdir -p /etc/trac
cp -R contrib /etc/trac/contrib
mkdir -p /etc/trac/chrome /etc/trac/templates /etc/trac/plugins
cp -R trac/htdocs /etc/trac/chrome/common
for tmpl in trac/**/templates/*
do
cp $tmpl /etc/trac/templates
done
chown apache:wheel -R /etc/trac
chmod g+w -R /etc/trac
popd
# post-install
[ -d "/var/www/trac" ] || mkdir -p /var/www/trac
for env in /var/www/trac/*
do
if [ -d $env ]; then
trac-admin $env upgrade
trac-admin $env wiki upgrade
fi
done
cat << __EOF__ > /var/www/trac/trac_env_parent.wsgi
# -*- coding: utf-8 -*-
# file: trac_env_parent.wsgi
import sys
sys.stdout = sys.stderr
import os
os.environ['TRAC_ENV_PARENT_DIR'] = '/var/www/trac'
os.environ['PYTHON_EGG_CACHE'] = '/var/www/trac/.egg-cache'
import trac.web.main
application = trac.web.main.dispatch_request
__EOF__
chown apache:wheel -R /var/www/trac
chmod g+w -R /var/www/trac
easy_install simplejson
# or `yum install python-simplejson`
# -*- coding: utf-8 -*-
# file: trac.conf
# only once
WSGISocketPrefix /var/log/httpd
WSGIDaemonProcess trac user=apache threads=15 maximum-requests=10000
WSGIScriptAlias /trac /var/www/trac/trac_env_parent.wsgi
<Location /trac>
WSGIApplicationGroup %{GLOBAL}
WSGIProcessGroup trac
</Location>
<LocationMatch "/trac/[^/]+">
AuthType Basic
AuthName "Trac"
AuthBasicProvider ldap
AuthLDAPURL "ldap://127.0.0.1/ou=Users,dc=example,dc=jp?cn?sub?(objectClass=account)"
AuthLDAPGroupAttributeIsDN off
AuthLDAPGroupAttribute memberUid
AuthzLDAPAuthoritative off
Require ldap-group cn=trac,ou=Group,dc=example,dc=jp
</LocationMatch>
# -*- coding: utf-8 -*-
# file: trac_env_parent.wsgi
import sys
sys.stdout = sys.stderr
import os
os.environ['TRAC_ENV_PARENT_DIR'] = '/var/www/trac'
os.environ['PYTHON_EGG_CACHE'] = '/var/www/trac/.egg-cache'
import trac.web.main
application = trac.web.main.dispatch_request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment