OForge & Trac Test Management

OForge looks like an interesting tool.  It’s a customized trac install that has (what I was looking for) a hierarchical wiki and multiple projects.  I found it with this post to the Trac mailing list.

I’m thinking about building a test-management plugin for Trac that can document functional tests and eventually link to executing BDD tests in PHP.  OForge might have many of the capabilities I need (such as hierarchical wiki).  It also has some cool features like mailing list management and irc.

It has continuum support, but I’m looking for cruise control, and specifically phpundercontrol.

There’s a VMWare image of Oforge available for evaluation, which works as advertized, but I haven’t had much luck building and installing it.  It looks like it expects a specific Gentoo setup and to pretty much run by itself, though I’m sure it could be setup with enough work and knowledge.

I actually don’t see how to create a project, or even add tickets to the example projects.

APC (Alternative PHP cache) on Windows

http://docs.moodle.org/en/Installing_APC_in_Windows#Download_the_correct_version
http://stackoverflow.com/questions/694910/apc-for-windows-alternative-download
http://downloads.php.net/pierre/ <– this is a link to the actual download

http://elementdesignllc.com/2009/08/php-apc-for-windows-download/ <– this has another copy

copy the php_apc.dll into c:/php/ext

add the following to php.ini

[PHP_APC]
extension = php_apc.dll

Setting up Ruby dev environment on Centos 5.2 VM

After installing PHP, I decided to install Ruby. However, The latest version of Ruby is 1.8.5-5.el5_4.8, which is to say, not 1.8.6

Here’s a link to installing Ruby Enterprise (from the makers of Phusion Passenger, the mod_rails plugin)

http://www.floydprice.com/2008/08/installing-ruby-enterprise-edition-on-centos-52/

I decided to install the latest official Ruby 1.8.6 (p-399 dated 2/4/2010) from source:

wget ftp://ftp.ruby-lang.org//pub/ruby/1.8/ruby-1.8.6-p399.zip
unzip ruby-1.8.6-p399.zip
cd ruby-1.8.6-p399
./configure
make
make install

This installs to /usr/local/bin/ruby , if you want installed to /usr/bin/ruby you can specify

./configure --prefix=/usr

or just create symlinks:

ln -s /usr/local/bin/ruby /usr/bin/ruby
ln -s /usr/local/bin/erb /usr/bin/erb
ln -s /usr/local/bin/irb /usr/bin/irb
ln -s /usr/local/bin/ri /usr/bin/ri
ln -s /usr/local/bin/rdoc /usr/bin/rdoc
ln -s /usr/local/bin/testrb /usr/bin/testrb
ln -s /usr/local/lib/ruby /usr/lib/ruby
ln -s /usr/local/lib/libruby-static.a /usr/lib/libruby-static.a

then install rubygems

wget http://rubyforge.org/frs/download.php/60718/rubygems-1.3.5.tgz
tar -xvzf rubygems-1.3.5.tgzcd rubygems-1.3.5ruby setup.rb
gem install --system
 ERROR:  While executing gem ... (OptionParser::InvalidOption)
 invalid option: --system

I don’t know what this problem is, but I did

gem update --system

and got

Nothing to update

So I installed rails

gem install rails -v 2.1.2

I got rake 0.8.7, so I’m happy

Then I installed mod_rails, following the instructions from

http://www.modrails.com/install.html

gem install passenger
passenger-install-apache2-module

Then I created /etc/httpd/conf.d/rails.conf

LoadModule passenger_module /usr/local/lib/ruby/gems/1.8/gems/passenger-2.2.9/ext/apache2/mod_passenger.so
PassengerRoot /usr/local/lib/ruby/gems/1.8/gems/passenger-2.2.9
PassengerRuby /usr/local/bin/ruby

Then I create a rails project with a vhost as described in the passenger installer

<VirtualHost *:80>
 ServerName modrails.centos.vm
 DocumentRoot /var/www/vhosts/modrails/public
 # <-- be sure to point to 'public'!

 <Directory /var/www/vhosts/modrails/public>
 AllowOverride all
 # <-- relax Apache security settings
 Options -MultiViews
 # <-- MultiViews must be turned off
 </Directory>
</VirtualHost>

(note the comments needed moved to their own line)

