Wednesday 29 August 2007

CruiseControl as a windows service

CruiseControl 2.7 comes with a wrapper that enables it to run as a native windows service. However, the default configuration does not start the web HTTP service, only the JMX stuff.

To enable it just edit the existing wrapper.conf in your CruiseControl install directory (C:\Program Files\CruiseControl\wrapper.conf) and add the following lines just below the similar ones:

wrapper.app.parameter.6=-webport
wrapper.app.parameter.7=8080
wrapper.app.parameter.8=-rmiport
wrapper.app.parameter.9=1099

Change 8080 to whatever port you want CC's web server to listen.

Thursday 23 August 2007

Specifying MySQL port on MediaWiki

MySQL listens on port 3306/tcp by default. MediaWiki's 1.7.1 configuration is a bit misleading when it comes to specifying the database port. This excerpt is from LocalSettings.php:
$wgdBserver = "localhost";
$wgDBname = "mw0";
$wgDBuser = "my_user";
$wgDBpassword = "my_pass";
$wgDBprefix = "mw_";
$wgDBtype = "mysql";
$wgDBport = "3308"; // <--- DOES NOT work for MySQL
The value in $wgBDport is only used with PostgreSQL. To specify a MySQL connection port different than 3306, use the syntax server:port on $wgdbServer. For instance:
$wgdBserver = "localhost:3308";
BUT! there's another catch: when the server is defined to "localhost", MySQL will default to connecting via socket. If you are changing the port in hopes of getting WikiMedia to connect to another running instance of MySQL, chances are that it will still connect to the "default" one. To force a TCP connection use the loopback IP address instead of "localhost":
$wgdBserver = "127.0.0.1:3308";
It took me nearly an hour to figure this bitch out so please say thank you if it works for you.

[Update 24/08/2007]: on Solaris my trick didn't work. To fix it, I had to add the following line to LocalSettings.php:
ini_set("mysql.default_socket", "/tmp/mysql5.sock");
Adjust the path to the location where your MySQL writes the socket and off you go!