Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Feature/quick review of provision patches #11

Closed
wants to merge 22 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
71ec853
Issue #2851478: Move the symlinking of service config from the Provis…
jonpugh Feb 10, 2017
f2d91b6
Try to restart the hosting-queued if the upgrade fails
helmo Nov 3, 2016
baf2e42
Point to the companion branches
helmo Nov 10, 2016
899c5ae
Issue #2821402: Lock the hostmaster platform by default
helmo Nov 11, 2016
fb3fb83
Issue #2754069: Wrap the backend profile drupal install in a drush op…
jonpugh Nov 2, 2016
e4256f1
Issue #2754069: Change the drush option to "site_install_method", def…
jonpugh Nov 2, 2016
5c5eaeb
Issue #2754069: Default to "profile" method. If "manual" method, set…
jonpugh Nov 2, 2016
40959e9
WIP: tech we have the correct provision version
helmo Dec 15, 2016
428958e
Revert "WIP: tech we have the correct provision version"
helmo Dec 15, 2016
d87c644
Issue #2759735 by helmo, Grimreaper: Rename apache config files to .conf
Feb 16, 2017
3ec592a
Issue #2851478: Move symlink code up two levels to Provision_Service
helmo Feb 23, 2017
daa95ec
Merge branch '2851478-move-symlink' into feature/quick-review
helmo Feb 23, 2017
553959e
Split _provision_find_profiles() into version-specific engine includes.
ergonlogic Mar 1, 2017
2628e63
Issue #2650290: Scan for Drupal 8 profiles in subdirectories.
ergonlogic Mar 1, 2017
a8c629d
Use new helper function to find legacy profile langs.
ergonlogic Mar 1, 2017
1711e18
Clean up D8 profile search.
ergonlogic Mar 1, 2017
1cda2be
Issue #2650290: Search for packages in D8 profiles under subdirs.
ergonlogic Mar 1, 2017
9ad2b56
Make D8 profile paths absolute.
ergonlogic Mar 1, 2017
323d482
minor code style
helmo Mar 2, 2017
413f247
Merge branch 'dev/2650290' into feature/quick-review
helmo Mar 2, 2017
fae2c04
Merge branch '7.x-3.x' into feature/quick-review
helmo Mar 2, 2017
a78d963
Issue #2861696 by colan, helmo: Do not ignore output from hosting-pause.
helmo Apr 13, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ branches:

env:
global:
- AEGIR_HOSTING_VERSION=7.x-3.x
- AEGIR_HOSTING_VERSION=feature/quick-review
- AEGIR_TESTS_VERSION=master

#env:
Expand Down
19 changes: 19 additions & 0 deletions Provision/Service.php
Original file line number Diff line number Diff line change
Expand Up @@ -336,4 +336,23 @@ function verify() {
static function option_documentation() {
return array();
}

/**
* Save symlink for this server from /var/aegir/config/APPLICATION_NAME.conf -> /var/aegir/config/SERVER/APPLICATION_NAME.conf
*/
function symlink_service() {
$file = $this->application_name . '.conf';
// We link the app_name.conf file on the remote server to the right version.
$cmd = sprintf('ln -sf %s %s',
escapeshellarg($this->server->config_path . '/' . $file),
escapeshellarg($this->server->aegir_root . '/config/' . $file)
);

if ($this->server->shell_exec($cmd)) {
drush_log(dt("Created symlink for %file on %server", array(
'%file' => $file,
'%server' => $this->server->remote_host,
)));
};
}
}
4 changes: 2 additions & 2 deletions aegir.make
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ projects[drupal][type] = "core"

projects[hostmaster][type] = "profile"
projects[hostmaster][download][type] = "git"
projects[hostmaster][download][url] = "http://git.drupal.org/project/hostmaster.git"
projects[hostmaster][download][branch] = "7.x-3.x"
projects[hostmaster][download][url] = https://github.com/aegir-project/hostmaster.git
projects[hostmaster][download][branch] = "feature/quick-review"

