Commit 95e38cc1 authored by anarcat's avatar anarcat Committed by anarcat

Merge branch 'master' into dev-dns

parents 5f21302c 75d53b98
core = 6.x
api = 2
projects[] = "drupal"
projects[hostmaster][type] = "profile"
......
......@@ -11,10 +11,10 @@ Aegir Drupal provisionning system.
------------------------------------------------------------------------------
Aegir installation seems difficult at first, but once you get around it, it's
fairly simple. It's 3 basic steps:
fairly simple. It's 3 basic steps::
1. Install requirements
2. Configure system requirements, which include:
2. Configure system requirements, which include::
* create a Aegir user
* configure Apache, MySQL, DNS, etc
3. Run the install script.
......@@ -134,11 +134,11 @@ Shell commands as root::
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:
First line of this file looks like::
``127.0.0.1 localhost``
Simply add all domains you want to this line. e.g:
Simply add all domains you want to this line. e.g::
``127.0.0.1 localhost $AEGIR_HOST $AEGIR_DOMAIN other1 other2``
......@@ -247,9 +247,10 @@ This section deals with the actual installation of Aegir.
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 at:
downloaded through the web with this command::
http://git.aegirproject.org/?p=provision.git;a=blob_plain;f=install.sh.txt;hb=HEAD
Shell commands::
wget -O install.sh.txt '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
......@@ -260,7 +261,7 @@ AEGIR_VERSION variable in the script.
Shell commands::
su -s /bin/sh aegir -c "sh install.sh.txt aegir.example.com"
Note you must run this as root or prefix with sudo.
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.
......@@ -286,7 +287,10 @@ should look something like this::
/var/aegir/hostmaster-0.x/profiles/hostmaster/modules/modalframe/
/var/aegir/hostmaster-0.x/profiles/hostmaster/themes/eldir/
/var/aegir/hostmaster-0.x/sites/aegir.example.com/
/var/aegir/config/vhost.d/
/var/aegir/config/server_master/apache.conf
/var/aegir/config/server_master/apache/conf.d/
/var/aegir/config/server_master/apache/vhost.d/
/var/aegir/config/server_master/apache/platform.d/
/var/aegir/backups/
/var/aegir/drush/drush.php
/var/aegir/.drush/drush_make/
......
......@@ -36,34 +36,19 @@ you are reading this document.
Shell commands::
export AEGIR_VERSION=HEAD
export DRUPAL_DIR=/var/aegir/hostmaster-$AEGIR_VERSION
export AEGIR_DIR=/var/aegir
export DRUPAL_DIR=$AEGIR_DIR/hostmaster-$AEGIR_VERSION
export DRUSH_VERSION=6.x-3.3
export DRUSH_MAKE_VERSION=6.x-2.0-beta8
export DRUSH_MAKE_VERSION=6.x-2.0-beta9
export AEGIR_DOMAIN=aegir.example.com
export OLD_DRUPAL_DIR=/var/aegir/hostmaster-0.4-alpha9
export OLD_DRUPAL_DIR=$AEGIR_DIR/hostmaster-0.4-alpha9
This document also assumes drush is installed properly and we use an
environment variable to simplify the documentation again.
Shell commands::
export DRUSH='php /var/aegir/drush/drush.php'
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:
Shell commands::
apt-get install unzip
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:
Shell commands::
apt-get install git-core
export DRUSH="php $AEGIR_DIR/drush/drush.php"
Generic upgrade instructions
============================
......@@ -71,7 +56,9 @@ Generic upgrade instructions
We aim to create a generic upgrade process that will be consistent across
versions. This section describes this process. However, there are
version-specific upgrade instructions that may be more relevant to your
installation in the next section.
installation in the next section. You should check the version-specific
instructions to ensure you have covered off the requirements necessary for
successfully completing these version-generic steps.
Upgrading the backend
---------------------
......@@ -96,12 +83,12 @@ frontend.
Shell commands::
cd /var/aegir
cd $AEGIR_DIR
mv drush drush.bak
wget http://ftp.drupal.org/files/projects/drush-$DRUSH_VERSION.tar.gz
gunzip -c drush-$DRUSH_VERSION.tar.gz | tar -xf -
rm drush-$DRUSH_VERSION.tar.gz
cd /var/aegir/.drush
cd $HOME/.drush
mv provision ../provision.bak
wget http://files.aegirproject.org/provision-$AEGIR_VERSION.tgz
gunzip -c provision-$AEGIR_VERSION.tgz | tar -xf -
......@@ -116,7 +103,7 @@ drush_make with the latest recommended release.
Shell commands::
$DRUSH dl drush_make-$DRUSH_MAKE_VERSION --destination='/var/aegir/.drush'
$DRUSH dl drush_make-$DRUSH_MAKE_VERSION --destination="$HOME/.drush"
Upgrading the frontend
----------------------
......@@ -150,6 +137,17 @@ simply be run again when a new security release of Drupal is made available.
Version-specific upgrade notes
==============================
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::
Shell commands::
apt-get install git-core
0.4 - DNS Configuration
-----------------------
......@@ -163,11 +161,11 @@ Shell commands as root::
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:
First line of this file looks like::
``127.0.0.1 localhost``
Simply add all domains you want to this line. e.g:
Simply add all domains you want to this line. e.g::
``127.0.0.1 localhost $AEGIR_HOST $AEGIR_DOMAIN other1 other2``
......@@ -177,6 +175,18 @@ 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.
0.4 - unzip dependency
----------------------
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::
Shell commands::
apt-get install unzip
0.4 - Database configuration
----------------------------
......@@ -184,7 +194,7 @@ To make sure that the Aegir backend, and all the possible web servers can
reach your database server, you need to configure mysql to listen on all
the public IP addresses available to it.
/etc/mysql/my.conf configuration line to comment out::
/etc/mysql/my.cnf configuration line to comment out::
bind-address = 127.0.0.1
Now you need to restart mysql, to clear any caches.
......@@ -224,15 +234,15 @@ 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
or /etc/apache2/conf.d/aegir file during installation.
Open your httpd.conf file and modify :
Open your httpd.conf file and modify::
Include /var/aegir/config/vhost.d
To read :
To read ::
Include /var/aegir/config/apache.conf
You will also need to create the following directories :
You will also need to create the following directories ::
/var/aegir/config/platform.d
/var/aegir/config/apache.d
......
<VirtualHost <?php print $ip_address . ':' . $http_port; ?>>
<VirtualHost *:<?php print $http_port; ?>>
<?php if ($this->site_mail) : ?>
ServerAdmin <?php print $this->site_mail; ?>
<?php endif;?>
......
<VirtualHost <?php print $ip_address . ':' . $http_port; ?>>
<VirtualHost *:<?php print $http_port; ?>>
<?php if ($this->site_mail) : ?>
ServerAdmin <?php print $this->site_mail; ?>
<?php endif;?>
......
<VirtualHost <?php print $ip_address . ':' . $http_port; ?>>
<VirtualHost *:<?php print $http_port; ?>>
<?php if ($this->site_mail) : ?>
ServerAdmin <?php print $this->site_mail; ?>
<?php endif;?>
......
......@@ -60,7 +60,7 @@
?>
<VirtualHost <?php print $ip_address . ':' . $http_port; ?>>
<VirtualHost *:<?php print $http_port; ?>>
<?php if ($this->site_mail) : ?>
ServerAdmin <?php print $this->site_mail; ?>
<?php endif;?>
......
......@@ -100,7 +100,7 @@ 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_maintenence_url', $this->server->master_url .'/hosting/maintenance');
$this->server->setProperty('web_maintenance_url', $this->server->master_url .'/hosting/maintenance');
if (!is_null($this->application_name)) {
......@@ -114,9 +114,9 @@ class provisionService_http_public extends provisionService_http {
static function option_documentation() {
return array(
'--web_group' => 'server with http: OS group for permissions; working default will be attepted',
'--web_group' => 'server with http: OS group for permissions; working default will be attempted',
'--web_disable_url' => 'server with http: URL disabled sites are redirected to; default {master_url}/hosting/disabled',
'--web_maintenence_url' => 'server with http: URL maintenance sites are redirected to; default {master_url}/hosting/maintenance',
'--web_maintenance_url' => 'server with http: URL maintenance sites are redirected to; default {master_url}/hosting/maintenance',
);
}
......
......@@ -63,7 +63,7 @@ class provisionService_http_ssl extends provisionService_http_public {
$ip = provisionService_http_ssl::get_certificate_ip($ssl_key, $this->server);
if (!$ip) {
drupal_set_error("SSL_IP_FAILURE", dt("There are no more IP addresses available on %server for the %ssl_key certificate.", array(
drush_set_error("SSL_IP_FAILURE", dt("There are no more IP addresses available on %server for the %ssl_key certificate.", array(
"%server" => $this->server->remote_host,
"%ssl_key" => $ssl_key,
)));
......
......@@ -16,7 +16,7 @@ function drush_provision_hostmaster_install($site = NULL) {
if (!drush_get_option('backend-only')) {
if (!function_exists('drush_make_drush_command')) {
drush_backend_invoke('dl', array('drush_make-' . drush_get_option('drush_make_version', '6.x-2.0-beta8'), 'destination' => $aegir_root . '/.drush/'));
drush_backend_invoke('dl', array('drush_make-' . drush_get_option('drush_make_version', '6.x-2.0-beta9'), 'destination' => $aegir_root . '/.drush/'));
}
}
......@@ -37,7 +37,7 @@ function drush_provision_hostmaster_install($site = NULL) {
// apache or nginx or..
'http_service_type' => drush_get_option('http_service_type', 'apache', 'options'),
'web_group' => drush_get_option('web_group', _provision_default_web_group()),
'master_url' => "http://" . $site . "/",
'master_url' => "http://" . $site,
// mysql
'db_service_type' => 'mysql',
'master_db' => $data['master_db'],
......
......@@ -102,7 +102,7 @@ fi
msg "This script makes the following assumptions: "
cat <<EOF
* you have read INSTALL.txt and prepared the platform accordingly
* you are running as your "aegir" user
* you are executing this script as your "aegir" user
EOF
if prompt_yes_no "Do you want to proceed with the install?" ; then
......@@ -124,7 +124,7 @@ cat <<EOF
You will be asked to enter your mysql root user password now :
EOF
/usr/bin/mysql -uroot -p mysql<<EOFMYSQL
mysql -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;
GRANT ALL PRIVILEGES ON *.* TO '$AEGIR_DB_USER'@'localhost' IDENTIFIED BY '$AEGIR_DB_PASS' WITH GRANT OPTION;
......@@ -148,7 +148,7 @@ else
fi
if $DRUSH help > /dev/null ; then
msg "Drush seems to be functionning properly"
msg "Drush seems to be functioning properly"
else
msg "Drush is broken ($DRUSH help failed)"
exit 1
......
......@@ -8,6 +8,13 @@ function drush_provision_hostmaster_migrate_validate($site, $platform) {
$alias_file = drush_server_home() . '/.drush/server_master.alias.drushrc.php';
if (!file_exists($platform)) {
$dir = realpath(dirname($platform));
if (file_exists($dir)) {
$platform = $dir . '/' . basename($platform);
drush_log("changed relative platform path to absolute");
}
}
// If the alias file exists, it means we are migrating from a post alpha9 release.
if (file_exists($alias_file)) {
......
......@@ -42,6 +42,7 @@ function drush_provision_drupal_provision_clone($new_uri, $platform = null) {
$options['uri'] = ltrim($new_uri, '@');
$options['name'] = $new_uri;
$options['platform'] = (isset($platform)) ? $platform : $options['platform'];
$options['root'] = d($options['platform'])->root;
$options['aliases'] = array();
$options['redirection'] = 0;
......
......@@ -11,8 +11,8 @@ drush_log(t('Cleared all caches'));
node_types_rebuild();
drush_log(t('Rebuild node type cache'));
system_rebuild_module_data();
drush_log(t('Rebuild module cache'));
registry_rebuild();
drush_log(t('Rebuild code registry'));
system_rebuild_theme_data();
drush_log(t('Rebuild theme cache'));
......
......@@ -20,15 +20,23 @@ function drush_provision_drupal_provision_import() {
function drush_provision_drupal_post_provision_import() {
if (d()->type === 'site') {
d()->profile = drush_get_option('profile', 'default', 'site');
d()->language = drush_get_option('language', 'en', 'site');
d()->profile = drush_set_option('profile', drush_get_option('profile', 'default', 'site'));
d()->language = drush_set_option('language', drush_get_option('language', 'en', 'site'));
d()->aliases = drush_set_option('aliases', provision_drupal_find_aliases());
d()->write_alias();
// set this in the site options too so it recurrs.
drush_set_option('aliases', drush_get_option('aliases'), 'site');
// generate the drushrc
provision_save_site_data();
// Do not automatically save the drushrc at the end of the command.
drush_set_option('provision_save_config', false);
provision_backend_invoke(d()->name, 'provision-verify');
provision_reload_config('site');
}
}
......@@ -24,17 +24,21 @@ function drush_provision_drupal_pre_provision_migrate($platform, $new_uri = null
drush_invoke('provision-backup');
drush_set_option('old_platform', d()->platform->name);
if (d()->platform->name == $platform) {
// deploying over existing site.
drush_set_option('deploy_replace_site', TRUE);
}
// If we are renaming the site, pick this up early.
if (!is_null($new_uri) && ($new_uri != d()->uri)) {
drush_set_option('target_name', $new_uri);
}
else {
// the site url stays the same
drush_set_option('target_name', d()->name);
// The platform stays the same
if (d()->platform->name == $platform) {
drush_log('Replacing the existing site on the same platform');
// deploying over existing site.
drush_set_option('deploy_replace_site', TRUE);
}
}
}
......@@ -64,6 +68,8 @@ function drush_provision_drupal_provision_migrate($platform, $new_uri = null) {
$options = array();
$options['uri'] = d()->uri;
if (!is_null($new_uri) && ($new_uri != d()->uri)) {
$options = d()->options;
$options['uri'] = ltrim($new_uri, '@');
......@@ -80,9 +86,12 @@ function drush_provision_drupal_provision_migrate($platform, $new_uri = null) {
$options['db_server'] = $db_server;
}
drush_set_option('new_site_path', "{$options['root']}/sites/{$options['uri']}");
drush_backend_invoke_args('provision-save', array($target), $options);
provision_backend_invoke($target, 'provision-deploy', array(drush_get_option('backup_file')), array('old_uri' => d()->uri));
if (!drush_get_error()) {
drush_set_option('provision_save_config', false);
provision_backend_invoke($target, 'provision-verify');
}
}
......@@ -115,6 +124,8 @@ function drush_provision_drupal_post_provision_migrate($platform, $new_uri = nul
$config = new provisionConfig_drushrc_alias(d()->name);
$config->unlink();
}
}
// Load the config file of the newly migrated site and return it to hosting.
provision_reload_config('site', drush_get_option('new_site_path', d()->site_path) . '/drushrc.php');
}
......@@ -56,7 +56,7 @@ function provision_drupal_drush_exit() {
$command = drush_get_command();
$command = explode(" ", $command['command']);
if (preg_match("/^provision-/", $command[0])) {
if (preg_match("/^provision-/", $command[0]) && drush_get_option('provision_save_config', TRUE)) {
if (d()->type === 'site') {
if (drush_get_option('installed')) {
// Don't generate the drushrc.php on provision-save/delete commands.
......@@ -619,3 +619,26 @@ function provision_prepare_environment() {
$_SERVER['db_type'] = ($_SERVER['db_type'] == 'mysqli') ? 'mysql' : $_SERVER['db_type'];
}
}
/**
* Reload drushrc files (if available) from several possible locations.
*
* Because the base drush_load_config method only uses an include_once,
* we run into issues when provision commands call other commands that
* modify these config files.
*
* For the changes to become available, and more importantly passed to the
* front end, we need to call this function after calling provision commands.
*/
function provision_reload_config($context, $file = null) {
$file = ($file) ? $file : _drush_config_file($context);
if (file_exists($file)) {
drush_log("Reloading $context drushrc.php from $file");
include($file);
if (sizeof($options)) {
$options = array_merge(drush_get_context($context, array()), $options);
drush_set_context($context, $options);
}
}
}
......@@ -44,15 +44,12 @@ function drush_provision_drupal_pre_provision_verify() {
elseif (d()->type === 'platform') {
// create a platform from a makefile, if it doesnt already exist and the makefile does.
if (!provision_file()->exists(d()->root)->status() && !empty(d()->makefile)) {
if (provision_file()->exists(d()->makefile)->status()) {
drush_log(dt("Platform path does not exists, fetching from drush makefile"));
drush_backend_invoke("make", array(d()->makefile, d()->root), array('root' => null, 'uri' => null));
if (drush_get_error()) {
return drush_set_error("DRUSH_MAKE_FAILED",
"Could not download platform using drush make. No platform present");
}
drush_log(dt("Platform path does not exists, fetching from drush makefile"));
drush_backend_invoke("make", array(d()->makefile, d()->root), array('root' => null, 'uri' => null));
if (drush_get_error()) {
return drush_set_error("DRUSH_MAKE_FAILED",
"Could not download platform using drush make. No platform present");
}
}
drush_bootstrap(DRUSH_BOOTSTRAP_DRUPAL_ROOT);
......
#!/bin/sh -e
# simple prompt, copied from install.sh
prompt_yes_no() {
while true ; do
printf "$* [Y/n] "
read answer
if [ -z "$answer" ] ; then
return 0
fi
case $answer in
[Yy]|[Yy][Ee][Ss])
return 0
;;
[Nn]|[Nn][Oo])
return 1
;;
*)
echo "Please answer yes or no"
;;
esac
done
}
version=$1
old_version=$2
if [ $# -lt 1 -o "$version" = "-h" ]; then
cat <<EOF
not enough arguments
Usage: $0 <new_version> [ <old_version> ]
EOF
exit 1
fi
cat <<EOF
Aegir release script
====================
This script should only be used by the core dev team when doing an
official release. If you are not one of those people, you probably
shouldn't be running this.
This script is going to modify the configs and documentation to
release $version from release $old_version.
EOF
if [ -z "$old_version" ]; then
echo "warning: no old version specified, UPGRADE.txt will be partly updated"
fi
cat <<EOF
The following operations will be done:
1. change the makefile to download tarball
2. change the INSTALL.txt to point to tagged install.sh
3. change the UPGRADE.txt to point to release tags
4. change the install.sh.txt version
5. display the resulting diff
6. commit those changes to git
7. lay down the tag (prompting you for a changelog)
8. revert the commit
9. (optionally) push those changes
The operation can be aborted before step 6 and 9. Don't forget that as
long as changes are not pushed upstream, this can all be reverted (see
git-reset(1) and git-revert(1) ).
EOF
if ! prompt_yes_no "continue?" ; then
exit 1
fi
git pull
echo changing makefile to download tarball
sed -i'.tmp' -e'/^projects\[hostmaster\]\[download\]\[type\]/s/=.*$/ = "get"/' \
-e'/^projects\[hostmaster\]\[download\]\[url\]/s#=.*$#= "http://files.aegirproject.org/hostmaster-'$version'.tgz"#' \
-e'/^projects\[hostmaster\]\[download\]\[branch\].*/s/\[branch\] *=.*$/[directory_name] = "hostmaster"/' aegir.make && git add aegir.make && rm aegir.make.tmp
echo changing INSTALL.txt to point to tagged install.sh
sed -i'.tmp' -e"/http:\/\/git.aegirproject.org\/?p=provision.git;a=blob_plain;f=install.sh.txt;hb=HEAD/s/HEAD/provision-$version/" docs/INSTALL.txt && git add docs/INSTALL.txt && rm docs/INSTALL.txt.tmp
echo changing UPGRADE.txt to point to release tags
sed -i'.tmp' -e"s/export AEGIR_VERSION=HEAD/export AEGIR_VERSION=$version/" docs/UPGRADE.txt
if ! [ -z "$old_version" ]; then
sed -i -e "/export OLD_DRUPAL_DIR=/s#hostmaster-.*#hostmaster-$old_version#" docs/UPGRADE.txt
fi
git add docs/UPGRADE.txt && rm docs/UPGRADE.txt.tmp
echo changing install.sh.txt version
sed -i'.tmp' -e"s/AEGIR_VERSION=.*$/AEGIR_VERSION=\"$version\"/" install.sh.txt && git add install.sh.txt && rm install.sh.txt.tmp
echo resulting changes to be committed:
git diff --cached | cat
if prompt_yes_no "commit changes and tag release? (y/N) "; then
echo okay, committing...
else
echo 'aborting, leaving changes in git staging area'
echo 'use "git reset; git checkout ." to revert'
exit 1
fi
commitmsg=`git commit -m"change version information for release $version, from $old_version"`
echo $commitmsg
commitid=`echo $commitmsg | sed 's/^\[[a-z]* \([a-z0-9]*\)\].*$/\1/'`
git tag -a provision-$version
echo reverting tree to HEAD versions
git revert $commitid
if prompt_yes_no "push tags and commits upstream? (y/N) "; then
# this makes sure we push the commit *and* the tag
git push --tags origin HEAD
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