Club Distro Package Builder

I didn’t have bzr.vcs.whsgroup.ath.cx any more so no one can grab a copy of my Club Distro Package Builder. It’s entered final round in NSC 2009, but didn’t win any award.

So there you are: [http://whs.whsgroup.ath.cx/cdpb.tar.bz2](http://whs.whsgroup.ath.cx/cdpb.tar.bz2)

That file is exported from my bzr tree. I still have my bzr tree intact and if you want a copy, please email me at manatsawin on gmail or @manatsawin

The setup is quite complicated. I think I wrote setup instruction in Redmine but the data was lost.

0. Extract everything to /var/ppa
1. sudo -s
2.

I didn’t have bzr.vcs.whsgroup.ath.cx any more so no one can grab a copy of my Club Distro Package Builder. It’s entered final round in NSC 2009, but didn’t win any award.

So there you are: [http://whs.whsgroup.ath.cx/cdpb.tar.bz2](http://whs.whsgroup.ath.cx/cdpb.tar.bz2)

That file is exported from my bzr tree. I still have my bzr tree intact and if you want a copy, please email me at manatsawin on gmail or @manatsawin

The setup is quite complicated. I think I wrote setup instruction in Redmine but the data was lost.

0. Extract everything to /var/ppa
1. sudo -s
2. ./sugpg –gen-key
3. Edit config.ini and set dist=karmic or whatever you want
4. Install python-jinja2 python-webpy python-debian python-psyco devscripts pbuilder build-essential inetutils-inetd python-setuptools apache2 libapache2-mod-wsgi
5. sudo easy_install CleverCSS
6. Add dputd 5002/tcp to /etc/services
7. Add dputd stream tcp nowait root /var/ppa/dputd.py
8. Restart inetd
9. Add a VHost that allow .htaccess and points to /var/ppa in apache. Other apache configuration probably done by .htaccess already

Now enjoy CDPB by adding your keys and put your package in!

Note: If you see any mistake, please correct me at manatsawin on gmail or @manatsawin

OvzCP#1: Introduction

Back then at #nlcX final round, which was held at the same place as the NSC competition. (National software competition) I plan to enter the next NSC competition so I take a look around for some project idea.

First, I got my own highly innovative idea from my Twitter timeline, I saw a tweet and got a really cool idea about game that runs on Palm webOS. This is very hard to create as I have to learn many new technology and how I can create that game in short time. But when NSC result announced I, standing next to the stage sweared that next year I will do a control panel for @whsgroup.

Back then at #nlcX final round, which was held at the same place as the NSC competition. (National software competition) I plan to enter the next NSC competition so I take a look around for some project idea.

First, I got my own highly innovative idea from my Twitter timeline, I saw a tweet and got a really cool idea about game that runs on Palm webOS. This is very hard to create as I have to learn many new technology and how I can create that game in short time. But when NSC result announced I, standing next to the stage sweared that next year I will do a control panel for @whsgroup. (The winner in student software category is web hosting control from iberrystudio, congrats!)

Why I announce it so loud without fearing other will copy it? Because I have a year of OpenVZ experience and setup on hand. From what I saw OpenVZ is not easy to learn and it’s slightly complicated I don’t think anyone else can make a paravirtualization control panel in time for the contest.

Now on to the story, I have been coding OvzCP for a week now and the basic feature is almost complete except of creating and destroying the virtual machine. The blurry screenshot can be see at the front page of whsgroup.ath.cx (that’s the creation page)

One of the feature of OvzCP is automated Varnish control. Back then, whsgroup.ath.cx’s varnish (reverse proxy) use my hand-written configuration. I use complicated regular expression (like ^(t|os|whs).whsgroup.ath.cx$ because I’m lazy to write many elseifs. Now, OvzCP have come to automated my configuration.

Porting my old configuration is painless. I don’t use many varnish feature such as caching (as this is both development and production environment) so I just write a importer like this:

from models import *
import openvz
for i in openvz.listVM():
if not VM.select(VM.q.veid == i.veid).count():
owner = “manatsawin@gmail.com”
if i.veid == 105:
owner = None
VM(veid=i.veid, owner=owner)
vm = VM.select()
whs=VarnishBackend(name=”whs”, port=80, vm=vm[1])
glo=VarnishBackend(name=”global”, port=80, vm=vm[0])
VarnishCond(hostname=”whs.whsgroup.ath.cx”, varnishBackend=whs)
VarnishCond(hostname=”whsgroup.ath.cx”, subdomain=False, varnishBackend=glo)

(Varnish have backend definition, and vcl_recv condition. OvzCP frontend doesn’t display backend configuration but merge both backend and condition in one easy to configure display while never make duplicate or orphan backend)

Then just run that file. Now my old configuration got imported in. Then I will order OvzCP to regenerate varnish configuration by running varnish.py. It will restart varnish automatically.

I think OvzCP’s API is quite easy to learn but the code isn’t. Currently it’s about 650 lines of Python code and some shell script (for port forwarding) sloccount estimated that I have done 1.5 person-month already. (Note that I don’t use don’t repeat yourself philosophy and copy-pasting whenever I feel suitable)

OvzCP probably be open-sourced during the NSC competition. I hope to finish writing it by the next month. Of course, since I use every project I created I will see many issue while using my software and I will always improve it.

**PS.** I think I really need a new theme for my blog!