Posted by avdp on May 14, 2010 at 3:40pm
Hi,
After reading mig5ster's excellent info on his site about Aegir, Drush Make and Installation Profiles I have the following (at this moment theoretical) question:
Is it possible to create installation profiles with user input (forms) to specify the details of the site, use them with Aegir and a platform that incorporates this profile?
Since the installation of a site is done at the backend of Aegir (which is great off course), it seems impossible to have user input (e.g. custom names).
Is this correct or am I missing something?
Regards.
Comments
You can't pass forms into
You can't pass forms into aegir the same way that install profiles normally work (with multiple steps). The approach I've taken is to use hook_form_alter on the aegir signup form to have extra fields that I need. I save that data into a custom table.
I also created a mymodule.drush.inc to implement the drush_mymodule_pre_hosting_task hook (I think hosting_alias has an example of this). This way I can pass the extra data into my install profile and access it via drush_get_option('mysetting').
Hope that helps :)
Having done this just this
Having done this just this week, I can tell you it's anything but straight forward and doesn't entirely work properly yet.
1.) The ajax callbacks for the form (to depend upon which profile is selected) is currently a little broke. Hopefully I can help rewrite that shortly, but for the moment profile changes aren't registered because js isn't rebound to that element when it refreshes on the page.
2.) as hadsie mentions there's this whole idea of "front side" and "back side" within aegir. Aegir utilizes drush to pass variables from the frontside to the backside. These are done as options of the drush command. Essentially you'll extend the site form by building your own module that form alters your fields onto it. These fields will then need to be passed in such a way that they end up on the $task->ref object within your mymodule.drush.inc within the drush_mymodule_pre_hosting_task() hook (again just as hadsie saide).
This will end up being something like this:
$task->ref (this is actually your node object)
$task->option['my_parameter'] = $task->ref->my_parameter; // This MUST be a contiguous string, I passed modules to enable via a module1:module2:module3 this week for example
By doing this in the hook, you will have the ability to drush_get_option('my_parameter') and have it returned to you.
Then you need a final component. Within your .drush directory (probably in var/aegir/.drush if you followed the debian howto) you'll need to create your own package. It will need a package_name.drush.inc (suggest this be different then your module, since drush won't pick up two files of the same name). This file can be just "<?php" and nothing more in it. You will then build an install.provision.inc. Check other files of the same name in the provision package, however there is are pre/post install hook names in there that you can then use as necessary. The post install hook as fired AS the new site... This was really useful for installing optional modules.
Hope this helps. I intend on writing up a real tutorial once the ajax portion of this is squared away properly. But until then, this will hopefully help.
Eclipse