This chapter is concerned with installing Codestriker on your system. This requires the following steps:
creating the Codestriker database;
configuring the webserver; and
unpacking and configuring Codestriker.
Codestriker stores all code review topics and comments into a relational database. Currently, MySQL, PostgreSQL, Oracle and SQL Server are supported, but any database system can be used, provided it has an implementation of Perl's DBI interface, which is the case for all major database implementations.
MySQL can be used on either UNIX or Window platforms. It is available for download from http://www.mysql.com. Make sure you use at least version 4.1 or above, as this supports UTF8 databases. Note under Solaris, it seems at the time of writing that only the 32-bit version of Perl and MySQL (and DBD::mysql) can be used, the 64-bit versions don't work. For Linux RedHat distributions, the necessary packages required are mysql, mysql-devel, mysql-server, which may or may not already be present on your system. Depending on your UNIX operating system, starting mysql will be something like the following:
/etc/rc.d/init.d/mysql startFor Windows, there will typically be a desktop icon or menu shortcut for starting mysqld.
Once mysql is running, it is necessary to create the Codestriker database and create the codestriker user. Under UNIX, a command like the following will be required:
% mysql -u root mysqlFor Windows, there should be a shortcut available for getting a mysql prompt.
At the mysql prompt, issue the following command, but substitute a suitable database password instead of cspasswd as shown here.
CREATE DATABASE codestrikerdb CHARACTER SET utf8; GRANT SELECT,INSERT,UPDATE,DELETE,INDEX,ALTER,CREATE,DROP,REFERENCES ON codestrikerdb.* TO codestriker@localhost IDENTIFIED BY 'cspasswd'; FLUSH PRIVILEGES; QUIT
You can check the Codestriker database at any time from the command line, by issuing the following command, and entering the database password:
mysql -u codestriker -D codestrikerdb -p
If required, the Codestriker database can be dropped, by entering in the following command at the mysql command prompt as user root:
DROP DATABASE codestrikerdb;
At the time of writing PostgreSQL was only available for UNIX platforms, however it is quite possible by the time you are reading this that a version for Windows will be available. The project page for PostgreSQL is: http://www.postgresql.org. For Linux RedHat distributions, the postgresql, postgresql-server and postgresql-devel packages are required. Make sure you are using at least version 7.1, as prior versions had restrictions on the size of "text" fields, making it impractical for use with Codestriker. PostgreSQL can be started with a command like:
To create the Codestriker database and user, enter the following commands:
% createuser --username=postgres -d -A codestriker % createdb -E UTF8 --username=codestriker codestrikerdbIf the last command claims UTF8 is an unknown encoding, try the value UNICODE. If that still fails, you have a distribution which wasn't configured with --enable-multibyte. Try downloading the latest version of PostgreSQL.
Make sure your pg_hba.conf file is suitable configured, in particular for authentication. This file is often located in /etc/postgres.
You can check the Codestriker database interactively at any time with the following command:
% psql -U codestriker codestrikerdb
If required, the Codestriker database can be dropped, by entering in the following command:
% dropdb --username=codestriker codestrikerdb
Codestriker has been deployed under Linux 2.4 using
Oracle 8i. If you have Oracle installed, you most likely
will have somebody that can easily create a new Codestriker
database for you. Install the DBD::Oracle Perl module, and
$db variable in the
codestriker.conf file appropriately so
that Codestriker knows how to connect to its database. An
example is given in the configuration file. For more
advanced connection strings, please consult the DBD::Oracle
Codestriker has been deployed using SQL Server on Win32, via
the ODBC interface. The first step is to create a
"Codestriker" system data source, by going to "Control
Panel" -> "Administrative Tools" -> "Data Sources (ODBC)".
From here, select the "System DSN" tab, and click "Add".
Select the driver named "SQL Server", then click "Finish".
Enter in "Codestriker" for the name textfield, "Codestriker
database" for the description textfield, and select the
appropriate SQL Server from the server dropdown box, then
click "Next". Choose the authentication appropriate for
your site, and work your way through the final configuration
options. Modify the
$db variable in the
codestriker.conf file appropriately
(see the example) so that Codestriker knows how to connect
to this datasource. For more advanced connection settings,
please consult the DBD::ODBC man page or online manual.
Codestriker uses the Perl DBI package, a portable API that supports all the major database systems. The database creation code is abstracted so that it can work on a diverse range of database systems. Support for a new database system involves writing a single Perl module in the Codestriker::DB package and registering it in the Codestriker::DB::Database module. There are a number of example database modules there.