Installing Warden on debian Wheezy
by Gastón Ramos
What is warden?
“The project’s primary goal is to provide a simple API for managing isolated environments. These isolated environments — or containers — can be limited in terms of CPU usage, memory usage, disk usage, and network access. As of writing, the only supported OS is Linux.”
read more here: https://github.com/cloudfoundry/warden/tree/master/warden
Warden is a key component in the Cloud Foundry ecosystem. When you push a new app to Cloud Foundry a new container will be created.
So, lets go to the point, the idea is to install warden in a debian wheezy system, I added debian support to warden in my fork in the Altoro’s repo: https://github.com/Altoros/warden
In order make a fresh installation we are going to use vagrant with virtualbox provider, lets start downloading the vagrant box from http://www.vagrantbox.es/.
axel -n 10 http://downloads.shadoware.org/wheezy64.box
Then add the new box to vagrant:
vagrant box add debian-wheezy64 wheezy64.box
Then list all the available boxes to see if it was added ok:
vagrant box list
and you should see something like that:
debian-wheezy64 (virtualbox) precise64 (virtualbox)
Then lets create a new folder and create our vagrant VM
using the box that we just already added:
mkdir testing-warden-on-debian cd testing-warden-on-debian vagrant init debian-wheezy64
Now we are ready to start installing warden in the VM:
vagrant ssh sudo apt-get install -y build-essential debootstrap quota
Edit fstab and add this line:
sudo vi /etc/fstab cgroup /sys/fs/cgroup cgroup defaults 0 0
Now clone the warden repo and checkout the add-debian-rootfs
email@example.com:Altoros/warden.git cd warden git checkout add-debian-rootfs
add warden as shared folder in Vagrant file
edit Vagrant file and add this line:
config.vm.synced_folder "warden", "/warden"
then login into the vm with ssh and install all required gems:
cd /warden sudo gem install bundler sudo bundle
edit config/linux.yml and change the container_rootfs_path,
if you don’t change it the setup will be lost after you reboot the vm because it is pointed to /tmp by default.
I’ve created a new dir in /tmp-warden and pointed the root_fs to it.
After that you can run the setup
sudo bundle exec rake setup[config/linux.yml]
and when it finishes you will be able to start the warden server:
sudo bundle exec rake warden:start
and then run the client to be able to manage containers:
bundle exec bin/warden
Lets run some basic warden commands:
Create 2 new containers:
bundle exec bin/warden warden> create handle : 171hpgcl82u warden> create handle : 171hpgcl82v warden>
List the already created containers:
warden> list handles : 171hpgcl82u handles : 171hpgcl82v warden>
You can see the directories of the containers, replace [tmp-warden] with the folder that your filled in the config/linux.yml:
ls -l /[tmp-warden]/warden/containers/ drwxr-xr-x 9 root root 4096 Jul 15 13:55 171hpgcl82u drwxr-xr-x 9 root root 4096 Jul 15 13:58 171hpgcl82v drwxr-xr-x 2 root root 4096 Jul 15 12:18 tmp
If you take a look to the logs while you create a container, you can figure out that this is the flow more or less:
1. method: “set_deferred_success”
2. Create the container
4. Start the container
5. method: “write_snapshot”
6. method: “dispatch”
And thats all, if you have any comments feel free to post them here!