# Changes between Version 2 and Version 3 of TracStandalone

Ignore:
Timestamp:
Jun 8, 2011, 7:44:12 PM (12 years ago)
Comment:

--

### Legend:

Unmodified
 v2 * Fast: Should be almost as fast as the [wiki:TracModPython mod_python] version (and much faster than the [wiki:TracCgi CGI]). * Automatic reloading: For development, Tracd can be used in ''auto_reload'' mode, which will automatically restart the server whenever you make a change to the code (in Trac itself or in a plugin). * Options for tracd: -r, --auto-reload == Cons == == Installing as a Windows Service == === Option 1 === To install as a Windows service, get the [http://www.google.com/search?q=srvany.exe SRVANY] utility and run: {{{ The spacing here is important. For Windows 7 User, srvany.exe may not be an option, so you can use [http://www.google.com/search?q=winserv.exe WINSERV] utility and run: {{{ "C:\path\to\winserv.exe" install tracd -displayname "tracd" -start auto "C:\path\to\python.exe" c:\path\to\python\scripts\tracd-script.py " net start tracd }}} === Option 2 === Use [http://trac-hacks.org/wiki/WindowsServiceScript WindowsServiceScript], available at [http://trac-hacks.org/ Trac Hacks]. Installs, removes, starts, stops, etc. your Trac service. == Using Authentication == Using tracd with Apache .htpasswd files: To create a .htpasswd file using htpasswd: {{{ sudo htpasswd -c /path/to/env/.htpasswd username tracd provides support for both Basic and Digest authentication. The default is to use Digest. ''Support for Basic authentication was added in version 0.9.'' The general format for using authentication is (replace --auth with --basic-auth if you want to use Basic auth): {{{ $tracd -p port --auth="base_project_dir,password_file_path,realm" project_path }}} where: * '''base_project_dir''': the base directory of the project specified as follows: * when serving multiple projects: ''relative'' to the project_bath * when serving only a single project (-s): the name of the project directory Don't use an absolute path here as this won't work. ''Note:'' This parameter is case-sensitive even for environments on Windows. * '''password_file_path''': path to the password file * '''realm''': the realm name (can be anything) * '''project_path''': path of the project Examples: {{{$ tracd -p 8080 \ --auth="project1,/path/to/passwordfile,mycompany.com" /path/to/project1 }}} Of course, the password file can be be shared so that it is used for more than one project: {{{ $tracd -p 8080 \ --auth="project1,/path/to/passwordfile,mycompany.com" \ --auth="project2,/path/to/passwordfile,mycompany.com" \ /path/to/project1 /path/to/project2 }}} Another way to share the password file is to specify "*" for the project name: {{{$ tracd -p 8080 \ --auth="*,/path/to/users.htdigest,mycompany.com" \ /path/to/project1 /path/to/project2 }}} === Using a htpasswd password file === This section describes how to use tracd with Apache .htpasswd files. To create a .htpasswd file use Apache's htpasswd command (see [#GeneratingPasswordsWithoutApache below] for a method to create these files without using Apache): {{{ $sudo htpasswd -c /path/to/env/.htpasswd username }}} then for additional users: {{{ sudo htpasswd /path/to/env/.htpasswd username2 }}} then for starting the tracd: {{{ tracd -p 8080 --basic-auth=environmentname,/fullpath/environmentname/.htpasswd,/fullpath/environmentname /fullpath/environmentname }}} Tracd provides support for both Basic and Digest authentication. The default is to use Digest; to use Basic authentication, replace --auth with --basic-auth in the examples below. (You must still specify a dialogic "realm", which can be an empty string by trailing the BASICAUTH with a comma.) ''Support for Basic authentication was added in version 0.9.'' The general format for using authentication is: {{{$ tracd -p port --auth=base_project_dir,password_file_path,realm project_path }}} where: * '''base_project_dir''' is the base directory of the project; note: this doesn't refer to the project name, and it is case-sensitive even for windows environments * '''password_file_path''' path of the password file * '''realm''' realm * '''project_path''' path of the project Example: {{{ $tracd -p 8080 \ --auth=project1,/path/to/users.htdigest,mycompany.com /path/to/project1 }}} Of course, the digest file can be be shared so that it is used for more than one project: {{{$ tracd -p 8080 \ --auth=project1,/path/to/users.htdigest,mycompany.com \ --auth=project2,/path/to/users.htdigest,mycompany.com \ /path/to/project1 /path/to/project2 }}} Another way to share the digest file is to specify "*" for the project name: {{{ $tracd -p 8080 \ --auth="*",/path/to/users.htdigest,mycompany.com \ /path/to/project1 /path/to/project2 }}} If using the -s parameter for serving a Trac environment from the root of a domain, one must use * for the project name == How to set up an htdigest password file ==$ sudo htpasswd /path/to/env/.htpasswd username2 }}} Then to start tracd run something like this: {{{ $tracd -p 8080 --basic-auth="projectdirname,/fullpath/environmentname/.htpasswd,realmname" /fullpath/environmentname }}} For example: {{{$ tracd -p 8080 --basic-auth="testenv,/srv/tracenv/testenv/.htpasswd,My Test Env" /srv/tracenv/testenv }}} ''Note:'' You might need to pass "-m" as a parameter to htpasswd on some platforms (OpenBSD). === Using a htdigest password file === If you have Apache available, you can use the htdigest command to generate the password file. Type 'htdigest' to get some usage instructions, or read [http://httpd.apache.org/docs/2.0/programs/htdigest.html this page] from the Apache manual to get precise instructions.  You'll be prompted for a password to enter for each user that you create.  For the name of the password file, you can use whatever you like, but if you use something like users.htdigest it will remind you what the file contains. As a suggestion, put it in your /conf folder along with the [TracIni trac.ini] file. Note that you can start tracd without the --auth argument, but if you click on the ''Login'' link you will get an error. == Generating Passwords Without Apache == === Generating Passwords Without Apache === If you don't have Apache available, you can use this simple Python script to generate your passwords: {{{ python trac-digest.py -u username -p password >> c:\digest.txt tracd --port 8000 --auth=proj_name,c:\digest.txt,trac c:\path\to\proj_name $python trac-digest.py -u username -p password >> c:\digest.txt$ tracd --port 8000 --auth=proj_name,c:\digest.txt,trac c:\path\to\proj_name }}} in the Wiki: [//chrome/site/software-0.1.tar.gz] The development version of Trac supports a new htdocs: TracLinks Since 0.10, Trac supports a new htdocs: TracLinks syntax for the above. With this, the example link above can be written simply htdocs:software-0.1.tar.gz.