| 19 | |
| 20 | == Creating an Environment == |
| 21 | |
| 22 | A new Trac environment is created using [wiki:TracAdmin trac-admin]: |
| 23 | {{{ |
| 24 | $ trac-admin /path/to/projectenv initenv |
| 25 | }}} |
| 26 | |
| 27 | [wiki:TracAdmin trac-admin] will ask you for the name of the project, the |
| 28 | database connection string (explained below), and the type and the path |
| 29 | to your source code repository. |
| 30 | |
| 31 | ''Note: The web server user will require file system write permission to |
| 32 | the environment directory and all the files inside. Please remember to set |
| 33 | the appropriate permissions. The same applies to the Subversion repository |
| 34 | Trac is eventually using, although Trac will only require read access as long |
| 35 | as you're not using the BDB file system.'' |
| 36 | |
| 37 | == Database Connection Strings == |
| 38 | |
| 39 | Since version 0.9, Trac supports both [http://sqlite.org/ SQLite] and |
| 40 | [http://www.postgresql.org/ PostgreSQL] as database backends. The default |
| 41 | is to use SQLite, which is probably sufficient for most projects. The database file |
| 42 | is then stored in the environment directory, and can easily be |
| 43 | [wiki:TracBackup backed up] together with the rest of the environment. |
| 44 | |
| 45 | The connection string for an embedded SQLite database is: |
| 46 | {{{ |
| 47 | sqlite:db/trac.db |
| 48 | }}} |
| 49 | |
| 50 | If you want to use PostgreSQL instead, you'll have to use a different |
| 51 | connection string. For example, to connect to a database on the same |
| 52 | machine called `trac`, that allows access to the user `johndoe` with |
| 53 | the password `letmein`, use: |
| 54 | {{{ |
| 55 | postgres://johndoe:letmein@localhost/trac |
| 56 | }}} |
| 57 | |
| 58 | If PostgreSQL is running on a non-standard port (for example 9342), use: |
| 59 | {{{ |
| 60 | postgres://johndoe:letmein@localhost:9342/trac |
| 61 | }}} |
| 62 | |
| 63 | Note that with PostgreSQL you will have to create the database before running |
| 64 | `trac-admin initenv`. |
| 65 | |
| 66 | And make sure PostgreSQl DB name is "trac". What worked for me: |
| 67 | And didn't work uppercase trac-user-name |
| 68 | {{{ |
| 69 | sudo su - postgres -c createdb trac |
| 70 | sudo su - postgres -c psql trac |
| 71 | CREATE USER trac-user-name WITH PASSWORD 'trac-pass-name'; |
| 72 | }}} |
| 73 | |
| 74 | == Source Code Repository == |
| 75 | |
| 76 | You'll first have to provide the ''type'' of your repository (e.g. `svn` for Subversion, |
| 77 | which is the default), then the ''path'' where the repository is located. |
| 78 | |
| 79 | If you don't want to use Trac with a source code repository, simply leave the ''path'' empty |
| 80 | (the ''type'' information doesn't matter, then). |
| 81 | |
| 82 | For some systems, it is possible to specify not only the path to the repository, |
| 83 | but also a ''scope'' within the repository. Trac will then only show information |
| 84 | related to the files and changesets below that scope. The Subversion backend for |
| 85 | Trac supports this; for other types, check the corresponding plugin's documentation. |
| 86 | |
| 87 | Example of a configuration for a Subversion repository: |
| 88 | {{{ |
| 89 | [trac] |
| 90 | repository_type = svn |
| 91 | repository_dir = /path/to/your/repository |
| 92 | }}} |
| 93 | |
| 94 | The configuration for a scoped Subversion repository would be: |
| 95 | {{{ |
| 96 | [trac] |
| 97 | repository_type = svn |
| 98 | repository_dir = /path/to/your/repository/scope/within/repos |
| 99 | }}} |
| 100 | |
| 101 | == Directory Structure == |
| 102 | |
| 103 | An environment directory will usually consist of the following files and directories: |
| 104 | |
| 105 | * `README` - Brief description of the environment. |
| 106 | * `VERSION` - Contains the environment version identifier. |
| 107 | * `attachments` - Attachments to wiki pages and tickets are stored here. |
| 108 | * `conf` |
| 109 | * `trac.ini` - Main configuration file. See TracIni. |
| 110 | * `db` |
| 111 | * `trac.db` - The SQLite database (if you're using SQLite). |
| 112 | * `plugins` - Environment-specific [wiki:TracPlugins plugins] (Python eggs) |
| 113 | * `templates` - Custom environment-specific templates. |
| 114 | * `site_css.cs` - Custom CSS rules. |
| 115 | * `site_footer.cs` - Custom page footer. |
| 116 | * `site_header.cs` - Custom page header. |
| 117 | * `wiki-macros` - Environment-specific [wiki:WikiMacros Wiki macros]. |
| 118 | |
| 119 | '''Note: don't confuse a Trac environment directory with the Source Code Repository directory. |
| 120 | It happens that the above structure is loosely modelled after the Subversion repository directory |
| 121 | structure, but they are not and ''must not'' be located at the same place.''' |
| 122 | |
| 123 | ---- |
| 124 | See also: TracAdmin, TracBackup, TracIni, TracGuide |
| 125 | |
| 126 | |
| 127 | |
| 128 | |