Commit cc007792 authored by anarcat's avatar anarcat Committed by anarcat

move all we can in the hostmaster install command, which is only one command now

parent 252df16c
......@@ -57,26 +57,15 @@ class provisionService_db extends provisionService {
function __construct() {
$master_db = drush_get_option('master_db');
if ($master_db) {
$db = parse_url($master_db);
$host = urldecode($db['host']);
$user = urldecode($db['user']);
$pass = urldecode($db['pass']);
$scheme = $db['scheme'];
if (!$master_db) {
drush_set_error("PROVISION_DB_FAILED", dt("Database credentials unavailable, run provision-verify"));
}
else {
#TODO - this stuff is all pretty wrong imo. it should not be asked here
drush_print(dt("No database configuration provided, asking for one interactively"));
$scheme = drush_prompt(dt("Database type"), "mysql");
$host = drush_prompt(dt("Database server"), "localhost");
$user = drush_prompt(dt("Database user"), "root");
system('stty -echo');
$pass = drush_prompt(dt("Database password"));
system('stty echo');
print "\n"; # add a cr since the user's didn't echo
drush_set_option('master_db', "$scheme://$user:$pass@$host", 'user');
}
$db = parse_url($master_db);
$host = urldecode($db['host']);
$user = urldecode($db['user']);
$pass = urldecode($db['pass']);
$scheme = $db['scheme'];
drush_set_default('master_db_user', $user);
drush_set_default('master_db_passwd', $pass);
......
......@@ -5,7 +5,41 @@
*/
function drush_provision_hostmaster_install($site) {
$platform = drush_locate_root(drush_get_option(array('r', 'root'), NULL));
$version = drush_get_option('version', 'HEAD');
$platform = drush_get_option(array('r', 'root'), drush_server_home() . '/' . 'hostmaster-' . $version);
if (!drush_get_option('backend-only')) {
drush_backend_invoke('hostmaster-make', array($platform));
}
$data['master_db'] = drush_get_option('master_db');
if (!$data['master_db']) {
drush_print(dt("No database configuration provided, asking for one interactively"));
$scheme = drush_prompt(dt("Database type"), "mysql");
$host = drush_prompt(dt("Database server"), "localhost");
$user = drush_prompt(dt("Database user"), "root");
system('stty -echo');
$pass = drush_prompt(dt("Database password"));
system('stty echo');
print "\n"; # add a cr since the user's didn't echo
$data['master_db'] = "$scheme://$user:$pass@$host";
}
$data['init_http'] = 'apache';
$data['init_db'] = 'mysql';
$data['provision_context'] = 'server';
$data['parent_path'] = drush_server_home();
$data['web_group'] = 'www-data'; #for now
$data['drush_path'] = DRUSH_COMMAND;
// verify the server
drush_backend_invoke('provision-verify', $data, 'POST');
if (drush_get_option('backend-only')) {
return;
}
// verify the current platform
drush_backend_invoke('provision-verify', array(
'root' => $platform,
......
......@@ -37,6 +37,7 @@ WEB_GROUP=www-data
# doesn't exist yet, but we need drush_prompt in HEAD
DRUSH_VERSION=All-versions-3.0-rc4
DRUSH_MAKE_VERSION=6.x-2.0-beta6
CLIENT_EMAIL="you@example.com"
# when adding a variable here, add it to the display below
......@@ -138,14 +139,6 @@ else
exit 1
fi
msg "Creating basic directory structure"
mkdir -p $AEGIR_HOME/config/vhost.d
mkdir -p $AEGIR_HOME/config/platform.d
mkdir -p $AEGIR_HOME/config/apache.d
mkdir -p $AEGIR_HOME/backups
chmod 0711 $AEGIR_HOME/config
chmod 0700 $AEGIR_HOME/backups
# we need to check both because some platforms (like SunOS) return 0 even if the binary is not found
if which drush 2> /dev/null && which drush | grep -v 'no drush in' > /dev/null; then
msg "Drush is in the path, good"
......@@ -192,19 +185,6 @@ else
fi
fi
# this will prompt the user for the database password if not provided through stdin in JSON
$DRUSH provision-verify --parent_path="$AEGIR_HOME" --web_group="$WEB_GROUP" --drush_path="$DRUSH" --provision_context="server" --init_http="apache" --init_db="mysql"
msg "Aegir provision backend installed successfully"
if [ ! -z "$BACKEND_ONLY" ] ; then
exit 0
fi
if [ ! -d $HOSTMASTER_DIR ] ; then
msg "Deploying hostmaster application"
$DRUSH hostmaster-make $HOSTMASTER_DIR
msg "Installing the frontend"
$DRUSH hostmaster-install --client_email="$CLIENT_EMAIL" --backend-only=$BACKEND_ONLY --root="$HOSTMASTER_DIR" --version="$AEGIR_VERSION" --parent_path="$AEGIR_HOME" --web_group="$WEB_GROUP" $AEGIR_DOMAIN
msg "Installing hostmaster"
$DRUSH hostmaster-install --root="$HOSTMASTER_DIR" $AEGIR_DOMAIN
fi
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment