Closed (fixed)
Project:
Hosting
Version:
6.x-0.4-alpha3
Component:
User interface
Priority:
Normal
Category:
Feature request
Assigned:
Reporter:
Created:
12 Nov 2009 at 00:38 UTC
Updated:
4 Mar 2011 at 01:31 UTC
This heavily depends on Ubercart. We could use another solution and we need to abstract away the quota system (see #533330: Quota API for that) but basically, Ubercart is the cleanest solution we have found and we have had multiple discussions with the UC folks so we're likely to go that way.
In a sense, most of the logic will therefore be in Ubercart more than Aegir, but I'm writing this down here anyways to keep track of it somewhere.
Comments
Comment #1
anarcat commentedComment #2
anarcat commentedSo this chat was a good occasion for me to reflect on our requirements and on our side of the implementation. Basically, what we need on our side is:
* a quota system - maybe #533330: Quota API is a good basis
* a statistics system - this will be necessary to collect information that is outside of aegir (bandwidth, disk usage and so on). this would work by collecting information from the outside and file it in the Aegir database. then that information (and information that is already in Aegir like the number of sites or which platforms/profiles are available) would be available through hooks.
* a billing system that would regularly check the quotas (Ubercart, for now)
It would look something like this:
Some explanations on the hooks declared above:
*
hook_hosting_stats()declares the resources available in a module*
hook_hosting_stats_update()is fired regularly to update the current usage (probably by running a task or something, on some modules, like hosting_site, it's a null operation because it's already in the DB)*
hook_hosting_quota()would return the current quota usage based on the collected stats*
hook_hosting_quota_set()is fired when the current limit for a given resource is set (could fire up a task to set the quota on a disk, for example)*
hook_hosting_quota_check()compares the stats against the current limitI'm unsure, at this point, if it's relevant to have a separate "stats" module from the quota system. I don't see the gain in keeping this separate. But I drew this nice graph so I wanted to put it forward. We can probably all fold this into the quota system that would manage resources.
So this would fold into:
*
hook_hosting_quota()declares the resources available in a module*
hook_hosting_quota_update()is fired regularly to update the current usage (probably by running a task or something, on some modules, like hosting_site, it's a null operation because it's already in the DB)*
hook_hosting_quota_get()would return the current quota usage based on the collected stats*
hook_hosting_quota_set_limit()is fired when the current limit for a given resource is set (could fire up a task to set the quota on a disk, for example)*
hook_hosting_quota_check()compares the stats against the current limit (return false if the limit is reached)The algorithm for checking the quotas would be:
* quotas are checked every P period (e.g. a month)
* R is the resource, with a Q quota and a U usage this month
* A is the amount paid for the monthly Q quota, O is the overquota charged when the quota is exceeded
* the the amount charged every month is: A + (U-Q)*O
If A == 0, then the scheme is usage-based: that is, people only pay for what they use.
If A > 0, then the scheme is quota-based: that is, people pay a regular fee and (optionnally, if O > 0) an extra when they overrun their quota.
I believe that system is flexible enough to accomodate all needs and is extensible enough to accomodate new ones.
Comment #3
anarcat commentedLet's move the quota system discussions back into #533330: Quota API and keep this here for Ubercart interoperability.
Comment #4
bgm commentedsubscribing
Comment #5
kvvnn commentedWow. Awesome ascii map man! Haha, awesome discussion here.
I am very close to offering a serious bounty on this work. Will update after some more research / discussion.
Comment #6
sfyn commentedsub
Comment #7
sfyn commentedHey folks, I'm taking this on for a while, since we are going ahead with this at Koumbit to have a system that is open to clients in the next couple months.
Comment #8
hadsie commentedI've done a bit of work on some basic integration between the two (pretty much all the code is just implementing ubercart hooks).
I've posted the code on github: http://github.com/hadsie/UC-Aegir
Note that this doesn't have a frontend to actually purchase sites at this point since I'm using a custom interface for my users to do that. Basically what I had planned was to add a theme_uc_aegir_add_to_cart function that could be added to site nodes.
It works by adding an ubercart product feature and a conditional action. The product feature allows you to assign an install profile to a product (so different install profiles could be different prices). I haven't tried it with product classes, so I don't think it will work with those. The add to cart form needs a hidden variable that sets the aegir_site_nid (this is what theme_uc_aegir_add_to_cart would do). This way when you go through the purchase it will assign a site nid to a order product.
The conditional action is quite simple. It simply runs a given hosting task on all sites that were contained in the order.
I've tested it with uc_recurring enabled and it's working fine as all this does is associate the site with an order item, and everything else in ubercart flows the same.
It's clearly not as robust as what's discussed above but I needed to get something working by the end of the month and this is doing the trick for me for now.
If there's anything in particular I can start working on with the api quota related UC stuff let me know. I'd be happy to move any relevant code to that project.
Comment #9
sfyn commentedAwesome, thanks!
I have done my own work programtically defining a class for aegir products, but not much more. I'll take a look at your stuff and see how I can go about getting the two streams talking to each other.
Comment #10
univate commentedWhat would be good is a ubercart product feature to add 'quota' items - #533330: Quota API
That way you can build products that have something like "1 site with 1GB of storage and 10GB Bandwidth" or use attributes to allow your clients to custom build a plan they want.
I may even have a go at building this now that the quota stuff has been committed.
Comment #11
sfyn commentedI was thinking about this, and I would like to see the quotas appear as attributes, allowing price changes depending on quota choices at the time of purchase. Later on, we can allow folks to change their attributes, thereby changing their recurring price.
I notice that the module from #8 associates an install profile to an aegir product, hadsie mentions this is to allow pricing by install profile. I think quota based pricing makes more sense - I don't know, to be honest. We can have both, too.
Comment #12
sfyn commentedSo some clearer reflection now that I have had a chance to look at this.
Hadsie's module implements sites as the product.
The model I am working with at Koumbit implements the hosting client as the product. Clients then have quotas applied to them, including number of sites.
They are a little different.
The implementation I am working towards right now, as a first phase is:
I have ten days left to accomplish this, which is why it is such a restrained set of initial features.
In subsequent phases we would include:
I am going to go ahead with my first phase, because it's what we need for our work. I would like to incorporate the concept of sites as a product into it eventually, my ideal being that the two approaches live side by side with as much of a shared api as possible while allowing folks to make choices about how to market their aegir services.
Comment #13
adrian commentedi think the client as the product makes a lot of sense. =)
you pay for your account.
Comment #14
sfyn commentedHi folks,
Here is my update with a git repo of my work up to date on the module.
http://git.koumbit.net/?p=aegir_kt/uc_hosting.git;a=summary
I am presently working on exposing an admin interface to manipulate the quota-linked attributes. After that I will do a once-over for comments and documentation, and then submit this to drupal.org.
The module depends on at least aegir0.4alpha9
Comment #15
sfyn commentedBumping the version on this. uc_hosting depends on the quota api, which is only available as of 0.4alpha8
Comment #16
sfyn commentedHi folks, for those of you following this I will be working on the module today, and it would be great to have some help.
Comment #17
sfyn commentedHey folks.
uc_hosting is up on drupal.org, though by no means finished.
I will need folks for lots of stuff, and will be outlining my rationale a little more fully than it is on here in the aegir discussions on groups.
For the time being I am marking this as needs review and invite you to start using the module's issues queue. If you really want to get your hands on it soon, since the first snapshot won't be showing up right away, I invite you to check it out with git through the repo linked as the project homepage
Comment #18
sfyn commentedComment #19
omega8cc commentedPlease keep this thread open. We will test uc_hosting for sure and will report all issues there, but this thread in the Hosting project open will help to drive the traffic to uc_hosting :)
Thanks!
Comment #20
Pls commentedGreat stuff. Definetely will give it a try and report any issues.
Comment #21
wik commentedwow, subscribing
Comment #22
anarcat commentedI don't think we should leave this as needs review. People that want to try the module should try it out and submit issues in the other queue. This has been clobbering this queue for too long, sorry. :)
I'm sure it's got the publicity it needed by now. ;)