DBFit is a simple JEE application. If you’re not trying to run a server install, skip all of this and just upzip the download and run “./startFinesse.sh”

These install steps are mostly just tasks to set up a linux program to run as a service at boot time. This is good practise, and required for jenkins integration.

  1. You probably want to install DBFit on your existing Continuous Integration server. See install instructions here. Otherwise create a new EC2.
  2. Modify the EC2 security group for the EC2 where DBFit will be running to add an inbound rule for custom TCP on port 8085 from the bastion-host security-group.
  3. SSH from the bastion to your EC2
    1. Download DBFit:
      wget https://github.com/dbfit/dbfit/releases/download/v3.1.0/dbfit-complete-3.1.0.zip
      Wget is the linux command for downloading files.
    2. Unzip the download. unzip dbfit-complete-3.1.0.zip
    3. Become a privileged user: sudo bashSudo runs a command as another user, my default root. Bash is the standard shell, which opens a new terminal session where you can type new commands, now as root.
    4. Create a group for fitnesse:
      groupadd fitnesse Groupadd is the linux command for creating a group.
    5. Create a user for fitnesseuseradd -g fitnesse fitnesse Useradd is the linux command for creating a user. The -g option is to specify a group.
    6. Create the fitness working folder
      1. Create the folder: mkdir /usr/share/fitnesse mkdir is the command to create a folder.
      2. Copy plugins.properties cp /home/ec2-user/plugins.properties /usr/share/fitnesse/
      3. Create /usr/share/fitnesse/startFitness.sh with the following content. This is a linux bash script and it is fairly sensitive. In particular it needs to have linux rather than windows line endings. One way to do this is to create the file on the linux box with a linux editor, like nano.
        #!/bin/bash
        # chkconfig: 2345 95 05
        # description: Fitnesse server daemon
        
        prog=Fitnesse
        
        RETVAL=0
        
        start() {
                echo -n $"Starting $prog: "
                cd /usr/share/fitnesse
                java -cp '/var/lib/fitnesse/dbfit-docs-3.1.0.jar:/var/lib/fitnesse/fitnesse-standalone-20140903.jar' fitnesseMain.FitNesseMain -l /var/log/fitnesse $@
                RETVAL=$?
                echo
                [ $RETVAL = 0 ] && touch /var/lock/subsys/fitnesse
                return $RETVAL
        }
        
        stop() {
                echo -n $"Stopping $prog: "
                killall fitnesse
                RETVAL=$?
                echo
                [ $RETVAL = 0 ] && rm -f /var/lock/subsys/fitnesse /var/run/fitnesse/fitnesse.pid
        
        }
        
        
        # See how we were called.
        case "$1" in
          start)
                start
                ;;
        
          stop)
                stop
                ;;
        
          *)
                echo $"Usage: $prog {start|stop}"
                exit 1
        
                exit 1
        
        esac
        
        exit $RETVAL
        
        

        This is a fairly standard linux service script. The chkconfig line is special.

      4. Change the security on that new file to allow people to run it. chmod u=rwx,g=rx,o=x /usr/share/fitnesse/startFitnesse.sh chmod changes permissions on files. The options are user/owner read-write-execute, group read-execute, and others/world execute.
      5. Change the folder ownership: chown --recursive fitnesse:fitnesse /usr/share/fitnesse Chown is the command to change ownership. The --recursive option indicates to change ownership of any files or subdirectories as well.
    7. Create the library folder:
      1. mkdir /var/lib/fitnesse
      2. Copy the fitnesse libraries there cp /home/ec2-user/lib/*.jar /var/lib/fitnesse/
      3. If you are testing against Microsoft SQL Server, you also need to download and put their jars in this folder. If you work for OptimalBI, we’ve already agreed to the license, so you can find the file in our dropbox at \OptimalBI\Company\What we do\SQL Server\sqljdbc41.jar
      4. Change the folder ownership: chown --recursive fitnesse:fitnesse /var/lib/fitnesse
    8. Create the log folder:
      1. mkdir /var/log/fitnesse
      2. Change the folder ownership: chown --recursive fitnesse:fitnesse /var/log/fitnesse
    9. Make a symbolic link in /etc/init.d ln --symbolic /usr/share/fitnesse/startFitnesse.sh /etc/init.d/fitnesse ln is the command for making links, which are like shortcuts in windows. There is something in the boot sequence which requires --symbolic rather than hard links. /etc/init.d is the folder for services.
    10. Add dbfit to the boot sequence: chkconfig --add fitnesse. chkconfig manages services
    11. Actually start dbfit:runuser -l fitnesse -c 'service fitnesse start' & runuser runs a command as another user. -l specifies which user and -c which command. The ampersand (&) backgrounds the command so that you get your terminal back.
  4. On the bastion start a browser and go to http://your-ip-here:8085/

references:
http://iflifewereagame.blogspot.ca/2012/05/setting-up-fitnesse-on-ubuntu-in-7.html
http://arstechnica.com/civis/viewtopic.php?p=2147913