1 change: 1 addition & 0 deletions debian/aegir3-hostmaster.postinst
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@ EOF
;;

abort-upgrade|abort-remove|abort-deconfigure)
service hosting-queued start
;;

*)
Expand Down
20 changes: 16 additions & 4 deletions http/Provision/Config/Apache/server.tpl.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,30 @@
LoadModule rewrite_module modules/mod_rewrite.so
</IfModule>

<?php
if (drush_get_option('provision_apache_conf_suffix', FALSE)) {
$include_statement = 'IncludeOptional ';
$include_suffix = '/*.conf';
}
else {
$include_statement = 'Include ';
$include_suffix = '';
}

?>

# other configuration, not touched by aegir
# this allows you to override aegir configuration, as it is included before
Include <?php print $http_pred_path ?>
<?php print $include_statement . $http_pred_path . $include_suffix ?>

# virtual hosts
Include <?php print $http_vhostd_path ?>
<?php print $include_statement . $http_vhostd_path . $include_suffix ?>

# platforms
Include <?php print $http_platformd_path ?>
<?php print $include_statement . $http_platformd_path . $include_suffix ?>

# other configuration, not touched by aegir
# this allows to have default (for example during migrations) that are eventually overriden by aegir
Include <?php print $http_postd_path ?>
<?php print $include_statement . $http_postd_path . $include_suffix ?>

