Using Trac for Teaching
This is something I wrote up a while back (Trac 0.9). Now it's even easier since 0.10 doesn't need the svn backend.
Using Trac in a Teaching Environment
Obviously, some paths and usernames/groups etc may need to be changed…
- Install trac. I used 0.9.6.
- Create the repository (fake)
- svnadmin create /var/www/svn/teacher
- TMPDIR=`mktemp -d`
- svn import "${TMPDIR}" file:////var/www/svn/teacher -m "initial setup"
- rm -rf "${TMPDIR}"
- chown -R apache.apache /var/www/svn/teacher
- Create the trac project
- trac-admin /var/www/svn/teacher initenv "Mrs. M Web World" sqlite:db/trac.db /var/www/svn/teacher /usr/share/trac/templates
- chown -R apache.apache /var/www/trac/teacher
- trac-admin /var/www/svn/teacher permission add "Admin" "TRAC_ADMIN"
- Set up Apache as needed…
- htpasswd -cm /var/www/trac/teacher/.htpasswd Admin
- htpasswd -m /var/www/trac/teacher/.htpasswd Teacher
- htpasswd -m /var/www/trac/teacher/.htpasswd TestStudent [pwd: test]
- Create/modify trac.conf in Apache's conf.d directory (see below)
- (Test login at this point)
- Install some needed plugins
- Now we need to edit trac itself, to make it look nicer for student interface:
- Edit /usr/lib/python2.3/site-packages/trac/ticket/web_ui.py
- Search for "New Ticket" within a util.Markup() call and change it to "New Question"
- Edit /usr/lib/python2.3/site-packages/trac/ticket/roadmap.py
- Search for "Roadmap" within a Markup() call (with accesskey 3) and change it to "Syllabus"
- Edit trac.ini as needed:
- I changed the [header_logo] with an image of the county school system and associated link.
- Make sure the various plugins are enabled/disabled in [components] section of trac.ini (see below)
- Login again (as 'Admin'). You should have an 'Admin option'.
- Permissions. I made two groups "@teachers" and "@students".
- @students get TICKET_APPEND, TICKET_CREATE, TICKET_VIEW, ROADMAP_VIEW, MILESTONE_VIEW, WIKI_VIEW
- @teachers get TICKET_ADMIN, WIKI_ADMIN, MILESTONE_ADMIN, ROADMAP_VIEW
- At this point, we're done with the main server stuff (until the term starts and you need to add more users as above). Now the teacher can customize with that login (recommended).
- My recommendations:
- Milestones:
- These should be based on the syllabus (that's what the students see it as). I assume each major section of the class would get one. The "due date" could be the Monday of the Quiz week or something similar.
- Ticket types: General Question and Clarification Request
- Components: None (removed them all)
- Priorities: None (removed them all)
- Severities: None (removed them all)
- Versions: None (removed them all)
- Milestones:
httpd.conf
Alias /trac/ "/usr/share/trac/htdocs/" <Location /teacher> SetHandler mod_python PythonHandler trac.web.modpython_frontend PythonOption TracEnv /var/www/trac/teacher AuthType Basic AuthName "Mrs. M's Web World" AuthUserFile /var/www/trac/teacher/.htpasswd Require valid-user </Location>
trac.ini excerpts
[components] webadmin.* = enabled trac.wiki.macros.macrolistmacro = disabled trac.versioncontrol.web_ui.log.logmodule = disabled trac.about = disabled trac.search.searchmodule = disabled ticketdelete.* = enabled trac.versioncontrol.web_ui.changeset.changesetmodule = disabled trac.ticket.web_ui.updatedetailsfortimeline = disabled trac.mimeview.patch.patchrenderer = disabled trac.mimeview.rst.restructuredtextrenderer = disabled trac.wiki.macros.pageoutlinemacro = disabled trac.attachment.attachmentmodule = disabled trac.wiki.macros.imagemacro = disabled trac.versioncontrol.web_ui.browser.browsermodule = disabled trac.mimeview.php.phprenderer = disabled trac.timeline.timelinemodule = disabled
The opposite of chmod
Well, I've been using Unix for since 1993, and I just realized I don't know what the opposite of chmod
is - how do I just show the permissions, not set them? lsmod
is Linux kernel module listing. So, I used stat
which is likely overkill. But sadly that took me a while to think of.
Rsync over ssh for backing up some files
- Make a file with the ssh user and password called
/etc/backupcredentials_ssh
- Make a directory on the backup server called
/mnt/backup/this_hostname/
- Make sure it is owned by
backup_user
- Make sure it is owned by
- Make a directory on the backup server called
rsync -av --delete -e ssh -l backup_user -i /etc/backupcredentials_ssh /mnt/backup backup_server:/mnt/backup/this_hostname/
This way I was able to avoid using a samba mount between the two.
Automated diffs in trac
Somebody on the mailing list for trac wanted to make a daily wiki page with the diffs for a build. He already had the scripts to do a nightly build, so I suggested this, and tried it and it worked:
echo {{{ > /tmp/tempo echo '#!diff' >> /tmp/tempo svn diff -r70:76 >> /tmp/tempo echo }}} > /tmp/tempo trac-admin /var/www/trac/personal wiki import TodaysDiff /tmp/tempo