JCR - Setup and Configuration

Return to contents page

Contents

Configuration File

JCR uses a config file in .ini file format, a la Windoze. You'll have generated it at some stage using paster make-config jcr jcr.ini (or whatever you decided to call the file).

Most of the config file is really system configuration, and shouldn't be changed. However, the things you can change are listed in the following sections. The most important items are shown first, followed by less commonly changed items.

Note: In all parts of the config file except the logging section, the string %(here)s is automatically expanded to the path of the directory containing the config file.

Main Configuration Items

Section Item Description
app:main

sqlalchemy.url

sqlalchemy.pool_recycle

jcr.base.dir

Url for connecting to the database - format depends on the DBMS you are using.

For Postgres (using the psycopg driver), the format is: postgres://user:password@host/dbname, e.g. postgres://jcr:itsasecret@localhost/jcr

For Mysql (using MySQL-python), the format is: mysql://user:password@host/dbname, e.g. mysql://jcr:itsasecret@localhost/jcr. You'll want to also set the sqlalchemy.pool_recycle item for Mysql.

For Sqlite (using pysqlite), the format is: sqlite:///path-to-db-file, e.g. sqlite:///%(here)s/jcr-sqlite.db or sqlite:////var/jcr/jcr-sqlite.db. Note that Sqlite is usually not build thread-safe on Linux or UNIX, so it shouldn't be used for production.

Sets the number of seconds after which a database connection should be closed (default is to use indefinitely). Use for Mysql only, and set to 3600

The base directory under which JCR will store all its files (projects, filesets etc. Defaults to %(here)s/var, i.e. in a var subdirectory under the directory containing the config file, but something like /var/jcr is recommended

handler_file args

Sets the location of the log file, as well as how often it is rolled, and how many rolled versions are retained.

Format is ('logfilepath', 'midnight', 1, retaincount), e.g. ('/var/jcr/log/jcr.log', 'midnight', 1, 14), which rolls the log file daily, and keeps the last 14 days' log files. NOTE: This item does not support the %(here)s token.

The default is ('jcr.log', 'midnight', 1, 14), but note that the relative path is only used so that it always works on installation - an absolute path should be used for production.

Other Configuration Items

Section Item Description
DEFAULT

host

port

Interface JCR listens on. Default is 0.0.0.0, i.e. all

Port JCR listens on. Default is 5000

app:main

jcr.assets.externalscriptspage

jcr.superuser.advanceprojects

sqlalchemy.echo

set debug

URL for a web page describing and linking to external scripts (e.g. for creating fileset tarballs from your source control system, generating selection files from your bug tracking system etc.).

Default is /assets/externalScripts.html, which describes the standard JCR scripts

TODO

Enables or disables logging of each SQL statement executed (True or False). Defaults to False

Must be set to false, for security reasons

handler_file level Sets the logging level for the log file. Options are DEBUG, INFO, WARNING or ERROR. Defaults to DEBUG, but INFO should be fine for production.
handler_console level Sets the logging level for logging to the console. Options are as for the handler_file level above. Defaults to INFO, but should be set to ERROR if installed as a service.

Startup Scripts

Configuration is likely to be required in the service startup script (bin/jcr) provided with JCR. This is covered in the installation guide.

External Scripts

JCR allows project owners to download scripts via an external scripts page. These scripts typically will generate project review tarballs (possibly directly from a Source Code Management System), and may also generate file selection lists (if your Source Code Management System is integrated with your bug and enhancement tracking system, as ours is).

To add or modify a script, you need to:

  • Add the script to the asset directory, and make sure it is owned by the appropriate user and group (usually jcr:jcr)
  • Change the external scripts page to make the script available. The default page is asset/externalScripts.html, but this may have been changed in the configuration file. This page is just static HTML, so it's in your culpable hands...

If you plan to write your own scripts, see the description of the file formats.

Project Notes Template

The (optional) project notes template is conf/projectNoteTemplate.txt under the JCR base directory. If found, this is used as the default contents for the project notes field when creating a new project.