This is apparently a feature we're supposed to have, but I have never seen a site put offline during a migration.

In my opinion, the site should at least be put in "maintenance mode" before the database backup is performed. Adrian told me it was supposed to be redirected somewhere else during the migration, but I have not seen that happen while reloading regularly the site during a migration.

CommentFileSizeAuthor
#6 632984.patch1.66 KBmig5
#5 632984.patch1.59 KBmig5
#4 632984.patch1.59 KBmig5

Comments

anarcat’s picture

platform/migrate.provision.inc does say:

 *   2. Temporarily disable the site by causing apache to redirect to a help page. Restarting apache is required.

However nothing in the code actually does that from what i can tell.

anarcat’s picture

I tried this:

--- a/platform/migrate.provision.inc
+++ b/platform/migrate.provision.inc
@@ -31,6 +31,8 @@ function drush_provision_drupal_provision_migrate_validate($url = null, $platfor
  * Make a backup before making any changes, and add extract the file we are restoring from
  */
 function drush_provision_drupal_pre_provision_migrate($url, $platform) {
+  drush_log(dt("Putting site in maintenance"));
+  drush_invoke('eval', array("'variable_set(\"site_offline\", 1);'", 'uri' => $url, 'root' => $platform));
   drush_invoke('provision backup', $url);
 }
 
@@ -60,6 +62,8 @@ function drush_provision_drupal_post_provision_migrate($url) {
   drush_set_option('installed', FALSE);
   _provision_drupal_delete_aliases(drush_get_option('aliases', array()));
   _provision_recursive_delete(drush_get_option('sites_path') ."/$url");
+  drush_log(dt("Taking site out of maintenance"));
+  drush_invoke('eval', array("'variable_set(\"site_offline\", 0);'", 'uri' => $url, 'root' => $platform));
 }

For some reason this fails with:

Parse error: syntax error, unexpected ';', expecting '(' in /usr/share/drush/commands/core/core.drush.inc(440) : eval()'d code on line 1 
Anonymous’s picture

This works better, take advantage of some of drush2.1's new features


  drush_backend_invoke("vset", array('site_offline', '1', 'uri' => "http://$url"));

This puts the site into offline mode prior to migrate.

However! I put the site back online in the post_ hook but it doesn't work - drush will fail with

Could not find a Drupal settings.php file at ./sites/default/settings.php.
Command variable set needs a higher bootstrap level to run - you will need invoke drush from a more functional Drupal environment to run this command.

This is because technically the site is 'deleted' here: the site dir doesn't exist, we've just deleted it. We need to assume the site is in offline state stll after invoking 'provision deploy', and set it back online in the deploy post hook.

(I think)

Anonymous’s picture

Status: Active » Needs review
StatusFileSize
new1.59 KB

Please test

Anonymous’s picture

StatusFileSize
new1.59 KB

Please test

Anonymous’s picture

StatusFileSize
new1.66 KB

Updated patch, doesn't use vset, just writes $conf['site_offline'] = 1; to the settings.php for that fleeting moment before the site dir gets blown away prior to invoking provision deploy.

Since we use drush_set_option here, we can then accurately unset that variable on rollback and regenerate the settings.php without this setting, taking the site back out of offline mode should Migrate fail.

adrian’s picture

comitted a simpler version.

Anonymous’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

  • Commit 49a9fdc on debian, dev-dns, dev-envobject, dev-koumbit, dev-log_directory, dev-migrate_aliases, dev-multiserver-install, dev-newhooks, dev-nginx, dev-platform_management, dev-ports, dev-purgebackup, dev-restore, dev-services, dev-simplerinstaller, dev-site_rename, dev-ssl, dev_716166_apache_conf, dev_dns, dev_server_verify, prod-koumbit, ssl, dev-ssl-ip-allocation-refactor, dev-1205458-move_sites_out_of_platforms, 7.x-3.x, dev-subdir-multiserver, 6.x-2.x-backports, dev-helmo-3.x authored by adrian:
    #632984 - provision migrate should put site offline during migration
    
    
  • Commit 195749c on debian, dev-dns, dev-envobject, dev-koumbit, dev-log_directory, dev-migrate_aliases, dev-multiserver-install, dev-newhooks, dev-nginx, dev-platform_management, dev-ports, dev-purgebackup, dev-restore, dev-services, dev-simplerinstaller, dev-site_rename, dev-ssl, dev_716166_apache_conf, dev_dns, dev_server_verify, prod-koumbit, ssl, dev-ssl-ip-allocation-refactor, dev-1205458-move_sites_out_of_platforms, 7.x-3.x, dev-subdir-multiserver, 6.x-2.x-backports, dev-helmo-3.x authored by adrian:
    #632984 - handle rollback