Case Use Question

Events happening in the community are now at Drupal community events on www.drupal.org.
kvvnn's picture

Hello everyone. Awesome, awesome stuff here.

I am wondering if the following is possible using this platform, and looking for general ideas about the technical requirements :

  1. A user registers for an account, as they would on any other Drupal website.
  2. A sub site is created at username.website.com
  3. The user can log in and manage their (and only their) website at username.website.com

Comments

it's possible

skwashd's picture

It would be possible to do something like this.

You can enable user registration just like any other drupal site

Off the top of my head I would suggest creating stub sites you should create a new module say kr_usersites or whatever you want to call it. You would need to implement hook_user and handle the "insert" operation. In the hook it could call a function like this

/*
* The base domain name to use for username based sub domains
*/
define('KR_BASE_DOMAIN', 'example.com');

/

* Which Drupal platform to use?
*
* @internal obtained from aegir
*/
define('KR_TARGET_PLATFORM', 57); // Drupal 6

/

* Which Drupal install profile to use?
*
* @internal obtained from aegir
*/
define('KR_TARGET_PROFILE', 128); // default user install profile

/

* Implementation of hook_user
*
* @see hook_user
*/
function kr_usersites_user($op, &$edit, &$account, $category = NULL) {
  if ( 'insert' == $op ) {
    // do stuff here then call
    _kr_usersites_create_new_site
  }
}

/
*
* Queue the creation of a new site
*
* @param $url the url of the new site to be built
*
* @return void
*/
function _kr_usersites_create_new_site($client_id, $url) {
  // Import any sites that have not been created yet.
  $site = new StdClass();
  $site->type = 'site';
  $site->uid = 1; // change this if you want the user to be able to own/edit their own sites _in aegir_
  $site->title = $url;
  $site->platform = KR_TARGET_PLATFORM;
  $site->profile = KR_TARGET_PROFILE;
  $site->language = 'en'; // update as appropriate too
  $site->client = $client_id;
  $site->published = 1;
  node_save($site);
}

When writing your install profile, you should be able to do some form_alter magic to populate the default site information with the user's detaults from the aegir database. The install profile could email them when the build is complete with the login details for their new site and login info.

Do not give the new user user 1 rights on the new site. If you do they can enable the php input method and write code to attack other sites on the box. Give them a restricted set of features so they can use their drupal site without compromising others.

The only catch I see is being able to create the client so you have the client id before saving the user. I'll leave you to fill in the rest of the jigsaw.

Thanks

kvvnn's picture

Thank you.

If all goes then I'll be working on this project for the next 3 months, and will update my progress here, and hopefully help others in the future.

Also, I'll be donating some of my profit to Aegir (is there a paypal account?).

If anyone has any other ideas or advice, it would be much appreciated.

I'm off to learn about making modules and install profiles : )

I thought you could basically

mig5's picture

I thought you could basically do it by :

1) Enabling the Alias feature
2) Setting a default subdomain in admin/hosting/aliases("Domain used for automatic subdomain hosting")
3) setting up the sign-up form feature to allow clients to register for a site, which would then get an automatic subdomain assigned to them

That said, I haven't tried it :)

(I'm going to try this.)

popmechanic's picture

(I'm going to try this.)

This scenarios works, if your

doka's picture

This scenarios works, if your new site is on the same webserver as Aegir. See my quiestion here: http://groups.drupal.org/node/51778. Drawback is the user can define an other site name not just his/her user name in the sign-up form.

Domain module?

Justin Freeman's picture

This module might also be worth trying, http://drupal.org/project/domain

Agileware, Australian Drupal Developers
http://agileware.com.au

Not Domain

kvvnn's picture

After speaking with the developer of Domain, the following has been concluded:

"Use Domain for content syndication"

"Use Aegir for separate website hosting"

I would love someone to clarify further.

Clarification?

skwashd's picture

I'm not sure what you need clarified. What you posted is correct. I don't know how Domain fits into your jigsaw either.

I guess elaboration would be

kvvnn's picture

I guess elaboration would be a better word.

How are they technically different?

Domain does not use separate database prefixes (although I think it CAN), while Aegir separates sites by prefix within the database.

Aegir uses a separate codebase from its sub domains, while Domain uses a single codebase.

Good?

Aegir most definitely does

mig5's picture

Aegir most definitely does not use table prefixes within the database, it uses a separate database per site.

It stores sites in a multisite structure inside codebases called 'Platforms'.

Aegir is used for the provisioning and management of sites (backups, restores, migrations to other codebases, cloning of sites etc)

Afaik, Domain focuses on content/user distribution/sharing between sites

My Introduction to the Aegir Hosting System might be worth reading.

From Domain's project page:

The Domain Access project is a suite of modules that provide tools for running a group of affiliated sites from one Drupal installation and a single shared database

Aegir is a suite of modules that provide tools for managing sites across one or many Drupal/Drupal-like (Pressflow, OpenAtrium, Managing News etc) installations with a separate database for each, that don't necessarily have any affiliation between each other, other than the fact that Aegir manages them.

I don't really find the projects in any way related or similar.

Justin Freeman's picture

Only similar in that both Domain and Aegir can manage websites. Domain manages websites that can be loosely or tightly coupled, optionally sharing features and content, for multiple domains.

Domain has the ability to share content between websites but this can be disabled - it's not mandatory.

And of course, you know what Aegir can do better than me :)

Agileware, Australian Drupal Developers
http://agileware.com.au

Thanks!

kvvnn's picture

Thanks!

Your introduction is very

kvvnn's picture

Your introduction is very helpful, mig. Thanks.

So you start to form a picture in your mind of a pyramid structure: In Drupal multisite, a Core or a Platform manages many sites. Ægir is a level above that, in that it can manage many Platforms. So Ægir becomes very powerful, because through inheritance of managing many Cores or Platforms, it exponentially can manage many sites, be they Drupal 5, Drupal 6, Pressflow, or Openatrium sites. And so on.

actually

adrian's picture

it can manage multiple servers, which can have multiple platforms, which can have multiple sites.

Yeah, I understood that. I

kvvnn's picture

Yeah, I understood that. I quoted it to somewhat conclude this haphazard Discussion I was responsible for starting :)

Also: Is there an Aegir fund I can donate to?

Subdomain module might be worth a look too

Justin Freeman's picture

http://drupal.org/project/subdomain

"Subdomain automatically creates subdomains for your site and assigns nodes to those subdomains."

Agileware, Australian Drupal Developers
http://agileware.com.au

Pay for Signup ?

kvvnn's picture

I saw that this is an eventual goal for the project.

Is anyone currently implementing a pay-for-signup feature?

Is there any sort of base development started?

Aegir hosting system

Group organizers

Group categories

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds: