Koozali.org: home of the SME Server

Trac on v8

Offline ReetP

  • *
  • 3,736
  • +5/-0
Trac on v8
« on: September 13, 2012, 04:47:46 PM »
Note that this NOT guaranteed to work. Proceed with care ! You may break your server

I wanted to try and install trac on my v8 server.

The version from through-ip.com is old and is for EL4. I've no experience of making RPMs so decided to just try and install it manually.

My notes follow - I can do a HowTo if need be but would like it tested first if possible. I am also using the tracd server rather than apache as I wasn't sure how the hell to make it work with Apache !

This site http://recursive-design.com/blog/2008/07/27/installing-trac-on-centos/ started me in the right direction, along with reading the trac documentation.

I decided to use a MySQL database. I also decided to use an ibay and set it to local network access only and then run tracd. It would undoubtedly be more secure to install it into /var/somewhere or /opt/somewhere and forget the ibay. I used an ibay for convenience.

I presume subversion is already installed

Make a new MySQL db called trac with user trac - I used phpmyadmin. You MUST USE UTF8 collation.

I made an ibay called trac

I think you need the following packages :

Code: [Select]
yum install python-mysqldb MySQL-python
Latest setuptools/ez_setup

Code: [Select]
wget http://pypi.python.org/packages/2.4/s/setuptools/setuptools-0.6c11-py2.4.egg#md5=bd639f9b0eac4c42497034dec2ec0c2b
sh setuptools-0.6c11-py2.4.egg --prefix=/usr

Believe we need this :

Code: [Select]
easy_install -Z Genshi==0.6
This gets the latest 0.12 release (1.0 will only run on python 2.5+) - I originally got a 0.12.3 release by mistake which has a bug relating to the daemon and creating a pid file which took me hours to figure out ! :

Code: [Select]
easy_install http://svn.edgewall.org/repos/trac/branches/0.12-stable
This gets the account manager which helps to maintain accounts and logins :

Code: [Select]
easy_install http://trac-hacks.org/svn/accountmanagerplugin/trunk
Now to setup trac :

Code: [Select]
trac-admin /home/e-smith/files/ibays/trac/html/ initenv
Use the following for the database location :

Code: [Select]
mysql://user:password#@localhost:3306/database
edit trac.ini

Make sure we are using UTF8 :

Code: [Select]
[trac]
default_charset = UTF-8

Use this Components section to enable the account manager and disable the trac web login :

Code: [Select]
[components]
acct_mgr.admin.* = enabled
acct_mgr.api.* = enabled
acct_mgr.db.sessionstore = enabled
acct_mgr.htfile.htdigeststore = disabled
acct_mgr.htfile.htpasswdstore = enabled
acct_mgr.http.httpauthstore = disabled
acct_mgr.notification.* = enabled
acct_mgr.pwhash.htdigesthashmethod = enabled
acct_mgr.pwhash.htpasswdhashmethod = disabled
acct_mgr.register.* = enabled
acct_mgr.svnserve.* = enabled
acct_mgr.svnserve.svnservepasswordstore = disabled
acct_mgr.web_ui.* = enabled
trac.web.auth.loginmodule = disabled

Setup email in :

Code: [Select]
[notification]
admit_domains = mydomain.com
always_notify_owner = false
always_notify_reporter = false
always_notify_updater = true
ambiguous_char_width = single
email_sender = SmtpEmailSender
ignore_domains =
mime_encoding = none
sendmail_path = sendmail
smtp_always_bcc =
smtp_always_cc =
smtp_default_domain = mydomain.com
smtp_enabled = true
smtp_from = trac@mydomain.com
smtp_from_name =
smtp_password =
smtp_port = 25
smtp_replyto = trac@localhost
smtp_server = localhost
smtp_subject_prefix = __default__
smtp_user =
ticket_subject_template = $prefix #$ticket.id: $summary
use_public_cc = False
use_short_addr = false
use_tls = false

Add an admin user :

Code: [Select]
trac-admin /home/e-smith/files/ibays/trac/html permission add username TRAC_ADMIN

test run tracd :

Code: [Select]
/usr/bin/tracd --port 8000 /home/e-smith/files/ibays/trac/html/your_project
You should now be able to create a new username account which should have admin privileges. You should also be able to add in your repos via the Account Manager.

If that works, you can create /etc/init.d/tracd as follows - note there is no 'restart' and you need to add start and stops in etc/rc.d/rc7.d etc :

Code: [Select]
#! /bin/bash
#
# chkconfig: - 85 15
# description: tracd
# processname: tracd
# pidfile: /var/run/tracd.pid

# Source function library.
. /etc/rc.d/init.d/functions

