Changes between Version 58 and Version 59 of TracEnvironment
- Timestamp:
- Jan 3, 2015, 10:36:25 AM (9 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
TracEnvironment
v58 v59 3 3 [[PageOutline]] 4 4 5 Trac uses a directory structure and a database for storing project data. The directory is referred to as the “environment”.5 Trac uses a directory structure and a database for storing project data. The directory is referred to as the environment. 6 6 7 7 == Creating an Environment 8 8 9 A new Trac environment is created using 9 A new Trac environment is created using [TracAdmin#initenv trac-admin's initenv]: 10 10 {{{#!sh 11 11 $ trac-admin /path/to/myproject initenv 12 12 }}} 13 13 14 `trac-admin` will ask you for the name of the project and the 15 database connection string (explained below). 14 `trac-admin` will ask you for the name of the project and the database connection string, see below. 16 15 17 === SomeUseful Tips16 === Useful Tips 18 17 19 - Place your environment's directory on a filesystem which supports sub-second timestamps, as Trac monitors the timestamp of its configuration files and changes happening on a filesystem with too coarse-grained timestamp resolution may go undetected in Trac < 1.0.2 (this is also true for the location of authentication files when using TracStandalone).18 - Place your environment's directory on a filesystem which supports sub-second timestamps, as Trac monitors the timestamp of its configuration files and changes happening on a filesystem with too coarse-grained timestamp resolution may go undetected in Trac < 1.0.2. This is also true for the location of authentication files when using TracStandalone. 20 19 21 20 - The user under which the web server runs will require file system write permission to … … 26 25 - `initenv`, when using an svn repository, does not imply that trac-admin will perform `svnadmin create` for the specified repository path. You need to perform the `svnadmin create` prior to `trac-admin initenv` if you're creating a new svn repository altogether with a new trac environment, otherwise you will see a message "Warning: couldn't index the repository" when initializing the environment. 27 26 28 - Non-ascii environment paths are not supported 27 - Non-ascii environment paths are not supported. 29 28 30 - Also, it seems that project names with spaces can be problematic for authentication (see [trac:#7163]).29 - Also, it seems that project names with spaces can be problematic for authentication, see [trac:#7163]. 31 30 32 31 - TracPlugins located in a [TracIni#inherit-section shared plugins folder] that is defined in an [TracIni#GlobalConfiguration inherited configuration] are currently not loaded during creation, and hence, if they need to create extra tables for example, you'll need to [TracUpgrade#UpgradetheTracEnvironment upgrade the environment] before being able to use it. … … 34 33 == Database Connection Strings 35 34 36 Trac supports [http://sqlite.org/ SQLite], [http://www.postgresql.org/ PostgreSQL] and [http://mysql.com/ MySQL] database backends. The default is to use SQLite, which is probably sufficient for most projects. The database 37 file is then stored in the environment directory, and can easily be 38 [wiki:TracBackup backed up] together with the rest of the environment. 35 Trac supports [http://sqlite.org/ SQLite], [http://www.postgresql.org/ PostgreSQL] and [http://mysql.com/ MySQL] database backends. The default is SQLite, which is probably sufficient for most projects. The database file is then stored in the environment directory, and can easily be [wiki:TracBackup backed up] together with the rest of the environment. 39 36 40 37 Note that if the username or password of the connection string (if applicable) contains the `:`, `/` or `@` characters, they need to be URL encoded. … … 48 45 49 46 === PostgreSQL Connection String 50 If you want to use PostgreSQL or MySQL instead, you'll have to use a 51 different connection string. For example, to connect to a PostgreSQL 52 database on the same machine called `trac`, that allows access to the 53 user `johndoe` with the password `letmein`, use: 47 If you want to use PostgreSQL instead, you'll have to use a different connection string. For example, to connect to a PostgreSQL database on the same machine called `trac` for user `johndoe` with the password `letmein` use: 54 48 {{{ 55 49 postgres://johndoe:letmein@localhost/trac 56 50 }}} 57 51 58 If PostgreSQL is running on a non-standard port (for example 9342), use:52 If PostgreSQL is running on a non-standard port, for example 9342, use: 59 53 {{{ 60 54 postgres://johndoe:letmein@localhost:9342/trac 61 55 }}} 62 56 63 On UNIX, you might want to select a UNIX socket for the transport, 64 either the default socket as defined by the PGHOST environment variable: 57 On UNIX, you might want to select a UNIX socket for the transport, either the default socket as defined by the PGHOST environment variable: 65 58 {{{ 66 59 postgres://user:password@/database … … 71 64 }}} 72 65 73 Note that with PostgreSQL you will have to create the database before running 74 `trac-admin initenv`. 66 Note that with PostgreSQL you will have to create the database before running `trac-admin initenv`. 75 67 76 68 See the [http://www.postgresql.org/docs/ PostgreSQL documentation] for detailed instructions on how to administer [http://postgresql.org PostgreSQL]. 77 Generally, the following is sufficient to create a database user named `tracuser` , and a database named `trac`.69 Generally, the following is sufficient to create a database user named `tracuser` and a database named `trac`: 78 70 {{{#!sh 79 71 $ createuser -U postgres -E -P tracuser … … 88 80 }}} 89 81 90 Trac uses the `public` schema by default but you can specify a different schema in the connection string:82 Trac uses the `public` schema by default, but you can specify a different schema in the connection string: 91 83 {{{ 92 84 postgres://user:pass@server/database?schema=yourschemaname … … 95 87 === MySQL Connection String 96 88 97 The format of the MySQL connection string is similar to the examples presented for PostgreSQL, with the `postgres` scheme being replaced by `mysql`. For example, to connect to a MySQL 98 database on the same machine called `trac`, allowing access to the 99 user `johndoe` with the password `letmein`, the mysql connection string is: 89 The format of the MySQL connection string is similar to those for PostgreSQL, with the `postgres` scheme being replaced by `mysql`. For example, to connect to a MySQL database on the same machine called `trac` for user `johndoe` with password `letmein`, the MySQL connection string is: 100 90 {{{ 101 91 mysql://johndoe:letmein@localhost:3306/trac … … 104 94 == Source Code Repository 105 95 106 Since version 0.12, a single Trac environment can be connected to more than one repository. There are many different ways to connect repositories to an environment, see TracRepositoryAdmin. This page also details the various attributes that can be set for a repository (like `type`, `url`, `description`).96 Since Trac 0.12, a single environment can be connected to more than one repository. There are many different ways to connect repositories to an environment, see TracRepositoryAdmin. This page also details the various attributes that can be set for a repository, such as `type`, `url`, `description`. 107 97 108 98 In Trac 0.12 `trac-admin` no longer asks questions related to repositories. Therefore, by default Trac is not connected to any source code repository, and the ''Browse Source'' toolbar item will not be displayed. 109 You can also explicitly disable the `trac.versioncontrol.*` components (which are otherwise still loaded)99 You can also explicitly disable the `trac.versioncontrol.*` components, which are otherwise still loaded. 110 100 {{{#!ini 111 101 [components] … … 113 103 }}} 114 104 115 For some version control systems, it is possible to specify not only the path to the repository, 116 but also a ''scope'' within the repository. Trac will then only show information 117 related to the files and changesets below that scope. The Subversion backend for 118 Trac supports this; for other types, check the corresponding plugin's documentation. 105 For some version control systems, it is possible to specify not only the path to the repository, but also a ''scope'' within the repository. Trac will then only show information related to the files and changesets below that scope. The Subversion backend for Trac supports this. For other types, check the corresponding plugin's documentation. 119 106 120 107 Example of a configuration for a Subversion repository used as the default repository: … … 137 124 138 125 * `README` - Brief description of the environment. 139 * `VERSION` - Contains the environment version identifier.126 * `VERSION` - Environment version identifier. 140 127 * `attachments` - Attachments to wiki pages and tickets are stored here. 141 128 * `conf` 142 129 * `trac.ini` - Main configuration file. See TracIni. 143 130 * `db` 144 * `trac.db` - The SQLite database (if you're using SQLite).145 * `htdocs` - directory containing web resources, which can be referenced in Genshi templates using `/htdocs/site/...` URLs.146 * `log` - default directory for log files, if logging is turned on and a relative path is given.147 * `plugins` - Environment-specific [wiki:TracPlugins plugins] 131 * `trac.db` - The SQLite database, if you are using SQLite. 132 * `htdocs` - Directory containing web resources, which can be referenced in Genshi templates using `/htdocs/site/...` URLs. 133 * `log` - Default directory for log files, if logging is turned on and a relative path is given. 134 * `plugins` - Environment-specific [wiki:TracPlugins plugins]. 148 135 * `templates` - Custom Genshi environment-specific templates. 149 * `site.html` - method to customize header, footer, and style, described in TracInterfaceCustomization#SiteAppearance136 * `site.html` - Method to customize header, footer, and style, described in TracInterfaceCustomization#SiteAppearance. 150 137 151 138 === Caveat: don't confuse a ''Trac environment directory'' with the ''source code repository directory'' #Caveat