OvzCP#2: Billing

Hi, this is the second chapter of engineering OvzCP.

One of OvzCP’s goal is that it should be “hosting” control panel so it must have billing system while allow me to use for free.

First, I think that the user should be billed monthly with the amount they use, but seems that if user reduce the amount at the last day of month, they will be billed less than normal. I think about this for about 2 days and got the idea: game-like credit system.

I just commited this feature in. It took me about an hour to make it.

Hi, this is the second chapter of engineering OvzCP.

One of OvzCP’s goal is that it should be “hosting” control panel so it must have billing system while allow me to use for free.

First, I think that the user should be billed monthly with the amount they use, but seems that if user reduce the amount at the last day of month, they will be billed less than normal. I think about this for about 2 days and got the idea: game-like credit system.

I just commited this feature in. It took me about an hour to make it. Each VM will consume credit depending on memory and disk space setup in each cron run. If a user reached zero credit all VM that’s running will be stopped. Also, when a user have less than 100 credit he can’t start any more VM.

That solution seems to be great, but some user think it make they hard to calculate time left until credit runs out. I remedy this by value one real-world currency to many credit that equal to the amount of minutes in a month so if VM’s billing said they need 200 credit to run this VM per minute, they will pay 200 in real world.

(Note: Credit per real world currency rate can be adjusted in the configuration. The only number that’s hard coded here is 100 credit requirement to start VM)

With this feature online, I now run OvzCP as one of system’s daemon now. Of course, my credit is 1 trillion (1×1012) and it will be depleted in about 350199 days.

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