Creating a virtual grid with libvirt + debian preseeds + puppet + IceGrid
This recipe explain how to build a grid composed by 6 debian virtual machines running IceGrid. Once the setup is done, the whole process may be executed with absolutelly no user interaction. The process takes advantage from libvirt (for virtual machine installation), debian preseds (for unattended installation) and puppet (for configuration management).
The resulting virtual grid is suitable to make tesing and continuous integration for distributed applications (using ZeroC IceGrid in this case).
WARNING: there is pending work in this post.
ingredients
Install next packages:
- libvirt-bin
- virtinst
- icegrid-gui
- libguestfs-tools
- guestfish
guestfs
Some scripts need guestfs. This requires a supermin appliance. To build it execute:
virtual network
We will use the next network definition. Write it in a file named net-grid.xml
:
[ net-grid.xml ]
node1 instalation
We make a minimal debian installation and then we will make 5 clones. Next script automates the installation process. Remember you need the preseed.cfg file in current directory (the script web-servers it using Python).
[ install.sh ]
clonning nodes
Once the installation has finished, we can make clones. To build clean clones is required to remove some settings established during installation. Thanks to guestfs it is easy to remove than settings using libguestfs-tools
:
This is a good moment to set the puppet agent execution using cron. To make this just copy a crontab file in the guest fs:
You need the puppet directory.
It is time to clone:
The script set the mac address and hostname in the range node2 to node6. Due the network specification, these hosts will get predefined IP addresses.
starting nodes
puppetmaster
You need to install puppetmaster in the host machine. The next command configure master to autosign agent certificates. That is obviously not secure, but convenient for our purposes here. As soon as nodes send cert request, master will sign them and then all of them are ready to apply the manifest.
writing the puppet manifest
Our initial manifest is pretty simple. We want to install some packages: ice34-services, psmisc and configure the icegrid-node service. You must copy next file in /etc/puppet/manifests/site.pp
This is very rough manifest, but enough for this case.
IceGrid configuration
You can see in the sites.pp
manifest that we are configuring icegrid nodes to connect to the IceGrid Registry in node0
. node0 is an alias for the host computer private IP address (see net-grid.xml
). The manifest create required directories and files to get icegridnode running. Note this is not the right way to execute the icegridnode service. It should have a init.d script to get easily managed with puppet.
You must execute an IceGrid Registry in the host computer. You will need the file registry.config.
Then, you may connect to the registry with:
If all is working fine, you will see the 6 nodes in the “live deployment” tab of icegrid-gui.
references
- Thanks to magmax for its puppet support.