Resources‎ > ‎Tips and Tricks‎ > ‎Trac‎ > ‎

Adding a new project to a multi-project Trac site

These are just my recommendations based on my own experience, using Trac and MySql.  

First, create a new database for this project as each project requires it's own.

In MySQL, run the following, replace project name and password with the appropriate values (no spaces).

CREATE DATABASE trac_<project name> DEFAULT CHARACTER SET utf8 COLLATE utf8_bin;
GRANT ALL ON trac_<project name>.* TO trac_<project name>@localhost IDENTIFIED BY '<password>';

Next, create a new environment for your new project.

sudo trac-admin /var/trac/sites/<ProjectPath> initenv "<Project Name>" <db string>

where db string is like mysql://trac_<project_name>:trac_<project_name>@localhost[:<port>]/trac_<project_name>

This will create a folder in /var/trac/sites with the name of the project, create the required tables, and populate what's needed.

Next, change permissions so that you can administer the project.

trac-admin /var/trac/sites/<project name> permission add admin TRAC_ADMIN

Finally, as per recommended by the Trac website, change the tables to InnoDB if they're not.  Use MySQL again and run the following.

 

USE trac_<project_name>; \
ALTER TABLE `attachment` ENGINE = InnoDB; \
ALTER TABLE `auth_cookie` ENGINE = InnoDB; \
ALTER TABLE `cache` ENGINE = InnoDB; \
ALTER TABLE `component` ENGINE = InnoDB; \
ALTER TABLE `enum` ENGINE = InnoDB; \
ALTER TABLE `milestone` ENGINE = InnoDB; \
ALTER TABLE `node_change` ENGINE = InnoDB; \
ALTER TABLE `permission` ENGINE = InnoDB; \
ALTER TABLE `report` ENGINE = InnoDB; \
ALTER TABLE `repository` ENGINE = InnoDB; \
ALTER TABLE `revision` ENGINE = InnoDB; \
ALTER TABLE `session` ENGINE = InnoDB; \
ALTER TABLE `session_attribute` ENGINE = InnoDB; \
ALTER TABLE `system` ENGINE = InnoDB; \
ALTER TABLE `ticket` ENGINE = InnoDB; \
ALTER TABLE `ticket_change` ENGINE = InnoDB; \
ALTER TABLE `ticket_custom` ENGINE = InnoDB; \
ALTER TABLE `version` ENGINE = InnoDB; \
ALTER TABLE `wiki` ENGINE = InnoDB;
Comments