Virtual machine development environment
We provide a development 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.
The virtual machine is meant to be used with Vagrant, but you can extract the disk image from the .box file using tar.
Install in Vagrant
vagrant init fusionforge-dev http://fusionforge.fusionforge.org/sandbox/fusionforge-dev.box # optionaly modify 'Vagrantfile', e.g. enable 'vb.gui'. vagrant up vagrant ssh -- -t sudo -i
This VM/appliance is designed to help you get started on development. It's basically a clean Debian system, with a checkout of the FusionForge code and a few helper scripts. Those scripts are in the /root/fusionforge/tools/VM-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/.
- 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, so that's where you should do the changes you want to test.
Running the test suite
We need a few manual steps to avoid Firefox self-signed certificate error dialogs when running selenium tests.
- Start connection with valid DISPLAY (using the VM display, or ssh -X)
- Close your existing Firefox windows (if any) and run:
- Configure a new Firefox profile in a directory of your choice, e.g. /root/fusionforge/tests/ff-profile-selenium/
- Still in Firefox, visit https://forge.local/ and add an exception for the self-signed certificate
- Close Firefox
- Go to /root/fusionforge/3rd-party/selenium/
- To run the tests with the corresponding Firefox profile, change the run rule of Makefile to:
LANG=C java -jar selenium-server.jar -firefoxProfileTemplate /root/fusionforge/tests/ff-profile-selenium/ -interactive
- Run /root/scripts/start-selenium.sh in a terminal (will run the Makefile you just modified)
- /root/scripts/run-testsuite.sh in another terminal (may take a few minutes to start)
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 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”.
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 email@example.com 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 firstname.lastname@example.org start-selenium.sh (note the -X).
To reset the FusionForge admin password
Use: /usr/share/gforge/bin/forge_set_password admin
Converting from Virtualbox image format to QEMU qcow2
Converting from Virtualbox image format to QEMU qcow2: convert to raw format first
tar xf fusionforge-dev.box fusionforge-dev-disk1.vmdk VBoxManage clonehd -format RAW fusionforge-dev-disk1.vmdk ffsandbox.raw # ~4GB
Then optionaly convert to QCOW2 format:
qemu-img convert -f raw -O qcow2 ffsandbox.raw ffsandbox.qcow2
Running inside QEMU/KVM
- 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.
Modify the VM
The VM is automatically generated from scratch using the Packer tool. See the Packer configuration in tools/VM-bootstrap/.