Adding Trac Site
From IthrynWiki
To add a trac site such as tab you must have an existing subversion repository. For this example we'll say that your repository exists in /hosts/ithryn/repos/svn/example-repo.
Contents |
Creating Trac DB
Trac needs a database to store all its nifty information such as bugs, wiki entries, etc. You need to create and initialize the trac db by issuing the following command and answering a few questions. The default values of the questions should work fine except make sure you enter the correct information about the location of your subversion repository.
$ trac-admin /hosts/ithryn/repos/svn/example-repo/trac init
The successful completion of this command will create a trac db in /hosts/ithryn/repos/svn/example-repo/trac/.
Now that the trac db is created you need to give the webserver write privileges to the trac db.
Configuring Web Server
There are some configuring changes necessary to tell the web server about your newly create trac environment. You need to create a file in /etc/apache2/sites-includes; to maintain the naming conventions simply execute
$ sudo cp /etc/apache2/sites-includes/trac.tab.inc /etc/apache2/sites/includes/trac.example.inc
Now edit the newly created file /etc/apache2/sites/includes/trac.example.inc and replace all references to the tab subversion repository to references your example repository. Lastly, make sure that you include your new file in /etc/apache2/sites-available/trac.ithryn.net.
Finally restart the apache web server
$ sudo /etc/init.d/apache2 restart
hopefully you should be able to visit the example to see your newly created trac environment.
Upgrading Trac DB
This section could also be considered "Bringing Trac Sites Back from the Dead!
If you are your trac/SVN repo is fairly recent you may be able to get away with simply running these lines:
$ sudo trac-admin /hosts/ithryn/repos/svn/SOME_REPO_NAME/trac upgrade $ sudo trac-admin /hosts/ithryn/repos/svn/SOME_REPO_NAME/trac wiki upgrade
Fixing trac-admin Upgrade Errors
- Error: pysqlite2.dbapi2.OperationalError: no such column: kind
$ cd /hosts/ithryn/repos/svn/SOME_REPO_NAME/trac $ sudo sqlite3 db/trac.db "update system set value=20 where name='database_version'"
Now retry running trac-admin ... upgrade described above.
- Can't synchronize with the repository (Missing "youngest_rev" in cache metadata).
$ sudo sqlite3 /hosts/ithryn/repos/svn/SOME_REPO_NAME/trac/db/trac.db "insert into system values ('youngest_rev', );"
- Error: ...file is encrypted or is not a database...
This is generally caused by your trac database being really old and a version previous to sqlite3. You can verify that it is the database version is <3 by opening the trac.db file in a text editor and looking at the first few bytes of ASCII text. If you see something like SQLite format 2.8 run the commands below:
$ cd /hosts/ithryn/repos/svn/SOME_REPO_NAME/trac/db $ sudo mv trac.db trac2.db $ sudo sqlite trac2.db .dump | sqlite3 trac.db
Now retry running trac-admin ... upgrade described above.
- Berkeley DB error for filesystem '/hosts/ithryn/repos/svn/.../db' while opening environment
Sometimes trac errors can be caused by a corrupt or out of date svn repo. You can try running svnadmin recover command
$ sudo svnadmin recover /hosts/ithryn/repos/svn/SOME_REPO_NAME
- Other Errors
Also make sure Apache and trac can write to the SVN/trac repos:
$ sudo chown -R www-data:svn /hosts/ithryn/repos/svn/SOME_REPO_NAME