## Options you should probably change ##
# If you only want to serve one project keep this variable
# empty and set the PROJECT_ENV variable
ENV_PARENT_DIR=
PROJECT_ENV=/home/e-smith/files/ibays/trac/html/reetp/
PORT=9090
# add any additional options (such as authentication) here. If you only have one
# project you should probably add -s here
# ADDITIONAL_OPTS="--basic-auth *,/myproject/trac/htpasswd,/myproject/trac /myproject/trac"

# I only use one project and authentication to the MySQL db so use this.
ADDITIONAL_OPTS="-s"

DAEMON=/usr/bin/tracd
NAME=tracd
DESC="web server"
PIDFILE=/var/run/$NAME.pid
SCRIPTNAME=/etc/init.d/$NAME

test -x $DAEMON || exit 1

set -e

DAEMON_OPTS="--daemonize --pidfile=$PIDFILE --port=$PORT $ADDITIONAL_OPTS"
if [ -n "$ENV_PARENT_DIR" ]; then
        DAEMON_OPTS="$DAEMON_OPTS --env-parent-dir=$ENV_PARENT_DIR"
else
        DAEMON_OPTS="$DAEMON_OPTS $PROJECT_ENV"
fi

LOCKFILE=${LOCKFILE-/var/lock/subsys/tracd}
RETVAL=0


start() {
        if [ -a $LOCKFILE ];
        then
                echo "tracd appears to be running, or has crashed, or was not stopped properly."
                echo "check $PIDFILE, and remove $LOCKFILE to start again."
                return -1;
        fi

        echo -n $"Starting $NAME: "
        LANG=$TRACD_LANG $DAEMON $DAEMON_OPTS
        RETVAL=$?
        echo
        [ $RETVAL = 0 ] && touch ${LOCKFILE}
        return $RETVAL
}
stop() {
        if [ -a $PIDFILE ]
        then
                echo -n $"Stopping $NAME: "
                kill -9 `cat ${PIDFILE}`
                RETVAL=$?
                echo
                [ $RETVAL = 0 ] && rm -f ${LOCKFILE} ${PIDFILE}
        else
                echo "tracd appears not to be running."
        fi
}

# See how we were called.
case "$1" in
  start)
        start
        ;;
  stop)
        stop
        ;;
  *)
        echo $"Usage: $NAME {start|stop}"
        exit 1
esac

exit $RETVAL

I'd be pleased to hear for anyone who has a go or has any comments. I don't guarantee to be able to fix it, but I'll look at it. I am going to fire up a test server again and try to test it myself. I may also try to get it work with Apache.

I'd therefore be grateful for anyone who knows how to get it working correctly with Apache. I did look in the through-ip.com rpm to see how it worked, but it boggled my mind a bit :-)

B. Rgds
John
...
1. Read the Manual
2. Read the Wiki
3. Don't ask for support on Unsupported versions of software
4. I have a job, wife, and kids and do this in my spare time. If you want something fixed, please help.

Bugs are easier than you think: http://wiki.contribs.org/Bugzilla_Help

If you love SME and don't want to lose it, join in: http://wiki.contribs.org/Koozali_Foundation

Offline cactus

  • *
  • 4,880
  • +3/-0
    • http://www.snetram.nl
Re: Trac on v8
« Reply #1 on: September 13, 2012, 10:16:07 PM »
Please post howto's in the wiki, where it is much easier for people to comment and amend in the future. Thanks in advance.
Be careful whose advice you buy, but be patient with those who supply it. Advice is a form of nostalgia, dispensing it is a way of fishing the past from the disposal, wiping it off, painting over the ugly parts and recycling it for more than its worth ~ Baz Luhrmann - Everybody's Free (To Wear Sunscreen)

Offline ReetP

  • *
  • 3,736
  • +5/-0
Re: Trac on v8
« Reply #2 on: September 14, 2012, 12:12:33 AM »
Please post howto's in the wiki, where it is much easier for people to comment and amend in the future. Thanks in advance.

Thanks.

As I mentioned, this is far from refined and I wondered if anyone else would care to comment before I do a HowTo. I'd rather do something a little more polished and complete ! Hence I posted here where it is more likely to be read & tested.

If I receive no feedback I'll publish & be damned :-)
...
1. Read the Manual
2. Read the Wiki
3. Don't ask for support on Unsupported versions of software
4. I have a job, wife, and kids and do this in my spare time. If you want something fixed, please help.

Bugs are easier than you think: http://wiki.contribs.org/Bugzilla_Help

If you love SME and don't want to lose it, join in: http://wiki.contribs.org/Koozali_Foundation