Create a vhosts director under /etc/httpd/vhosts

mkdir /etc/httpd/vhosts

Add the following line to /etc/httpd/conf/httpd.conf

Include vhosts/*.conf

add the new hostname to /etc/hosts

192.168.41.128 modrails.centos.vm

And finally, create the project:

mkdir /var/www/vhosts
cd /var/www/vhosts
rails modrails

Only, I get this message at http://modrails.centos.vm/



You’re riding Ruby on Rails!

About your application’s environment

The page you were looking for doesn't exist (404)

The page you were looking for doesn't exist.

You may have mistyped the address or the page may have moved.

That might be a mod_rails thing, since it looks like it’s running in Production mode.

I force it to dev by editing config/environment.rb and adding this line:

ENV['RAILS_ENV'] = 'development'

but that doesn’t work.  Specifying in the vhost conf:

RailsEnv development

gives a different error:

MissingSourceFile in Rails/infoController#properties

no such file to load -- sqlite3

RAILS_ROOT: /var/www/vhosts/modrailstest

Application Trace | Framework Trace | Full Trace

/usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
/usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
...
/usr/local/lib/ruby/gems/1.8/gems/passenger-2.2.9/lib/phusion_passenger/abstract_server.rb:196:in `start_synchronously'
/usr/local/lib/ruby/gems/1.8/gems/passenger-2.2.9/bin/passenger-spawn-server:61
This error occurred while loading the following files:
   sqlite3

Request

Parameters:

None

Show session dump

--- 
flash: !map:ActionController::Flash::FlashHash {}

Response

Headers:

{"X-Powered-By"=>"Phusion Passenger (mod_rails/mod_rack) 2.2.9",
 "cookie"=>[],
 "Cache-Control"=>"no-cache"}

So I installed the sqlite gem:

gem install sqlite3

and now I get:

NameError in Rails/infoController#properties

uninitialized constant Encoding

RAILS_ROOT: /var/www/vhosts/modrailstest

Application Trace | Framework Trace | Full Trace

/usr/local/lib/ruby/gems/1.8/gems/activesupport-2.1.2/lib/active_support/dependencies.rb:279:in `load_missing_constant'
/usr/local/lib/ruby/gems/1.8/gems/activesupport-2.1.2/lib/active_support/dependencies.rb:468:in `const_missing'
/usr/local/lib/ruby/gems/1.8/gems/sqlite3-0.0.8/lib/sqlite3/encoding.rb:9:in `find'
...
/usr/local/lib/ruby/gems/1.8/gems/passenger-2.2.9/lib/phusion_passenger/abstract_server.rb:196:in `start_synchronously'
/usr/local/lib/ruby/gems/1.8/gems/passenger-2.2.9/bin/passenger-spawn-server:61

Request

Parameters:

None

Show session dump

--- 
flash: !map:ActionController::Flash::FlashHash {}

Response

Headers:

{"X-Powered-By"=>"Phusion Passenger (mod_rails/mod_rack) 2.2.9",
 "cookie"=>[],
 "Cache-Control"=>"no-cache"}

Git isn’t available on CentOS 5.2 either, but a Git yum package for Fedora is available from the EPEL extras, which can be installed with:

rpm -Uvh http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-3.noarch.rpm
yum install git

Setting up PHP dev environment on a Centos 5.2 VM

I’m actually setting up a VMWare image from Linhost, so I installed VMWare server, gave it 1024MB of RAM, and I tried to set up Bridged networking, but couldn’t get it working, so I decided to use Apache on Windows as a Proxy.

I added my centos VM IP address to my C:/windows/system32/drivers/etc/hosts

127.0.0.1 windows
192.168.41.128 centos.vm

And similarly to my /etc/hosts on the VM

127.0.0.1 centos
192.168.41.128 centos.vm

I edited /etc/sysconfig/network and changed the hostname

HOSTNAME=centos

I found that Apache was blocked, so I disabled SELinux, by editing /etc/selinux/config and set

SELINUX=disable

and disabled the iptables firewall by typing:

chkconfig iptables off

I could have also ran “system-config-securitylevel” to specify what services to allow but I get:

sh: setenforce: command not found

(maybe it needs SELinux running)

to enable apache httpd on startup, I typed:

chkconfig --level 235 httpd on

I found some useful advice on upgrading from

http://www.howtoforge.com/perfect-server-centos-5.2

And a good yum repository with PHP 5.2 for CentOS 5.2 is at

http://www.jasonlitka.com/yum-repository/

More information about using this repository is at:

http://www.freshblurbs.com/install-php-5-2-centos-5-2-using-yum

I then edited my windows Apache configuration to set up the Proxy:

#http://windows/centos
ProxyPass /centos http://centos.vm/
ProxyPassReverse /centos http://centos.vm/

# http://centos.windows:10080

Listen 10080
NameVirtualHost *:10080

<VirtualHost *:10080>
 ServerName centos.vm
 ServerAlias windows
 ProxyPass / http://centos.vm/
 ProxyPassReverse / http://centos.vm/
</VirtualHost>

Now I can access it two different ways, either from the path via the Windows server, or as a VirtualHost via an alternate port (10080).

Now to upgrade PHP to version 5.2 (which is not available on the official CentOS 5.2 repository), follow directions at

http://www.jasonlitka.com/yum-repository/

create a yum repository at /etc/yum.repos.d/utterramblings.repo

[utterramblings]
name=Jason's Utter Ramblings Repo
baseurl=http://www.jasonlitka.com/media/EL$releasever/$basearch/
enabled=1
gpgcheck=1
gpgkey=http://www.jasonlitka.com/media/RPM-GPG-KEY-jlitka

install the gpg key:

rpm --import http://www.jasonlitka.com/media/RPM-GPG-KEY-jlitka

Then run:

yum update
Updated:
 apr.i386 0:1.3.8-1.jason.1             apr-devel.i386 0:1.3.8-1.jason.1       apr-util.i386 0:1.3.9-1.jason.1         apr-util-devel.i386 0:1.3.9-1.jason.1
 httpd.i386 0:2.2.14-jason.1            httpd-devel.i386 0:2.2.14-jason.1      httpd-manual.i386 0:2.2.14-jason.1      mod_perl.i386 0:2.0.4-7.jason.1
 mod_python.i386 0:3.3.1-8.jason.1      mod_ssl.i386 1:2.2.14-jason.1          mysql.i386 0:5.0.86-jason.2             mysql-server.i386 0:5.0.86-jason.2
 pcre.i386 0:7.8-1.jason.1              php.i386 0:5.2.11-jason.1              php-cli.i386 0:5.2.11-jason.1           php-common.i386 0:5.2.11-jason.1
 php-devel.i386 0:5.2.11-jason.1        php-gd.i386 0:5.2.11-jason.1           php-imap.i386 0:5.2.11-jason.1          php-ldap.i386 0:5.2.11-jason.1
 php-mysql.i386 0:5.2.11-jason.1        php-odbc.i386 0:5.2.11-jason.1         php-pdo.i386 0:5.2.11-jason.1           php-pear.noarch 1:1.7.2-2.jason.1
 php-xml.i386 0:5.2.11-jason.1          php-xmlrpc.i386 0:5.2.11-jason.1

install APC

pecl install apc
yum install php-apc

see also http://www.freshblurbs.com/install-php-5-2-centos-5-2-using-yum

free SMTP server for Windows

If you need to develop (or test) on Windows and your program needs to send email, you need an SMTP server.

I just posted this list on Stack Overflow:

freesmtp is a decent basic choice. http://www.softstack.com/freesmtp.html

There’s also a sendmail.exe which is a very basic system (not actually sendmail, though it accepts basic sendmail arguments.) I’ve used it for things like sending bugzilla notifications and it works with PHP apps. http://glob.com.au/sendmail/

Mercury mail is a more fully featured smtp server that’s fairly simple to configure (though it takes some hunting through it’s weird menus). It’s the mailserver built by Pegasus, and while not exactly “modern” it’s fairly robust. http://www.pmail.com/whatsnew/m32401.htm

I’ve also used Apache JAMES for Java projects. James itself is fairly lightweight, but the JVM is not. But if you’re already running a servlet container.
http://james.apache.org/

Dumbster is a fake SMTP server (in Java) which dumps email to a file. http://quintanasoft.com/dumbster/

Rumbster is a Ruby equivalent http://github.com/sr/rumbster