VServer Development Scripts Charles Shapiro 14 Nov 2003 Version 0.0.3 What Is This Stuff? This is a small collection of scripts to make developing on a linux virtual server platform easier. It is designed to allow multiple developers who each need multiple independent machines to work on the same physical box without interfering with each other. Each developer can create and destroy virtual machines with happy abandon, allowing him (or her) to test deployment, and function of multiple versions of the application without interferance or destruction from others. I assume that the machine you're using is running VServer kernel ctx-13 or better, and has the vserver-admin 0.20 or better rpm (or its equivalent) installed. I also assume you have bash and perl (5.6 or better) on the vserver server. For information on installing and running VServer, see the VServer web pages. These scripts are written on the assumption that your development vservers are isolated to their own class C IP network; as shipped this is "10.0.25.*". You can change this by editing the number in vbuild.params/current.ip.num. I also reserve the first 20 ip addresses in the space for miscellaneous use (as, for example, the ip address of the vserver server). Change this by fixing the "-b" argument of the "nextIP.pl" command line buried in bin/mkVS.sh. Setup Create an account on your VServer server and untar the distribution tar file into its root (e.g. "/home/vsmaker"). Move everything in the distribution directory to your account's root, as: cd /home/vsmaker/vsmaker-0.0.3 mv . .. Move the "dotbash_profile" and "dotenvfile" files to the appropriate names, as: cd /home/vsmaker mv dotbash_profile .bash_profile mv dotenvfile .envfile You may wish to edit the .bash_profile file to conform to local custom (if, for example, you automatically log in to a cvs system). Edit the /etc/sudoers file on the vserver server and add the appropriate privilages for your vsmaker user. I have included an example sudoers file in the distribution as "sudoers.example". Now create a "vsroot" vserver with the vserver script, as: vserver vsroot build This is the root vserver from which vsmaker/bin/mkVS.sh will build all new vservers. You can prune as much from /vservers/vsroot as necessary to cut down on the amount of disk space each new vserver will consume. The vbuild.params directory is where the "bin/mkVS.sh" script keeps its current ip and MAC addresses. Each time you run mkVS.sh, it will increment those addresses. The "current.ip.num" file contains the current IP address, and the "current.mac.num" file contains the current MAC number. The scripts will edit the new /etc/vservername.conf file to bind the new vserver to the correct IP address, but they'll only put the new MAC address in its /tmp/ directory as "/tmp/fakeMACAddress.txt". It's your application's responsibility to spoof it from there as necessary. The "help.sh" script documents the scripts shipped. Changelog Version 0.0.3 * ip addresses now kept in name/address database. * VSCp now works the way you expect it: you can copy a file to a directory, or a directory to another directory. Version 0.0.2 * Improved error detection * Creating a new vserver with the same name as another one no longer allowed * If a vserver's eth0: subdevice is still up, don't delete the vserver. (this can cause major pain. Apparently a bug in vserver keeps the subdevice up if you enter and then exit a stopped vserver with the vserver script). * Added "clone" flag to vserver generator script * Improved doc (heck, _anything_ is an improvement!) Version 0.0.1 Original Release To Do * Make the MAC address generator track which addresses are being used instead of blindly incrementing each time a server is created * Improve parameter handling (e.g. ip address limits). * Figure out ways to use other vserver features, such as vunify. * Add More Cool Scripts and options. Happy Hacking!