Creating a Trac Project Environment: Difference between revisions

From Littledamien Wiki
Jump to navigation Jump to search
 
(6 intermediate revisions by the same user not shown)
Line 3: Line 3:


==Prerequisites==
==Prerequisites==
===Trac installation===
* Python
** Trac works only with Python 2.7 for now (even though Python 3.x exists).<br />(It looks like it's possible to run multiple python environments?)
** The Windows installation of Python doesn't update the "path" environment variable. It's necessary to do that manually to include the path to the python executable.
** Same is true for Trac. By default the trac libraries are installed in <code>[PYTHON_INSTALL_DIR]\Lib\site-packages\</code>. The <code>trac-admin</code> executable is located in <code>c:\python27\scripts\</code> (where <code>c:\phython27\</code> is the installation directory for Python).
* Python [http://pypi.python.org/pypi/setuptools#files setuptools]
* [http://genshi.edgewall.org/wiki/Download Genshi]


===Running Trac on IIS===
See [[Trac Installation on Windows Server 2008]]
* See [http://trac.edgewall.org/wiki/TracOnWindowsIisAjp Running Trac on IIS 6 Using AJP]<br />(This also works with IIS 7.)
====Install Trac====
* Instead of using port 8000, use 8009 which is the standard port for AJP.
* Add <code>--protocol=ajp</code> to have tracd use AJP instead of HTTP.<br /><syntaxhighlight lang="dos">
tracd --port 8009 --protocol=ajp ./littledamien_web/trac
</syntaxhighlight>
* This will result in an error indicating that the module flup.server.ajp is missing. If not, flup is installed and the next step may be skipped.
 
====Install flup====
* Copy <code>flup-1.0-py2.5.egg</code> from [http://www.saddi.com/software/flup/dist/ ​Saddi Software binaries] to <code>C:\Python27\Scripts</code> (or whatever may be your Python installation directory).
* Run <code>easy_install flup</code>.
 
====Install Tomcat AJP Connector for IIS====
* Set up the directory structure.
We assume there will be a base directory named C:\AJP-Connector and three subdirectories bin, conf and logs. Of course, you may choose anything else for the base directory.
 
* Copy <code>tomcat-connectors-1.2.37-windows-i386-iis.zip</code> (or <code>tomcat-connectors-1.2.37-windows-x86_64-iis.zip</code> in a 64 bit environment) or a newer version from ​[http://www.apache.org/dist/tomcat/tomcat-connectors/jk/binaries/windows/ Apache binaries] and extract <code>isapi_redirect.dll</code> to the bin subdirectory.
* Create a configuration file <code>isapi_redirect.properties</code> for the ISAPI redirector.
This must be in the same directory as the DLL and have exactly the same name but with a .properties extension. The configuration file should contain this: (be sure to replace "C:\AJP-Connector" with your actual directory)
 
<pre>
# Configuration file for the ISAPI Redirector
 
# The path to the ISAPI Redirector Extension, relative to the website
# This must be in a virtual directory with execute privileges
extension_uri=/AJP-Connector/isapi_redirect.dll
 
# Full path to the log file for the ISAPI Redirector
log_file=C:\AJP-Connector\logs\isapi_redirect.log
 
# Log level (debug, info, warn, error or trace)
log_level=info
 
# Full path to the workers.properties file
worker_file=C:\AJP-Connector\conf\workers.properties
 
# Full path to the uriworkermap.properties file
worker_mount_file=C:\AJP-Connector\conf\uriworkermap.properties
</pre>
* Create the workers.properties file with the following content: (replace the host name and port if necessary)
<pre>
# Define 1 real worker
worker.list=trac
# Set properties for trac (ajp13)
worker.trac.type=ajp13
worker.trac.host=localhost
worker.trac.port=8009
worker.trac.socket_keepalive=0
</pre>
* Create the uriworkermap.properties file with the following content: (replace foo and bar with your trac project names)
<pre>
/foo*=trac
/bar*=trac
</pre>
 
====Define the virtual directory for AJP-Connector====
* Start IIS Manager
* Inside the web site where you want to publish Trac, define a virtual directory named AJP-Connector, pointing to your bin subdirectory, with permissions to execute executables (not only scripts).
** Click the name of the virtual directory.
** In the virtual directory '''Home''' area, double click '''Handler Mappings'''.
** In the '''Actions''' pane, click '''Edit Feature Permissions'''.
** In the '''Edit Feature Permissions''' dialog verify that the '''Read''' and '''Script''' check boxes are both selected, and that the '''Execute''' check box is also selected.
The only purpose for this virtual directory is to allow the ISAPI filter defined in step 6 to find the DLL.
 
====Allow execution of the DLL as Web Service Extension====
* Open IIS manager
* Click on the Computer name in the left pane (root node in the tree)
* In the '''Features''' view select '''ISAPI and CGI Restrictions'''.
* Under '''Actions''' in the right column click '''Add...'''
** ISAPI or CGI path: path to AJP DLL. (<code>c:\AJP-Connector\bin\isapi_redirect.dll</code>)
** Description: AJP-Connector
** Allow extension path to execute: checked


====Add AJP-Connector to the ISAPI filters====
==Resources==
* In the IIS Manager, open the properties of the web site where you want to publish Trac.
* [http://trac.edgewall.org/wiki/TracInstall#CreatingaProjectEnvironment TracInstall: Create a Project Environment]
* Open '''ISAPI Filters'''.
* [http://littled.dbarchowsky.com/trac/wiki/TracGuide The Trac User and Administration Guide]
* Add a new filter with any filter name (I prefer "AJP-Connector") and the complete path to c:\AJP-Connector/bin/isapi_redirect.dll as executable.


===Install Trac as a Windows service===
== Creating a project environment ==
* TK


==Creating a project environment==
Using PowerShell as Administrator:


* See [http://trac.edgewall.org/wiki/TracInstall#CreatingaProjectEnvironment TracInstall: Create a Project Environment]
<syntaxhighlight lang="dos">
<syntaxhighlight lang="dos">
trac-admin /path/to/tracdir initenv
trac-admin /path/to/tracdir initenv
Line 105: Line 23:


The configuration file for the new project environment is located at <code>[TRAC_PROJECT_DIR]\conf\trac.ini</code>.
The configuration file for the new project environment is located at <code>[TRAC_PROJECT_DIR]\conf\trac.ini</code>.
==Trac web server==


Start the server with  
Start the server with  
Line 113: Line 33:
Then you can connect to the trac project with <code><nowiki>http://localhost:8000/trac/</nowiki></code>.
Then you can connect to the trac project with <code><nowiki>http://localhost:8000/trac/</nowiki></code>.


==Database==
See also [[Trac_Installation_on_Windows_Server_2008#Install_Trac_as_a_Windows_service|Installing Trac as a Windows Service]]
 
==Enabling the Admin tab in the Trac web interface==
 
<syntaxhighlight lang="dos">
trac-admin /path/to/my/project permission add <username> TRAC_ADMIN
</syntaxhighlight>
 
==Git support==
 
Git support is built into Trac 1.0. It has to be enabled in the trac.ini file:
<pre>
[components]
tracopt.versioncontrol.git.* = enabled
 
[git]
git_bin = c:\git\bin\git.exe
</pre>
Then Admin tab > Administration menu > Version Control > Repositories > Add Repository
 
* [http://trac.edgewall.org/wiki/0.12/TracRepositoryAdmin Trac Repository Administration]
* [http://trac.edgewall.org/wiki/TracGit Trac Git]
 
==<strike>Database</strike>==


* Create a new SQLite database.
* <strike>Create a new SQLite database.</strike>


<syntaxhighlight lang="dos">
<syntaxhighlight lang="dos">

Latest revision as of 17:44, 16 August 2013

Overview[edit]

How to set up a new Trac project environment on Windows using a SQLite database.

Prerequisites[edit]

See Trac Installation on Windows Server 2008

Resources[edit]

Creating a project environment[edit]

Using PowerShell as Administrator:

trac-admin /path/to/tracdir initenv

Then trac will prompt for settings:

  • Project name: littledamien
  • Database connection string: sqlite:db/trac-littledamien.db

The configuration file for the new project environment is located at [TRAC_PROJECT_DIR]\conf\trac.ini.

Trac web server[edit]

Start the server with

tracd --port 8000 /path/to/tracdir

Then you can connect to the trac project with http://localhost:8000/trac/.

See also Installing Trac as a Windows Service

Enabling the Admin tab in the Trac web interface[edit]

trac-admin /path/to/my/project permission add <username> TRAC_ADMIN

Git support[edit]

Git support is built into Trac 1.0. It has to be enabled in the trac.ini file:

[components]
tracopt.versioncontrol.git.* = enabled

[git]
git_bin = c:\git\bin\git.exe

Then Admin tab > Administration menu > Version Control > Repositories > Add Repository

Database[edit]

  • Create a new SQLite database.
sqlite3 /develop/trac-projectname.db