<?php print $extra_config; ?>
17 changes: 0 additions & 17 deletions http/Provision/Config/Http/Server.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,23 +16,6 @@ class Provision_Config_Http_Server extends Provision_Config_Http {

function write() {
parent::write();

if (isset($this->data['application_name'])) {
$file = $this->data['application_name'] . '.conf';
// We link the app_name.conf file on the remote server to the right version.
$cmd = sprintf('ln -sf %s %s',
escapeshellarg($this->data['server']->config_path . '/' . $file),
escapeshellarg($this->data['server']->aegir_root . '/config/' . $file)
);

if ($this->data['server']->shell_exec($cmd)) {
drush_log(dt("Created symlink for %file on %server", array(
'%file' => $file,
'%server' => $this->data['server']->remote_host,
)));

};
}
}

function filename() {
Expand Down
7 changes: 6 additions & 1 deletion http/Provision/Config/Http/Site.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,12 @@ class Provision_Config_Http_Site extends Provision_Config_Http {


function filename() {
return $this->data['http_vhostd_path'] . '/' . $this->uri;
if (drush_get_option('provision_apache_conf_suffix', FALSE)) {
return $this->data['http_vhostd_path'] . '/' . $this->uri . '.conf';
}
else {
return $this->data['http_vhostd_path'] . '/' . $this->uri;
}
}

function process() {
Expand Down
3 changes: 2 additions & 1 deletion http/Provision/Service/http/public.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,11 @@ function init_server() {
$this->server->http_vhostd_path = "{$app_dir}/vhost.d";
$this->server->http_subdird_path = "{$app_dir}/subdir.d";
$this->server->http_platforms_path = "{$this->server->aegir_root}/platforms";

$this->symlink_service();
}
}


static function option_documentation() {
return array(
'web_group' => 'server with http: OS group for permissions; working default will be attempted',
Expand Down
2 changes: 2 additions & 0 deletions install.hostmaster.inc
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,8 @@ function drush_provision_hostmaster_install($site = NULL) {
drush_invoke_process('@none', 'cache-clear', array('drush'));
provision_backend_invoke($site_name, 'hosting-setup');

provision_backend_invoke($platform_name, 'provision-lock');

drush_print("");
drush_print("==============================================================================");
drush_print("");
Expand Down
6 changes: 4 additions & 2 deletions migrate.hostmaster.inc
Original file line number Diff line number Diff line change
Expand Up @@ -160,8 +160,7 @@ We are making the following assumptions:
* Prepare the hostmaster site for migration
*/
function drush_provision_pre_hostmaster_migrate($site, $platform) {
// we ignore errors here through integrate = FALSE
provision_backend_invoke(drush_get_option('site_name'), 'hosting-pause', array(), array('#integrate' => FALSE));
provision_backend_invoke(drush_get_option('site_name'), 'hosting-pause', array(), array());
}

function drush_provision_hostmaster_migrate($site, $platform) {
Expand Down Expand Up @@ -213,5 +212,8 @@ function drush_provision_post_hostmaster_migrate($site, $platform) {
// We need to re-verify @server_master via frontend to re-generate
// its drush alias and to update Nginx configuration files.
provision_backend_invoke('@hostmaster', 'hosting-task', array(@server_master, 'verify'), array('force' => TRUE));

$new_platform = _provision_path_to_platform_alias($platform);
provision_backend_invoke($new_platform, 'provision-lock');
}

77 changes: 77 additions & 0 deletions platform/drupal/packages_6.inc
Original file line number Diff line number Diff line change
Expand Up @@ -193,3 +193,80 @@ function _provision_drupal_system_map() {
drush_log(dt("Found !count themes", array('!count' => sizeof($packages['themes']))));
return $packages;
}

/**
* Find available profiles on this platform.
*/
function _provision_find_profiles() {
$profiles = array();

include_once('includes/install.inc');
$profiles_subdirs[] = "./profiles";

foreach($profiles_subdirs as $profiles_subdir) {
if (!$dir = opendir($profiles_subdir)) {
drush_log(dt("Cannot find profiles directory"), 'error');
return FALSE;
}

while (FALSE !== ($name = readdir($dir))) {
$languages = array();
if (($name == '..') || ($name == '.') || (!is_dir("$profiles_subdir/$name"))) {
continue;
}

$profile = new stdClass();
$profile->name = $name;
$profile->info = array();

$info_file = "$profiles_subdir/$name/$name.info";
if (file_exists($info_file)) {
$profile->info = provision_parse_info_file($info_file);
// Skip hidden profiles
if (isset($profile->info['hidden']) && $profile->info['hidden'] == 1) {
continue;
}
}
$profile->filename = $info_file;

// Include code from the profile.
if (file_exists($profile_file = "$profiles_subdir/$name/$name.profile")) {
require_once($profile_file);
}

$func = $profile->name . "_profile_details";
if (function_exists($func)) {
$profile->info = array_merge($profile->info, $func());
}

$profile_path = $profiles_subdir . '/' . $name;
$profile->info['languages'] = _provision_find_profile_languages($profile_path);

$profiles[$name] = $profile;
drush_log(dt('Found install profile %name', array('%name' => $name)));
}
}
return $profiles;
}

/**
* Retrieve a list of paths to search in a certain scope
*/
function _provision_drupal_search_paths($scope, $key = '', $type = 'modules') {
$searchpaths = array();
$drupal_root = drush_get_context('DRUSH_DRUPAL_ROOT');
switch ($scope) {
case 'base' :
$searchpaths[] = sprintf("%s/%s", $drupal_root, $type);
$searchpaths[] = sprintf("%s/sites/all/%s", $drupal_root, $type);
break;
default :
if ($key) {
$searchpaths[] = sprintf("%s/%s/%s/%s", $drupal_root, $scope, $key, $type);
}
break;

}
return $searchpaths;
}

83 changes: 83 additions & 0 deletions platform/drupal/packages_7.inc
Original file line number Diff line number Diff line change
Expand Up @@ -204,3 +204,86 @@ function _provision_drupal_system_map() {
drush_log(dt("Found !count themes", array('!count' => sizeof($packages['themes']))));
return $packages;
}

/**
* Find available profiles on this platform.
*/
function _provision_find_profiles() {
$profiles = array();

include_once('includes/install.inc');
$profiles_subdirs[] = "./profiles";

foreach($profiles_subdirs as $profiles_subdir) {
if (!$dir = opendir($profiles_subdir)) {
drush_log(dt("Cannot find profiles directory"), 'error');
return FALSE;
}

while (FALSE !== ($name = readdir($dir))) {
$languages = array();
if (($name == '..') || ($name == '.') || (!is_dir("$profiles_subdir/$name"))) {
continue;
}

$profile = new stdClass();
$profile->name = $name;
$profile->info = array();

$info_file = "$profiles_subdir/$name/$name.info";
if (file_exists($info_file)) {
$profile->info = provision_parse_info_file($info_file);
// Skip hidden profiles
if (isset($profile->info['hidden']) && $profile->info['hidden'] == 1) {
continue;
}
}
$profile->filename = $info_file;

// Include code from the profile.
if (file_exists($profile_file = "$profiles_subdir/$name/$name.profile")) {
require_once($profile_file);
}

$func = $profile->name . "_profile_details";
if (function_exists($func)) {
$profile->info = array_merge($profile->info, $func());
}

$profile_path = $profiles_subdir . '/' . $name;
$profile->info['languages'] = _provision_find_profile_languages($profile_path);

// Drupal 7 renamed the default install profile to 'standard'
// Aegir now allows projects to specify an "old short name" to provide an upgrade path when projects get renamed.
if ($profile->name == 'standard') {
$profile->info['old_short_name'] = 'default';
}

$profiles[$name] = $profile;
drush_log(dt('Found install profile %name', array('%name' => $name)));
}
}
return $profiles;
}

/**
* Retrieve a list of paths to search in a certain scope
*/
function _provision_drupal_search_paths($scope, $key = '', $type = 'modules') {
$searchpaths = array();
$drupal_root = drush_get_context('DRUSH_DRUPAL_ROOT');
switch ($scope) {
case 'base' :
$searchpaths[] = sprintf("%s/%s", $drupal_root, $type);
$searchpaths[] = sprintf("%s/sites/all/%s", $drupal_root, $type);
break;
default :
if ($key) {
$searchpaths[] = sprintf("%s/%s/%s/%s", $drupal_root, $scope, $key, $type);
}
break;

}
return $searchpaths;
}

61 changes: 61 additions & 0 deletions platform/drupal/packages_8.inc
Original file line number Diff line number Diff line change
Expand Up @@ -113,3 +113,64 @@ function _provision_system_query($type) {

return $packages;
}

/**
* Find available profiles on this platform.
*/
function _provision_find_profiles() {
$profile_dirs = array('./core/profiles', './profiles');

$profiles = array();
foreach($profile_dirs as $profile_dir) {
if (!is_dir($profile_dir)) {
drush_log(dt("Cannot find profiles directory %dir", array('%dir' => $profile_dir)), 'error');
return FALSE;
}

$info_files = drush_scan_directory($profile_dir, "/\.info.yml$/");
foreach ($info_files as $path => $info_file) {
$path = realpath($path);
$info = Symfony\Component\Yaml\Yaml::parse($path);
if ($info['type'] == 'profile' && (!isset($info['hidden']) || !$info['hidden'])) {
$profile = new stdClass();
$profile->name = $info['name'];
$profile->info = $info;
$profile->filename = $path;
$profile->path = dirname($path);
$profile->info['languages'] = _provision_find_profile_languages($profile->path);

$profiles[basename($profile->path)] = $profile;
drush_log(dt('Found install profile %name', array('%name' => $name)));
}
}
}
return $profiles;
}

/**
* Retrieve a list of paths to search in a certain scope
*/
function _provision_drupal_search_paths($scope, $key = '', $type = 'modules') {
$searchpaths = array();
$drupal_root = drush_get_context('DRUSH_DRUPAL_ROOT');
switch ($scope) {
case 'base':
$searchpaths[] = sprintf("%s/%s", $drupal_root, $type);
$searchpaths[] = sprintf("%s/core/%s", $drupal_root, $type);
$searchpaths[] = sprintf("%s/sites/all/%s", $drupal_root, $type);
break;
case 'profiles':
foreach (_provision_find_profiles() as $profile) {
$searchpaths[] = $profile->path;
}
break;
default:
if ($key) {
$searchpaths[] = sprintf("%s/%s/%s/%s", $drupal_root, $scope, $key, $type);
}
break;

}
return $searchpaths;
}

Loading