Changes between Version 3 and Version 4 of TracEnvironment


Ignore:
Timestamp:
Dec 30, 2016, 2:54:46 AM (7 years ago)
Author:
trac
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • TracEnvironment

    v3 v4  
    1 = Trac Environment = #TracEnvironment
     1= The Trac Environment
    22
    3 Trac はプロジェクトのデータを保存するために、ディレクトリ構造とデータベースを使用します。このディレクトリを "Environment" と呼びます。
     3[[TracGuideToc]]
     4[[PageOutline(2-5,Contents,pullout)]]
    45
    5 == Environment の作成 == #CreatinganEnvironment
     6Trac uses a directory structure and a database for storing project data. The directory is referred to as the environment.
     7Trac uses a directory structure and a database for storing project data. The directory is referred to as the '''environment'''.
    68
    7 新しい Trac Environment を作成するには、 [TracAdmin#initenv trac-admin の initenv] を使用します:
    8 {{{
     9Trac supports [http://sqlite.org/ SQLite], [http://www.postgresql.org/ PostgreSQL] and [http://mysql.com/ MySQL] databases. With PostgreSQL and MySQL you have to create the database before running `trac-admin initenv`.
     10
     11== Creating an Environment
     12
     13A new Trac environment is created using the [TracAdmin#initenv initenv] command:
     14{{{#!sh
    915$ trac-admin /path/to/myproject initenv
    1016}}}
    1117
    12 `trac-admin` はプロジェクトの名前とデータベースに接続するための文字列
    13 (後で説明します) を尋ねてきます。
     18`trac-admin` will ask you for the name of the project and the [#DatabaseConnectionStrings database connection string].
    1419
    15 === Tips === #SomeUsefulTips
    16  - Environment のディレクトリ配下は、 Web サーバの実行ユーザが書き込み可能でなければなりません。
    17  適切なパーミッションの付与を忘れないようにしてください。
    18  同じことがソースコードリポジトリにも当てはまりますが、
    19  Subversion リポジトリの場合は、ファイルシステムに Barkley DB を使用していない場合は、 Trac は読み取りパーミッションしか必要としません。 Subversion以外のリポジトリについては、各々のプラグインを確認してください
     20=== Useful Tips
    2021
    21  - `initenv` で Subversion リポジトリを使用するように指定されても、 trac-admin コマンドは指定されたリポジトリのパスに対して `svnadmin create` を実行したりしません。新しい Trac enviroment を作るときに、 Subversion リポジトリも新規で作る場合は、 `svnadmin create` は `trac-admin initenv` よりも前に実行しておいてください。 Environment の初期化中にリポジトリが見つからない場合、 "Warning: couldn't index the repository" というメッセージが表示されてしまいます
     22 - 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.
    2223
    23  - 非 ASCII 文字を含むパスはサポートされていません
     24 - The user under which the web server runs will require file system write permission to the environment directory and all the files inside. Please remember to set the appropriate permissions. The same applies to the source code repository, although the user under which Trac runs will only require write access to a Subversion repository created with the BDB file system; for other repository types, check the corresponding plugin's documentation.
     25 
     26 - `initenv` does not create a version control repository for the specified path. If you wish to specify a default repository using optional the arguments to `initenv` you must create the repository first, otherwise you will see a message when initializing the environment: //Warning: couldn't index the default repository//.
    2427
    25  - プロジェクト名に空白文字が混じっていると認証で問題が生じることがありますので注意してください  ([trac:#7163 #7163] を参照して下さい。)
     28 - Non-ascii environment paths are not supported.
    2629
    27  - [TracIni#GlobalConfiguration グローバル設定ファイル] に定義した [TracIni#inherit-section 共有するプラグインのディレクトリ] に配置した TracPlugins は Environment の作成時はロードされないようになりました。そのため、データベースのテーブルなどを追加で作成する必要がある場合は [TracUpgrade#UpgradetheTracEnvironment Environment をアップグレード] せねばなりません
     30 - TracPlugins located in a [TracIni#inherit-section shared plugins folder] that is defined in an [TracIni#GlobalConfiguration inherited configuration] are not loaded during creation, and hence, if they need to create extra tables for example, you'll need to [TracUpgrade#UpgradetheTracEnvironment upgrade the environment]. Alternatively you can avoid the need to upgrade the environment by specifying a configuration file at the time the environment is created, using the `--config` option. See TracAdmin#FullCommandReference for more information.
    2831
    29 == データベースに接続するための文字列 == #DatabaseConnectionStrings
     32{{{#!div style="border: 1pt dotted; margin: 1em"
     33**Caveat:** don't confuse the //Trac environment directory// with the //source code repository directory//.
    3034
    31 バージョン 0.9 以降、 Trac は [http://sqlite.org/ SQLite] と
    32 [http://www.postgresql.org/ PostgreSQL] データベースバックエンドの両方をサポートします。
    33 [http://mysql.com/ MySQL] のサポートは 0.10 で加えられました。 デフォルトでは
    34 SQLiLte を使用します。 (ほとんどのプロジェクトは SQLite で十分です)。データベース
    35 ファイルは Environment ディレクトリに保存されますので、 Environment の残りと共に容易に
    36 [wiki:TracBackup バックアップ] することができます。
     35This is a common beginners' mistake.
     36It happens that the structure for a Trac environment is loosely modeled after the Subversion repository directory structure, but those are two disjoint entities and they are not and //must not// be located at the same place.
     37}}}
    3738
    38 === SQLite の接続文字列 === #SQLiteConnectionString
    39 SQLite データベースに接続するための文字列は以下の通りです:
     39== Database Connection Strings
     40
     41You will need to specify a database connection string at the time the environment is created. The default is SQLite, which is probably sufficient for most projects. The SQLite database file is stored in the environment directory, and can easily be [wiki:TracBackup backed up] together with the rest of the environment.
     42
     43Note that if the username or password of the connection string (if applicable) contains the `:`, `/` or `@` characters, they need to be URL encoded.
     44
     45=== SQLite Connection String
     46
     47The connection string for an SQLite database is:
    4048{{{
    4149sqlite:db/trac.db
    4250}}}
    43 `db/trac.db` の箇所は Trac Environment のデータベースファイルへのパスを指します。
     51where `db/trac.db` is the path to the database file within the Trac environment.
    4452
    45 === PostgreSQL の接続文字列 === #PostgreSQLConnectionString
    46 PostgreSQL や MySQL を代わりに使用する場合、異なる接続用文字列を
    47 使用しなければなりません。 例えば PostgreSQL に接続するとき、
    48 ユーザ名 `johndoe` でパスワード `letmein` で
    49 同じマシンの `trac` と呼ばれるデータベースに接続するには以下のように指定します:
     53=== PostgreSQL Connection String
     54
     55The connection string for PostgreSQL is a bit more complex. For example, to connect to a PostgreSQL database named `trac` on `localhost` for user `johndoe` and password `letmein`, use:
    5056{{{
    5157postgres://johndoe:letmein@localhost/trac
    5258}}}
    53 ''"/" 及び "@" はパスワードの一部として使用出来ないので注意してください''
    5459
    55 PostgreSQL がデフォルト以外のポート番号 (例えば、 9432) で起動しているときはこのようにします:
     60If PostgreSQL is running on a non-standard port, for example 9342, use:
    5661{{{
    5762postgres://johndoe:letmein@localhost:9342/trac
    5863}}}
    5964
    60 UNIX ホストでは、 UNIX ソケットで接続するように設定できます。
    61 この場合、環境変数 PGHOST に定義されたデフォルトソケットを使用します:
     65On UNIX, you might want to select a UNIX socket for the transport, either the default socket as defined by the PGHOST environment variable:
    6266{{{
    6367postgres://user:password@/database
    6468}}}
    65 ソケットを特定する場合はこうです:
     69
     70or a specific one:
    6671{{{
    6772postgres://user:password@/database?host=/path/to/socket/dir
    6873}}}
    6974
    70 PostgreSQL を使用するとき、 `trac-admin initenv` を実行する前に
    71 データベースを作成しなければいけません。
    72 
    73 [http://postgresql.org PostgreSQL] の詳細設定の方法については [http://www.postgresql.org/docs/ PostgreSQL ドキュメント] を参照してください。
    74 下記は `tracuser` という名のデータベースユーザ及び `trac` という名のデータベースを作成します。
    75 {{{
    76 createuser -U postgres -E -P tracuser
    77 createdb -U postgres -O tracuser -E UTF8 trac
    78 }}}
    79 `createuser` を実行する時、'tracuser' のパスワードの入力を促されます。この新しいユーザはスーパーユーザではないので、他のデータベースを作ったり、他の role (訳注: PostgreSQL でのユーザ) を作る権限を与えられていません。これらの権限は trac のインスタンスを実行する為には必要ではありません。ユーザにパスワードを付与したくない場合、 `createuser` コマンドから `-P` と `-E` オプションを取り除いてください。また、データベースが UTF8 で作成する必要があることに注意してください。 LATIN1 のエンコードが原因のエラーを引き起こします。 SQL_ASCII でも同様です。
    80 
    81 デフォルト設定 (debian) の下では、 `postgres` ユーザとして `createuser` と `createdb` スクリプトを実行してください。 例えば:
    82 {{{
    83 sudo su - postgres -c 'createuser -U postgres -S -D -R -E -P tracuser'
    84 sudo su - postgres -c 'createdb -U postgres -O tracuser -E UTF8 trac'
     75See the [http://www.postgresql.org/docs/ PostgreSQL documentation] for detailed instructions on how to administer [http://postgresql.org PostgreSQL].
     76Generally, the following is sufficient to create a database user named `tracuser` and a database named `trac`:
     77{{{#!sh
     78$ createuser -U postgres -E -P tracuser
     79$ createdb -U postgres -O tracuser -E UTF8 trac
    8580}}}
    8681
    87 Trac はデフォルトで `public` スキーマを使用しますが、明示的に違うスキーマを指定することができます:
     82When running `createuser` you will be prompted for the password for the user 'tracuser'. This new user will not be a superuser, will not be allowed to create other databases and will not be allowed to create other roles. These privileges are not needed to run a Trac instance. If no password is desired for the user, simply remove the `-P` and `-E` options from the `createuser` command. Also note that the database should be created as UTF8. LATIN1 encoding causes errors, because of Trac's use of unicode. SQL_ASCII also seems to work.
     83
     84Under some default configurations (Debian), run the `createuser` and `createdb` scripts as the `postgres` user:
     85{{{#!sh
     86$ sudo su - postgres -c 'createuser -U postgres -S -D -R -E -P tracuser'
     87$ sudo su - postgres -c 'createdb -U postgres -O tracuser -E UTF8 trac'
     88}}}
     89
     90Trac uses the `public` schema by default, but you can specify a different schema in the connection string:
    8891{{{
    8992postgres://user:pass@server/database?schema=yourschemaname
    9093}}}
    9194
    92 === MySQL の接続文字列 === #MySQLConnectionString
     95=== MySQL Connection String
    9396
    94 MySQL を代わりに使用したい場合、違う接続文字列を使用します。
    95 例えば、同じマシンにある `trac` という MySQL データベースに、
    96 `johndoe` というユーザでパスワード `letmein` で接続する場合の
    97 MySQL の接続文字列は次の通りです:
     97The 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 `localhost` named `trac` for user `johndoe` with password `letmein`:
    9898{{{
    9999mysql://johndoe:letmein@localhost:3306/trac
    100100}}}
    101101
    102 == ソースコードリポジトリ == #SourceCodeRepository
     102== Source Code Repository
    103103
    104 0.12 以降のバージョンでは、一つの Environment から複数のリポジトリに接続できるようになりました。 Environment からリポジトリに接続する方法は沢山あるので、詳細は TracRepositoryAdmin を参照してください。左記のページではリポジトリごとに設定する項目 (`type`, `url`, `description` など) について詳しく解説されています。
     104A single environment can be connected to more than one repository. However, by default Trac is not connected to any source code repository, and the ''Browse Source'' navigation item will not be displayed.
    105105
    106 Trac 0.12 の `trac-admin` コマンドでは、接続するリポジトリの指定が必須ではなくなりました。デフォルトでは Trac はソースコードリポジトリへの接続を作成せず、メインナビゲーションの ''リポジトリブラウザ'' (英語版では ''Browse Source'') も表示されなくなります。
    107 ロードされている `trac.versioncontrol.*` コンポーネントを完全に無効化するには下記設定を行ってください
    108 {{{
    109 [components]
    110 trac.versioncontrol.* = disabled
    111 }}}
     106There are many different ways to connect repositories to an environment, see TracRepositoryAdmin. A single repository can be specified when the environment is created by passing the optional arguments `repository_type` and `repository_dir` to the `initenv` command.
    112107
    113 バージョン管理システムによっては、リポジトリへのパスだけではなく、リポジトリ内の ''scope'' を設定することもできます。
    114 Trac はそのスコープ以下に限定したファイルとチェンジセットに関連する情報を表示します。
    115 Trac のバックエンドに Subversion を 使う場合は、この機能を利用できます。
    116 他のリポジトリシステムについては、対応するプラグインのドキュメントで確認して下さい。
     108== Directory Structure
    117109
    118 デフォルトリポジトリのみで構成される Subversion リポジトリの設定の一例です:
    119 {{{
    120 [trac]
    121 repository_type = svn
    122 repository_dir = /path/to/your/repository
    123 }}}
     110An environment consists of the following files and directories:
    124111
    125 スコープを絞った Subversion リポジトリの設定の一例です:
    126 {{{
    127 [trac]
    128 repository_type = svn
    129 repository_dir = /path/to/your/repository/scope/within/repos
    130 }}}
    131 
    132 == ディレクトリ構造 == #DirectoryStructure
    133 
    134 プロジェクト Environment のディレクトリは通常、以下に示すファイルとディレクトリから成り立ちます。
    135 
    136  * `README` - Environment について記述したドキュメント
    137  * `VERSION` - Environment のバージョン識別情報
    138  * `attachments` - 全ての添付ファイルはここに保存されます
     112 * `README` - Brief description of the environment.
     113 * `VERSION` - Environment version identifier.
     114 * `files`
     115  * `attachments` - Attachments to wiki pages and tickets.
    139116 * `conf`
    140    * `trac.ini` - メインとなる設定ファイル。詳細は TracIni に記述しています
     117  * `trac.ini` - Main configuration file. See TracIni.
    141118 * `db`
    142    * `trac.db` - SQLite データベース (SQLite を使用している場合)
    143  * `htdocs` - Web のリソースを格納するディレクトリ、URL `/htdocs/site/...` を使用した Genshi テンプレートから参照する ''(0.11 以降)''
    144  * `log` - ログファイルのデフォルトディレクトリ、ログ機能が有効に設定され相対パスが与えられた場合に使用する
    145  * `plugins` - Environment に固有の [wiki:TracPlugins プラグイン] (Python egg または単独のファイル、 [http://trac.edgewall.org/milestone/0.10 0.10] 以降)
    146  * `templates` - カスタム (プロジェクトに固有の) Genshi テンプレート ''(0.11 以降)''
    147    * `site.html` - カスタムヘッダ, フッタ, スタイルシート。 TracInterfaceCustomization#SiteAppearance に記載
    148 
    149 === 要注意: ''Trac Environment のディレクトリ'' と ''ソースコードリポジトリのディレクトリ'' を一緒にしないで下さい。 #Caveat
    150 
    151 初心者がよくやる誤りです。
    152 上記のディレクトリ構造は Subversion リポジトリのディレクトリ構造をざっくりと真似ているだけです。
    153 全く関連はありませんので、2つは同じ場所においては ''いけません''。
     119  * `trac.db` - The SQLite database, if you are using SQLite.
     120 * `htdocs` - Directory containing web resources, which can be referenced in Genshi templates using `/chrome/site/...` URLs.
     121 * `log` - Default directory for log files, if `file` logging is enabled and a relative path is given.
     122 * `plugins` - Environment-specific [wiki:TracPlugins plugins].
     123 * `templates` - Custom Genshi environment-specific templates.
     124  * `site.html` - Method to customize header, footer, and style, described in TracInterfaceCustomization#SiteAppearance.
    154125
    155126----