Commit a58284f2 authored by anarcat's avatar anarcat Committed by Hostmaster sandbox

Merge commit 'origin/master' into dev-koumbit

parents a7211c41 f781ce9a
core = 6.x
api = 2
projects[] = "drupal"
projects[drupal][type] = "core"
projects[hostmaster][type] = "profile"
projects[hostmaster][download][type] = "git"
......
......@@ -113,12 +113,6 @@ class provisionService_db_mysql extends provisionService_db_pdo {
$cmd = sprintf('mysqldump --defaults-file=/dev/fd/3 -r%s/database.sql %s', escapeshellcmd(d()->site_path), escapeshellcmd(drush_get_option('db_name')));
$success = $this->safe_shell_exec($cmd, drush_get_option('db_host'), urldecode(drush_get_option('db_user')), urldecode(drush_get_option('db_passwd')));
if (drush_get_context('DRUSH_VERBOSE') || !$success) {
foreach ($output as $line) {
drush_print($line);
}
}
if (!$success && !drush_get_option('force', false)) {
drush_set_error('PROVISION_BACKUP_FAILED', dt('Could not generate database backup from mysqldump. (error: %msg)', array('%msg' => $this->safe_shell_exec_output)));
}
......
......@@ -5,7 +5,7 @@ $TTL <?php print $server->dns_ttl; ?>
<?php
print("@ IN SOA $server->remote_host $dns_email (
" . $records['@']['SOA']['serial'] . " ; serial
" . $records['serial'] . " ; serial
$server->dns_refresh; refresh
$server->dns_retry ; retry
$server->dns_expire ; expire
......
......@@ -7,7 +7,7 @@
* the cluster HTTP service.
*/
class provisionService_dns_bind_slave extends provisionService_dns {
protected $application_name = 'bind_slave';
protected $application_name = 'bind';
protected $has_restart_cmd = TRUE;
......@@ -48,7 +48,6 @@ class provisionService_dns_bind_slave extends provisionService_dns {
* @arg $zone string the zonefile name to create
*
* @see provisionService_dns::create_zone()
*/
function create_zone($master, $zone = null) {
if (is_null($zone) && ($this->context->type == 'site')) {
$host = $this->context->uri;
......@@ -62,9 +61,20 @@ class provisionService_dns_bind_slave extends provisionService_dns {
drush_log(dt("recording zone in slave configuration"));
$this->config('server')->record_set($zone, $master)->write();
}
*/
}
class provisionConfig_bind_slave extends provisionConfig_dns_server {
public $template = 'slave.tpl.php';
function process() {
parent::process();
if ($this->context->type == 'server') {
$ips = $this->context->ip_addresses;
}
else {
$ips = $this->context->server->ip_addresses;
}
$this->data['master_ip_list'] = implode(';', $ips);
}
}
<?php
foreach ($records as $zone => $master) {
if (is_array($master)) {
$master = implode(";", $master);
}
printf('zone "%s" { type slave; file "%s/%s.zone"; masters { %s; }; allow-query { any; }; };' . "\n", $zone, $dns_zoned_path, $zone, $master);
printf('zone "%s" { type slave; file "%s/%s.zone"; masters { %s; }; allow-query { any; }; };' . "\n", $zone, $dns_zoned_path, $zone, $master_ip_list);
}
?>
......@@ -281,7 +281,7 @@ class provisionService_dns extends provisionService {
if ($status) {
drush_log(dt("creating zone configuration on slaves"));
$status = $this->_each_server("create_zone", array($this->context->ip_addresses, $zone));
$status = $this->_each_server("create_zone", $zone);
}
return $status;
}
......
......@@ -62,7 +62,11 @@ The first two commands below are optional but recommended.
Shell commands::
sudo port selfupdate
sudo port upgrade outdated
sudo port install apache2 mysql5-server git-core unzip php52 +mysql5
sudo port install apache2 mysql5-server git-core unzip php52 php5-posix \
php5-gd php5-apc +mysql5
php5-apc is optional, but highly recommended as it will significantly increase
PHP performance.
Watch the output of the last port command carefully, as there are
usually some boring tasks for you to perform once the install is
......@@ -76,7 +80,13 @@ Next we'll create the aegir user and add it to the _www group. This
part is very different on Mac OS X than Linux or most other
Unices. Must be a NeXTism. The command we will use he is "dscl", which
is a short for Directory Service Command Line. In OSX 10.3 and
earlier, that command is "nicl" (short for Net Info Command Line).
earlier, that command is "nicl" (short for Net Info Command Line). It is also
possible to create the user using the "Workgroup Manager" utility included with
OS X Server. To obtain Workgroup Manager for the OS X Client, download the
"Server Admin Tools" from Apple. For example, for Mac OS X 10.6, the admin tools
can be found at:
http://support.apple.com/downloads/Server_Admin_Tools_10_6
Shell commands::
sudo dscl . -create /Users/aegir NFSHomeDirectory /var/aegir
......@@ -136,7 +146,6 @@ Next configure Apache to include the Aegir config.
Shell Commands::
echo "Include /var/aegir/config/apache.conf" >> /opt/local/apache2/conf/httpd.conf
/opt/local/apache2/bin/apachectl restart
Configuring your MySQL database and user accounts is the same as in
the INSTALL.txt file. But you probably want to add the path to its
......
......@@ -34,8 +34,8 @@ considered the canonical source of information.
Also note that those instructions setup a complete Aegir system. If you want
to only setup a new server, it should be sufficient to install requirement
(step 1) and configure them (step 2). You will just need the -b flag to
avoid installing the frontend on the server.
(step 1) and configure them (step 2). You will just need the --backend-only flag
to avoid installing the frontend on the server.
1. Install software requirements
================================
......@@ -51,6 +51,8 @@ The level of access required to be able to configure this system is very far
beyond what is commonly available to users with shared hosting. Commands are
assumed to be run as root user.
A standard umask of 022 is assumed. This is the default on most systems.
Web server
----------
......@@ -78,7 +80,7 @@ Database server
You will require a database server, obviously. Aegir currently only supports
MySQL. It is preferable to use a dedicated server since Aegir will create
database users and will require a privileged user.
database users and will requires the use of the mysql 'root' user.
Mail transfer agent
-------------------
......@@ -90,7 +92,7 @@ email". Additional messages will show that site has been removed because of
this problem. To remedy the situation simply install an MTA like sendmail,
postfix, or exim and do the minimal configuration.
Other utilities: sudo, git and unzip
Other utilities: sudo, rsync, git and unzip
------------------------------
Aegir installs itself via a drush_make file that downloads via git if you want
......@@ -100,7 +102,7 @@ will need to install it on the server.
The jQueryUI library is used in the Aegir UI, unzip is required to extract it.
Sudo is required to allow the aegir user the limited privilege to restart the
webserver when required.
webserver when required. Rsync is used to sync files to remote servers.
Summary
-------
......@@ -110,8 +112,8 @@ can install all those packages using the following.
Shell commands::
apt-get install apache2 php5 php5-cli php5-mysql mysql-server postfix
apt-get install sudo git-core unzip
apt-get install apache2 php5 php5-cli php5-gd php5-mysql mysql-server \
postfix sudo rsync git-core unzip
2. Configure system requirements
......@@ -174,6 +176,27 @@ Shell commands::
adduser aegir www-data #make aegir a user of group www-data
PHP Configuration
-----------------
Some complex installation profiles or distributions require a PHP memory limit
that is higher than the default. To avoid common errors when installing sites on
some distributions, the PHP command line tool should be configured to use 192Mb
of RAM.
Change the memory_limit directive in /etc/php5/cli/php.ini to read::
memory_limit = 192M ; Maximum amount of memory a script may consume (192MB)
Most modern Drupal sites require around 96M or even 128M of RAM for certain
operations. This is far more than what is provided by the default PHP configuration.
Change the memory_limit directive in /etc/php5/apache2/php.ini to read::
memory_limit = 128M ; Maximum amount of memory a script may consume (128MB)
Apache configuration
--------------------
......@@ -194,6 +217,11 @@ Shell commands as root::
a2enmod rewrite
ln -s /var/aegir/config/apache.conf /etc/apache2/conf.d/aegir.conf
**Do not reload/restart Apache if prompted to after running these commands,
it will fail.**
The installer script creates the configuration file referenced by the newly
created symlink.
The aegir user needs to have sudo access. Add the relevant line to your sudoers
file.
......@@ -206,12 +234,14 @@ Remote web servers
Any number of remote web servers may be configured. They need an aegir user and
Apache configuration as above, with the same user name and directory paths. SSH
public/private keys should be set up so hostmaster's Aegir user can access
remote web Aegir users with no passwords.
remote web Aegir users with no passwords. The above apache configuration needs
to be performed too.
They will also need a login shell, which can be modified using the `chsh` command.
They will also need a login shell, which can be modified using the ``chsh`` command.
Shell command as root::
chsh -s /bin/sh aegir
apt-get install rsync apache2 php5 php5-cli php5-mysql
Database configuration
----------------------
......@@ -228,9 +258,9 @@ Now you need to restart mysql, to clear any caches.
Shell command as root::
/etc/init.d/mysql restart
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.
The installer will prompt you for your MySQL root user password. The root
user will be used to make administrative tasks such as creating new databases,
and granting and revoking access to those databases for sites.
Even though MySQL is now listening on all IP's, it will not allow invalid users
to connect to the databases, without the correct user accounts configured.
......@@ -242,15 +272,21 @@ This is outside the scope of this document however.
3. Run the install script
=========================
This section deals with the actual installation of Aegir.
This section deals with the actual installation of Aegir. You can
install aegir in one of two ways: one assumes you have already
downloaded drush and provision, while the other will do that for you.
3.1 Installing aegir with only the install.sh script
----------------------------------------------------
There is an install script that takes care of installing the right packages and
preparing the backend and frontend install for you. That script needs to be run
as the aegir user created above. This file is available in Provision or can be
downloaded through the web with this command::
as the aegir user created above, so it needs to be placed somewhere that the
aegir user can access in order to execute it. This file is available in
Provision or can be downloaded through the web with this command::
Shell commands::
wget -O install.sh.txt 'http://git.aegirproject.org/?p=provision.git;a=blob_plain;f=install.sh.txt;hb=HEAD'
wget -O install.sh 'http://git.aegirproject.org/?p=provision.git;a=blob_plain;f=install.sh.txt;hb=HEAD'
By default, the install script will install the "correct" version of Aegir
(ie. if it was downloaded through git, it will install the version from the
......@@ -259,20 +295,48 @@ the official release.). You can modify which version to install by editing the
AEGIR_VERSION variable in the script.
Shell commands::
su -s /bin/sh aegir -c "sh install.sh.txt aegir.example.com"
su -s /bin/sh aegir -c "sh install.sh"
Note you must run the above command as root or prefix with sudo.
Be sure to change 'aegir.example.com' to match the URI of your site.
You will be prompted for the information necessary to complete the
installation.
Once you have run install.sh once, drush and provision should be
installed and you can use the more powerful hostmaster-install command
to retry the install if it failed the first time.
3.2 Installing aegir with drush and provision installed
-------------------------------------------------------
If you have already downloaded drush and provision, you can just install
provision in the commands directory of Drush (either ~aegir/.drush or
/usr/share/drush/commands), if that's not already done. Once provision
is properly installed, you can install all other aegir components using
the hostmaster-install command.
Shell commands::
You can append '--client_email=you@example.com' to keep from being prompted for
an e-mail address during install. The traditional Drupal 'Welcome' e-mail will
be sent to this e-mail address upon completion of the installation. This e-mail
address will also be used as the default e-mail address of the first user and
client in Aegir, but can be changed later.
drush hostmaster-install --version=HEAD
You will be prompted for the required information if not provided on the
commandline. See the inline help for the available options::
drush help hostmaster-install
It is imperative that you provide a valid FQDN to the installer. This is used
for database GRANTs. Remote web servers depend on the FQDN being resolvable
in order to connect back to your Aegir master server if it is used as your
database server for managed sites.
Upon completion of the installation, the traditional Drupal 'Welcome' e-mail
will be sent to the e-mail address specified by --client_email=(your e-mail)
or if not provided as a command line switch, the address prompted by the
installer process. This e-mail address will also be used as the default e-mail
address of the first user and client in Aegir, but can be changed later.
Checkpoint / Finished!
-----------
----------------------
At this point, you have checked out all the code and setup your basic Drupal
system (Drupal core, hosting, hostmaster and eldir) that will be the Aegir
......
......@@ -9,6 +9,17 @@ Aegir Upgrade Instructions
This document describes briefly how to upgrade an existing Aegir installation
-----------------------------------------------------------------------------
The document is laid out in the following sections:
* Conventions and tips
* Upgrade script
* Setting environment variables
* Generic upgrade instructions
* Upgrading the backend
* Upgrading the frontend
* Version-specific upgrade notes (read these before running anything else!)
Conventions and tips
====================
......@@ -24,7 +35,41 @@ To become aegir user you can issue this command::
Note that /bin/sh is an example. You may wish to instead use the shell of your
choice, i.e /bin/bash
Additionally to make following instructions generic and not dependant on a
A standard umask of 022 is assumed. This is the default on most systems.
Upgrade script
==============
This document remains the canonical source of information regarding upgrading
your Aegir installation.
However, an upgrade script exists in the Provision repository that tries to
automate much of the process below.
It is imperative that you read the Version-specific upgrade notes located at
the bottom of this document before attempting to run the upgrade.sh script,
as the script will assume you have your system set up appropriately to
handle the upgrade process.
You can download and run the upgrade.sh script with the following.
Make sure you download it to somewhere that the aegir user can access in order
to execute it.
Shell commands::
wget -O upgrade.sh.txt 'http://git.aegirproject.org/?p=provision.git;a=blob_plain;f=upgrade.sh.txt;hb=HEAD'
su -s /bin/sh aegir -c "sh upgrade.sh.txt aegir.example.com"
Remember to replace aegir.example.com with the domain of your Aegir installation.
If you run this script (after satisfying the requirements of the Version-specific
upgrade notes at the bottom of this document), you may skip the rest of this
document.
Setting environment variables
=============================
To make following instructions generic and not dependant on a
concrete Drupal or Aegir version, we will use shell environment
variables. Since 0.4, the hostmaster platform is prepended with 'hostmaster'
so as not to clash with any other Drupal platforms. If you are upgrading from
......@@ -116,7 +161,6 @@ releases to the latest applicable versions.
Once you have upgraded the backend, and you have installed drush_make you will
need to run the hostmaster migrate command.
Shell commands::
cd $OLD_DRUPAL_DIR
......@@ -134,6 +178,11 @@ will be halted as it is necessary for the task queue to be processed.
The command above will fetch the latest stable Drupal release, so it can
simply be run again when a new security release of Drupal is made available.
If you have customized your Aegir installation and are maintaining your own
makefile, you can use the --makefile flag so the platform is created with
another makefile than the default. Be warned that this may create problems if
the makefile doesn't include the right Aegir modules.
Version-specific upgrade notes
==============================
......@@ -142,7 +191,7 @@ Bleeding-edge HEAD dependency
If you intend on upgrading your system to the bleeding edge version of the
code from our git repositories, you will need the git program installed. On
Debian, this means::
Debian, this means:
Shell commands::
......@@ -163,11 +212,12 @@ an error you will need to edit your ``/etc/hosts`` file.
First line of this file looks like::
``127.0.0.1 localhost``
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``
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.
......@@ -186,7 +236,7 @@ Shell commands as root::
As of the 0.4-alpha3 release, 'unzip' is a required dependency on your server
in order to successfully extract the jquery.ui library that is part of some UI
improvements. On Debian, this means::
improvements. On Debian, this means:
Shell commands::
......@@ -222,8 +272,8 @@ You need to re-use the pasword you had for the account before.
Shell commands::
mysql -u root -p -e "GRANT ALL ON *.* to 'aegir_root'@$AEGIR_HOST IDENTIFIED BY 'xxxx' WITH GRANT OPTION;"
mysql -u root -p -e "GRANT ALL ON *.* to 'aegir_root'@$AEGIR_IP IDENTIFIED BY 'xxxx' WITH GRANT OPTION;"
mysql -u root -p -e "GRANT ALL ON *.* to 'aegir_root'@'$AEGIR_HOST' IDENTIFIED BY 'xxxx' WITH GRANT OPTION;"
mysql -u root -p -e "GRANT ALL ON *.* to 'aegir_root'@'$AEGIR_IP' IDENTIFIED BY 'xxxx' WITH GRANT OPTION;"
0.4 - Apache configuration
......@@ -236,8 +286,7 @@ and a single apache.conf. The vhost.d directory is for virtual hosts,
platform.d is for platform-specific configuration and apache.conf is the
server-wide configuration file.
After you have completed the migration process as outlined above,
you will need to change the line you added to either the httpd.conf file
You will need to change the line you added to either the httpd.conf file
or /etc/apache2/conf.d/aegir file during installation.
Open your httpd.conf file and modify::
......@@ -248,11 +297,11 @@ To read ::
Include /var/aegir/config/apache.conf
If you are upgrading from 0.4 releases between alpha8 and alpha14, you will
need to rename your conf.d directory to post.d in Apache and pre.d in
If you are upgrading from 0.4 releases between alpha8 and (including) alpha14,
you will need to rename your conf.d directory to post.d in Apache and pre.d in
Nginx. Example, in Apache::
mv /var/aegir/config/server_master/apache/{conf.d,post.d}
Now log into Aegir, and verify the hostmaster platform. This will generate
the correct apache.conf file and restart apache.
the correct apache.conf file and restart Apache.
......@@ -3,6 +3,12 @@
Allow from all
<?php print $extra_config; ?>
<IfModule mod_rewrite.c>
RewriteEngine on
# allow files to be accessed without /sites/fqdn/
RewriteRule ^files/(.*)$ /sites/%{HTTP_HOST}/files/$1 [L]
</IfModule>
<?php
if (file_exists("{$this->root}/.htaccess")) {
print "\n# Include the platform's htaccess file\n";
......@@ -13,10 +19,5 @@
# Do not read the platform's .htaccess
AllowOverride none
<IfModule mod_rewrite.c>
RewriteEngine on
# allow files to be accessed without /sites/fqdn/
RewriteRule ^files/(.*)$ /sites/%{HTTP_HOST}/files/$1 [L]
</IfModule>
</Directory>
......@@ -23,23 +23,23 @@
<?php
if (sizeof($this->aliases)) {
print "\n ServerAlias " . implode("\n ServerAlias ", $this->aliases) . "\n";
}
if ($this->redirection || $ssl_redirection) {
print " RewriteEngine on\n";
if ($this->redirection || $ssl_redirection) {
print " RewriteEngine on\n";
if ($ssl_redirection && !$this->redirection) {
// redirect aliases in non-ssl to the same alias on ssl.
print " RewriteRule ^/*(.*)$ https://%{HTTP_HOST}/$1 [L,R=301]\n";
}
elseif ($ssl_redirection && $this->redirection) {
// redirect all aliases + main uri to the main https uri.
print " RewriteRule ^/*(.*)$ https://{$this->uri}/$1 [L,R=301]\n";
}
elseif (!$ssl_redirection && $this->redirection) {
// Redirect all aliases to the main http url.
print " RewriteCond %{HTTP_HOST} !^{$this->uri}$ [NC]\n";
print " RewriteRule ^/*(.*)$ http://{$this->uri}/$1 [L,R=301]\n";
}
if ($ssl_redirection && !$this->redirection) {
// redirect aliases in non-ssl to the same alias on ssl.
print " RewriteRule ^/*(.*)$ https://%{HTTP_HOST}/$1 [L,R=301]\n";
}
elseif ($ssl_redirection && $this->redirection) {
// redirect all aliases + main uri to the main https uri.
print " RewriteRule ^/*(.*)$ https://{$this->uri}/$1 [L,R=301]\n";
}
elseif (!$ssl_redirection && $this->redirection) {
// Redirect all aliases to the main http url.
print " RewriteCond %{HTTP_HOST} !^{$this->uri}$ [NC]\n";
print " RewriteRule ^/*(.*)$ http://{$this->uri}/$1 [L,R=301]\n";
}
}
?>
......
<?php if ($this->ssl_enabled && $this->ssl_key) : ?>
<VirtualHost <?php print "{$ip_address}:{$http_ssl_port}"; ?>>
<?php if ($this->site_mail) : ?>
ServerAdmin <?php print $this->site_mail; ?>
<?php endif;?>
DocumentRoot <?php print $this->root; ?>
ServerName <?php print $this->uri; ?>
# Enable SSL handling.
SSLEngine on
SSLCertificateFile <?php print $ssl_cert; ?>
SSLCertificateKeyFile <?php print $ssl_cert_key; ?>
<?php
if (sizeof($this->aliases)) {
print "\n ServerAlias " . implode("\n ServerAlias ", $this->aliases) . "\n";
}
?>
RewriteEngine on
# the ? at the end is to remove any query string in the original url
RewriteRule ^(.*)$ <?php print $this->platform->server->web_disable_url . '/' . $this->uri ?>?
</VirtualHost>
<?php endif; ?>
<?php
include('http/apache/vhost_disabled.tpl.php');
?>
......@@ -114,8 +114,8 @@ class provisionService_http_public extends provisionService_http {
// Redirection urls
$this->server->setProperty('web_disable_url', $this->server->master_url .'/hosting/disabled');
$this->server->setProperty('web_maintenance_url', $this->server->master_url .'/hosting/maintenance');
$this->server->web_disable_url = rtrim($this->server->master_url, '/') .'/hosting/disabled';
$this->server->web_maintenance_url = rtrim($this->server->master_url, '/') .'/hosting/maintenance';
if (!is_null($this->application_name)) {
......
<?php if ($this->ssl_enabled && $this->ssl_key) : ?>
server {
<?php
print " include " . $server->include_path . "/fastcgi_ssl_params.conf;\n";
?>
limit_conn gulag 10; # like mod_evasive - this allows max 10 simultaneous connections from one IP address
listen <?php print "{$ip_address}:{$http_ssl_port}"; ?>;
server_name <?php print $this->uri . ' ' . implode(' ', $this->aliases); ?>;
root <?php print $this->root; ?>;
index index.php index.html;
ssl on;
ssl_certificate <?php print $ssl_cert; ?>;
ssl_certificate_key <?php print $ssl_cert_key; ?>;
ssl_protocols SSLv2 SSLv3 TLSv1;
ssl_ciphers ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP;
ssl_prefer_server_ciphers on;
keepalive_timeout 70;
location / {
root /var/www/nginx-default;
index index.html index.htm;
rewrite ^/(.*)$ <?php print $this->platform->server->web_disable_url . '/' . $this->uri ?>? permanent;
}
}
<?php endif; ?>
<?php
// Generate the standard virtual host too.
include('http/nginx/vhost_disabled.tpl.php');
?>
......@@ -4,39 +4,125 @@
* @file install the hostmaster system
*/
function drush_provision_hostmaster_install($site = NULL) {
function drush_provision_hostmaster_install_validate($site = NULL) {
// set defaults for this whole script
// those are settings that are not prompted to the user but still overridable
$version = drush_set_default('version', drush_get_option('version', 'HEAD'));
$aegir_root = drush_set_default('aegir_root', drush_server_home());
drush_set_default('root', $aegir_root . '/' . 'hostmaster-' . $version);
drush_set_default('r', drush_get_option('root'));
drush_set_default('script_user', provision_current_user());
drush_set_default('web_group', _provision_default_web_group());
drush_set_default('http_service_type', 'apache');
drush_set_default('drush_make_version', '6.x-2.0-beta9');
$aegir_db_user = drush_set_default('aegir_db_user', 'root');
drush_set_default('makefile', $aegir_root . '/.drush/provision/aegir.make');
drush_print("Aegir $version automated install script");
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.
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"), "aegir.example.com");
$site = drush_prompt(dt("Aegir domain name"), provision_fqdn());
}
drush_set_option('site', $site);
$version = drush_get_option('version', 'HEAD');
$aegir_root = drush_get_option('aegir_root', drush_server_home());
$platform = drush_get_option(array('r', 'root'), $aegir_root . '/' . 'hostmaster-' . $version);
if (!drush_get_option('backend-only')) {
$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);
if (is_null(drush_get_option('aegir_db_pass', NULL))) {
// XXX: may not be portable everywhere?
system('stty -echo');
drush_set_option('aegir_db_pass', drush_prompt(dt('MySQL privileged user ("!root") password', array('!root' => $aegir_db_user))));
system('stty echo');
print "\n"; // add a newline since the user's didn't print
}
if (!function_exists('drush_make_drush_command')) {
drush_backend_invoke('dl', array('drush_make-' . drush_get_option('drush_make_version', '6.x-2.0-beta9'), 'destination' => $aegir_root . '/.drush/'));
}
while (!filter_var(drush_get_option('client_email'), FILTER_VALIDATE_EMAIL)) {
$client_email = drush_prompt(dt("Admin user e-mail"), "you@example.com");
drush_set_option('client_email', $client_email);
}
drush_print(dt('
This script will operate the following changes in your system:
1. Create server-level configuration directories
2. Download drush_make
3. Create the Hostmaster frontend platform
4. Install the frontend site
5. Setup the dispatcher (a user cron job)
We are making the following assumptions:
* you have read INSTALL.txt and prepared the platform accordingly
* you have your MySQL root credentials on hand
* the FQDN of this machine is valid and resolves
* you are executing this script as your "aegir" user
The following settings will be used:
Aegir frontend URL: !site
Master server: !fqdn
Aegir root: !home
Aegir user: !user
Web group: !web
Web server: !web_server
Aegir DB user: !db_user
Aegir DB password: !db_pass
Drush make version: !drush_make
Aegir version: !version
Aegir platform path: !root
Aegir makefile: !makefile
Client email: !email
', array('!site' => $site,
'!fqdn' => drush_get_option('aegir_host'),
'!home' => drush_get_option('aegir_root'),
'!user' => drush_get_option('script_user'),
'!web' => drush_get_option('web_group'),
'!web_server' => drush_get_option('http_service_type'),
'!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'),
'!version' => drush_get_option('version'),
'!root' => drush_get_option(array('r', 'root')),
'!makefile' => drush_get_option('makefile'),
'!email' => drush_get_option('client_email'),
)));
if (!drush_confirm(dt('Do you really want to proceed with the install'))) {
return drush_set_error('PROVISION_CANCEL_INSTALL', dt('Installation aborted by user'));
}
$aegir_host = drush_get_option('aegir_host', php_uname('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');
$master_db = sprintf("mysql://%s:%s@%s",$aegir_db_user, $aegir_db_pass, $aegir_host);
return TRUE;
}
function drush_provision_hostmaster_install($site = NULL) {
$version = drush_get_option('version');
$site = drush_get_option('site', provision_fqdn());
$aegir_root = drush_get_option('aegir_root');
$platform = drush_get_option(array('r', 'root'));
$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(
'context_type' => 'server',