Commit 06d0a9fb authored by Adrian Rossouw's avatar Adrian Rossouw

Rewrite install docs so that the aegir_root user is created by install.sh.txt,...

Rewrite install docs so that the aegir_root user is created by install.sh.txt, and we test for mysql and the hostnames before running script.
parent ff229017
......@@ -120,6 +120,34 @@ Shell commands::
The following details what configuration needs to be performed on the server
before going ahead with the install.
DNS Configuration
-----------------
Aegir requires that the hostname returned by the `hostname` and `uname -n`
shell commands, resolves to the IP address for this server.
Shell commands as root::
AEGIR_HOST=`uname -n`
resolveip $AEGIR_HOST
If the command returns your IP address, you are all set. If it returns
an error you will need to edit your ``/etc/hosts`` file.
First line of this file looks like:
``127.0.0.1 localhost``
Simply add all domains you want to this line. e.g:
``127.0.0.1 localhost $AEGIR_HOST $AEGIR_DOMAIN other1 other2``
If you only intend to use Aegir on a single server, it is acceptable for
the resolved IP address to be the '127.0.0.1' loopback address.
If you intend to manage multiple servers using Aegir, you will need to
make sure that the IP address is the public IP of this server.
Aegir user
----------
......@@ -133,9 +161,6 @@ the ability to modify the code of the site, the configured system account
needs to be a member of the web server group, in order to be able to correctly
set the file permissions.
More detailed instructions on this topic will be given later in the web
installation wizard.
This document assumes the Aegir user is ``aegir``, its home directory is
``/var/aegir`` and the webserver group is ``www-data``. You can choose another
username if desired.
......@@ -169,8 +194,7 @@ Shell commands as root::
a2enmod rewrite
ln -s /var/aegir/config/apache.conf /etc/apache2/conf.d/aegir.conf
The aegir user needs to have sudo access. The wizard will explain how to
do this, but you can already just add the relevant line to your sudoers
The aegir user needs to have sudo access. Add the relevant line to your sudoers
file.
/etc/sudoers configuration::
......@@ -187,34 +211,26 @@ remote web Aegir users with no passwords.
Database configuration
----------------------
The installer will prompt you for a MySQL superuser. This user is
required to create databases and users for new sites.
Create that user before running the install script using the following command.
SQL commands::
GRANT ALL PRIVILEGES ON *.* TO 'aegir_root'@'localhost' IDENTIFIED \
BY 'XXXXXXXX' WITH GRANT OPTION;
If you are only running a single server instance of Aegir, the default mysql
configuration will be sufficient for your needs, and you won't need to modify
your configuration file.
Change 'XXXXXXXX' with a real password.
If you are going to be managing multiple servers, you will need to adjust your
mysql configuration file to modify the ``bind-address`` setting and change
it to correctly represent your public ip address.
Any number of database servers may be used, replacing localhost with
hostmaster's hostname.
/etc/mysql/my.conf configuration line to change::
bind-address = 127.0.0.1
DNS Configuration
-----------------
Configuring DNS is up to you. Currently Aegir does nothing with DNS.
Wether you are running multiple servers or not, you should take this opportunity
to restart mysql, to clear any caches.
As a help trick, if you are installing Aegir locally to try and test it, you
can do local DNS by adding entries to file ``/etc/hosts``. First line of this
file looks like:
``127.0.0.1 localhost your-machine-name``
Simply add all domains you want to this line. e.g:
Shell command as root::
/etc/init.d/mysql restart
``127.0.0.1 localhost your-machine-name $AEGIR_DOMAIN other1 other2``
The installer will prompt you for your MySQL root user password. It will
not store this information, but instead use it to generate a new super
user account for the aegir system.
3. Run the install script
=========================
......
......@@ -21,26 +21,17 @@ function drush_provision_hostmaster_install($site = NULL) {
}
$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";
}
$aegir_host = drush_get_option('aegir_host', php_name('n'), 'options');
$aegir_db_pass = drush_get_option('aegir_db_pass', 'pass', 'options');
$aegir_db_user = drush_get_option('aegir_db_user', 'aegir_root', 'options');
$data['master_db'] = sprintf("mysql://%s:%s@%s",$aegir_user, $aegir_pass, $aegir_host);
// TODO: support creation of an external db server
$server = '@server_master';
drush_backend_invoke_args("provision-save", array($server), array(
'context_type' => 'server',
// files
'remote_host' => php_uname('n'),
'remote_host' => $aegir_host,
'aegir_root' => $aegir_root,
'script_user' => drush_get_option('script_user', provision_current_user()),
// apache or nginx or..
......
......@@ -63,13 +63,13 @@ prompt_yes_no() {
;;
esac
done
}
########################################################################
# Main script
AEGIR_HOME="$HOME"
AEGIR_HOST=`uname -n`
DRUSH="$AEGIR_HOME/drush/drush.php"
msg "Aegir automated install script"
......@@ -79,6 +79,26 @@ if [ `whoami` = "root" ] ; then
exit 1
fi
_RESOLVEIP=`resolveip $AEGIR_HOST 2> /dev/null`
if [ -z $_RESOLVEIP ] ; then
msg "This server does not have a hostname that resolves to an IP address"
exit 1
else
AEGIR_HOST_IP=`echo $_RESOLVEIP | cut -d: -f2 | awk '{ print $6}'`
true
fi
_MYSQLTEST=`mysql -h$AEGIR_HOST_IP -uINVALIDLOGIN -pINVALIDPASS 2>&1 >/dev/null | cat`
if [ -z `echo $_MYSQLTEST | grep -q "ERROR 2003"` ] ; then
msg "MySQL is listening on $AEGIR_HOST_IP."
true
else
msg "MySQL is not configured to listen on $AEGIR_HOST_IP."
exit 1
fi
msg "This script makes the following assumptions: "
cat <<EOF
* you have read INSTALL.txt and prepared the platform accordingly
......@@ -92,6 +112,24 @@ else
exit 1
fi
AEGIR_DB_USER=aegir_root
AEGIR_DB_PASS=`echo $RANDOM:`date`:`hostname` | md5`
msg "Aegir will now generate a mysql super user password for you: "
cat <<EOF
Username : $AEGIR_DB_USER
Password : $AEGIR_DB_PASS
Hostname : $AEGIR_HOST ($AEGIR_HOST_IP)
You will be asked to enter your mysql root user password now :
EOF
/usr/bin/mysql -h$AEGIR_HOST -uroot -p mysql<<EOFMYSQL
GRANT ALL PRIVILEGES ON *.* TO '$AEGIR_DB_USER'@'$AEGIR_HOST' IDENTIFIED BY '$AEGIR_DB_PASS' WITH GRANT OPTION;
GRANT ALL PRIVILEGES ON *.* TO '$AEGIR_DB_USER'@'$AEGIR_HOST_IP' IDENTIFIED BY '$AEGIR_DB_PASS' WITH GRANT OPTION;
EOFMYSQL
# 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"
......@@ -131,4 +169,4 @@ else
fi
msg "Installing the frontend"
$DRUSH hostmaster-install $@
$DRUSH hostmaster-install --aegir_host=$AEGIR_HOST --aegir_db_user=$AEGIR_DB_USER --aegir_db_pass=$AEGIR_DB_PASS $@
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