summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAntoine Beaupré2010-11-19 20:43:07 (GMT)
committeranarcat2010-11-19 20:43:07 (GMT)
commiteb002746c86abc815ef223c2a3a2c1ba7714116a (patch)
treed4aba852382965f27ebdd390b90e4bbf26ad8b5f
parentd4339f9f3d82d870ae90e4b2c28e823238ec8f8f (diff)
parent1c0529455356f35620c6087569cab040d9e96a29 (diff)
Merge branch 'dev-multiserver-install'
-rw-r--r--install.hostmaster.inc51
1 files changed, 34 insertions, 17 deletions
diff --git a/install.hostmaster.inc b/install.hostmaster.inc
index 7e8732f..da99d23 100644
--- a/install.hostmaster.inc
+++ b/install.hostmaster.inc
@@ -23,20 +23,18 @@ function drush_provision_hostmaster_install_validate($site = NULL) {
drush_print("==============================================================================");
if (!$site || !drush_get_option('aegir_host', NULL) || !drush_get_option('aegir_db_pass', NULL) || filter_var(drush_get_option('client_email'), FILTER_VALIDATE_EMAIL)) {
- drush_print("Some settings have not been guessed and will now be prompted.
+ drush_print("Some settings have not been provided and will now be prompted.
Don't worry: you will get to review those settings after the final install");
}
// now we prompt the user for settings if not provided or not sane
if (!$site) {
- $site = drush_prompt(dt("Aegir domain name"), provision_fqdn());
+ $site = drush_prompt(dt("Aegir frontend URL"), provision_fqdn());
}
drush_set_option('site', $site);
- $aegir_host = drush_get_option('aegir_host', NULL, 'options');
- if (is_null($aegir_host)) {
- $aegir_host = drush_prompt(dt("Master server FQDN"), provision_fqdn());
- }
- drush_set_option('aegir_host', $aegir_host);
+ drush_set_default('aegir_host', $site);
+ $aegir_host = drush_get_option('aegir_host');
+ drush_set_default('aegir_db_host', $aegir_host);
if (is_null(drush_get_option('aegir_db_pass', NULL))) {
// XXX: may not be portable everywhere?
@@ -46,8 +44,13 @@ Don't worry: you will get to review those settings after the final install");
print "\n"; // add a newline since the user's didn't print
}
+ if ($aegir_host == 'localhost') {
+ $default_email = 'webmaster@example.com';
+ } else {
+ $default_email = 'webmaster@' . $aegir_host;
+ }
while (!filter_var(drush_get_option('client_email'), FILTER_VALIDATE_EMAIL)) {
- $client_email = drush_prompt(dt("Admin user e-mail"), "you@example.com");
+ $client_email = drush_prompt(dt("Admin user e-mail"), $default_email);
drush_set_option('client_email', $client_email);
}
@@ -72,6 +75,7 @@ The following settings will be used:
Aegir user: !user
Web group: !web
Web server: !web_server
+ Aegir DB host: !db_host
Aegir DB user: !db_user
Aegir DB password: !db_pass
Drush make version: !drush_make
@@ -85,6 +89,7 @@ The following settings will be used:
'!user' => drush_get_option('script_user'),
'!web' => drush_get_option('web_group'),
'!web_server' => drush_get_option('http_service_type'),
+ '!db_host' => drush_get_option('aegir_db_host'),
'!db_user' => drush_get_option('aegir_db_user'),
'!db_pass' => is_null(drush_get_option('aegir_db_pass', NULL, 'process')) ? '<previously set>' : '<prompted>',
'!drush_make' => drush_get_option('drush_make_version'),
@@ -110,11 +115,8 @@ function drush_provision_hostmaster_install($site = NULL) {
$aegir_db_user = drush_get_option('aegir_db_user');
$aegir_db_pass = drush_get_option('aegir_db_pass');
- $master_db = sprintf("mysql://%s:%s@%s",$aegir_db_user, $aegir_db_pass, drush_get_option('aegir_host'));
-
- // TODO: support creation of an external db server
$server = '@server_master';
- drush_backend_invoke_args("provision-save", array($server), array(
+ $master_context = array(
'context_type' => 'server',
// files
'remote_host' => drush_get_option('aegir_host'),
@@ -124,10 +126,25 @@ function drush_provision_hostmaster_install($site = NULL) {
'http_service_type' => drush_get_option('http_service_type'),
'web_group' => drush_get_option('web_group'),
'master_url' => "http://" . $site,
- // mysql
- 'db_service_type' => 'mysql',
- 'master_db' => $master_db,
- ));
+ );
+
+ $master_db = sprintf("mysql://%s:%s@%s",$aegir_db_user, $aegir_db_pass, drush_get_option('aegir_db_host'));
+ if (drush_get_option('aegir_host') == drush_get_option('aegir_db_host')) {
+ $master_context['db_service_type'] = 'mysql';
+ $master_context['master_db'] = $master_db;
+ $dbserver = $server;
+ } else {
+ $dbserver = '@server_' . drush_get_option('aegir_db_host');
+ $dbserver_context = array(
+ 'remote_host' => drush_get_option('aegir_db_host'),
+ 'context_type' => 'server',
+ 'db_service_type' => 'mysql',
+ 'master_db' => $master_db,
+ );
+ drush_backend_invoke_args("provision-save", array($dbserver), $dbserver_context);
+ provision_backend_invoke($dbserver, 'provision-verify');
+ }
+ drush_backend_invoke_args("provision-save", array($server), $master_context);
provision_backend_invoke($server, 'provision-verify');
// exit if an error has occured.
@@ -167,7 +184,7 @@ function drush_provision_hostmaster_install($site = NULL) {
drush_backend_invoke_args("provision-save", array($site_name), array(
'context_type' => 'site',
'platform' => $platform_name,
- 'db_server' => $server,
+ 'db_server' => $dbserver,
'uri' => $site,
'client_email' => drush_get_option('client_email'),
'profile' => 'hostmaster',