Virtual machine development environment

From FusionForge Wiki
Revision as of 09:17, 19 October 2013 by Beuc (talk | contribs) (Update documentation for latest VM)

Jump to: navigation, search

Roland Mas has designed a virtual machine image (aka FusionForge Sandbox) to provide a development / test machine providing an already configured automated tests environment. FusionForge is not pre-installed but can be built using included scripts.

Download: http://fusionforge.fusionforge.org/sandbox/

See : http://lists.fusionforge.org/pipermail/fusionforge-general/2010-November/001245.html for more details

Here's an excerpt from the enclosed /root/Desktop/README.html:

FusionForge sandbox

Welcome to the FusionForge sandbox. This VM/appliance is designed to help you get started on development. It's basically a clean Debian system (user:pass is root:root), with a checkout of the FusionForge code and a few helper scripts. Those scripts are in the /root/scripts directory:

update.sh will update the sources from FusionForge's Subversion repository, and also the currently installed packages.
 • build.sh builds FusionForge packages from the sources, and stores them in the package repository at /root/debian-repository. (rem Cbac starting from a debboostraped vm, needs to add dupload, bzr-svn and svn).
 • install.sh installs those FusionForge packages. This should end up with an up-to-date FusionForge running on http://forge.local/.
 • start-selenium.sh gets and runs Selenium, which is needed for the testsuite.
 • run-testsuite.sh actually starts the testsuite.
 • install-gui.sh sets up an X11 graphical environment.

The actual source code is stored under /root/fusionforge-trunk, so that's where you should do the changes you want to test.

Running everything on the VM

If you run install-gui.sh, then you get a graphical desktop environment on the VM. To build and install from sources, run the “Build + inst” script (there's an icon on the desktop). You can then use http://forge.local/, with the administrator's login being “admin” and its password being “myadmin”. To run the Test Suite, launch Selenium and keep it running (possibly iconized) while you launch the “Run testsuite”.

Running remotely

If you don't want to install a full GUI on the VM, you can also run the interesting things remotely through SSH. Depending on the configuration of your VM, the network settings may change, but the VM displays its IP address at boot time, so you can ssh root@192.168.x.x and work in there. Note that Selenium needs an X11 display (since it drives a graphical web browser), so you'll need to run ssh -X root@192.168.x.x start-selenium.sh (note the -X).

Note: the 2012-07 image uses a bzr-svn repository, convert it to Git using:

cd /root/
mv fusionforge-trunk fusionforge-trunk.old
git clone https://fusionforge.org/anonscm/git/fusionforge/fusionforge.git
# or git clone git://fusionforge.org/fusionforge/fusionforge.git

You may reuse the pre-configured VM image with Virtualbox (or any other VM system, converting the image to the appropriate format), which is the easiest path, or setup a development environment on a Debian Wheezy system you installed on your own, by using the VM-scripts/configure-scripts.sh script (see below).


  • To reset the admin password, use: /usr/share/gforge/bin/forge_set_password admin
  • Converting from Virtualbox image format to qemu QCOW2: convert to raw format first
$ VBoxManage clonehd -format RAW ffsandbox.vmdk ffsandbox.raw

Then convert to QCOW2 format:

$ qemu-img convert -f raw -O qcow2 ffsandbox.raw ffsandbox.qcow2
  • Running inside qemu:
    • Create a VM by importing the created qcow2 disk image, with virt-manager.
    • You may need to set manually the driver type to 'qcow2' in "disk" device section in the VM xml file (in /etc/libvirt/qemu/). In this case you need to redefine the VM xml file by: `sudo virsh -c qemu:///system define /etc/libvirt/qemu/ffsandbox.xml` then start the VM.
    • You need to reconfigure network interfaces in /etc/network/interfaces afterwards for replicating eth0 config stanza for eth1 for instance. You can find which device to enable by running ifconfig -a.
    • You may need to check the web_host setting in /etc/fusionforge/config.ini.d/debian-install.ini to adjust the forge's URLs for redirections.
  • It may not harm using aptitude inside the VM to upgrade at first launch, eventually taking this opportunity to configure the proper keymap and associate stuff.
  • Avoiding Firefox self-signed certificate error dialogs when running selenium tests:
    • Start connection with valid DISPLAY (ssh -X)
    • Configure a new Firefox profile in a directory of your choice (for instance : /root/fusionforge-trunk/tests/ff-profile-selenium/) with:
# firefox -ProfileManager
    • Still in Firefox, visit https://forge.local/ and add an exception for the self-signed certificate
    • Run the tests with the corresponding profile (change the run: rule of /root/fusionforge-trunk/3rd-party/selenium/Makefile) as :
 cd binary/selenium-server-1.0.3 ; LANG=C java -jar selenium-server.jar -firefoxProfileTemplate /root/fusionforge-trunk/tests/ff-profile-selenium/ -interactive
    • restart start-selenium.sh
  • You may prefer running the X display inside the VM to start the selenium server (run with ./start-selenium.sh), so that windows opened by the tests don't bother you, rather than through a ssh -X made to the VM.
  • running the latest version of the scripts to test the 5.1 branch may be as easy as :
wget -q -O - "https://fusionforge.org/scm/viewvc.php/*checkout*/branches/Branch_5_1/tools/VM-scripts/configure-scripts.sh?root=fusionforge" | sh -s Branch_5_1
# Note: the script is now at https://fusionforge.org/plugins/scmgit/cgi-bin/gitweb.cgi?p=fusionforge/fusionforge.git;a=blob_plain;f=tools/VM-scripts/configure-scripts.sh;hb=HEAD and needs to be updated.