Hi,

I'm trying to better understand Aegir before using it in production.

I'm customizing the Aegir front-end to be a hosting platform where clients can sign up online and have a website provisioned automatically.

As my sales/marketing site will be tied to the hosting site, I'll need push changes from dev to production.

I can do this using hostmaster-migrate, but if a hostmaster-migrate fails (say buggy code in an hook_update_N), how do I roll the server back immediately?

The db and code are still in place right? Is there a hostmaster command I can run to reset the apache config and drush aliases? Is this backed up?

If you write it down here, I'll test it and copy it to the docs here: http://community.aegirproject.org/upgrading/manual :-)

Thanks for this awesome project!

Mike

Comments

Anonymous’s picture

Hi,

I'm customizing the Aegir front-end to be a hosting platform where clients can sign up online and have a website provisioned automatically.

I've never used it, but we have a feature in /admin/hosting/features called Sign-up form which I believe provides this functionality (you can put the form on a remote site and have it communicate with xmlrpc.php back to the aegir instance.. apparently!)

Re: migrate stuff:

(This is a rather theoretical response, as I can't recall off the top of my head any past case of a failed aegir upgrade.. it's been stable too long :) )

But basically, the hostmaster-migrate command, is a special command that does a few bits and bobs before actually invoking provision-migrate on the hostmaster site, just the same way as any regular drupal site gets migrated.

The provision-migrate command *copies* the site (note: *not* moves, initially) to a new target platform, and creates/imports a new database based on a database dump it takes of the site initially. Note: it doesn't modify the currently-running site/database (other than setting it to offline mode, see below).

The drush updatedb thus gets called on the *new* 'copy' site and database.

Only if the drush updatedb task succeeds (e.g if all hook_update_N functions succeed), does it then proceed to change the apache vhost (point to the new DocumentRoot), update the drush alias etc. Finally, it removes the original copy of the site on the old platform and drops the original database. So if it all failed, it would just clean up its attempt (its copy of the site on the new platform), and the site would continue to run on the old platform with its original database like nothing every happened.

It does not back up the apache vhost or drush alias: however, I believe the rollback task in the migrate command 'remembers' the old platform info and re-saves the Drush alias to make it like it was.

Contingency planning:

You'd benefit from backing up the vhost and alias anyway just in case.

Additionally, you might want to save the aegir user's crontab information (crontab -l > original_crontab.bak) as we temporarily remove it during a hostmaster migrate so that the queue isn't accidentally executed mid-migration. In some exceptional cases of failure, you may need to restore the crontab yourself as a result.

The site gets set to offline mode (drush vset site_offline 1) at the start of the procedure, to prevent new data being written to the site's database. If the migrate fails, it brings the original site back out of offline mode, so this shouldn't ever be a problem: but just pointing out as something to check if you find your site appears to be in offline mode.

Hope this helps. Good luck

Mig

Anonymous’s picture

Additionally, even if it somehow could not revert to the original site on its platform (e.g maybe it failed *after* removing the original site/database, although that's darn-near impossible), you would still have a tarball of the site + its database in /var/aegir/backups that gets taken by the migrate process right at the start. You could restore this manually or by using the 'provision-deploy' command.

I would be amazed if anything went this badly though - as you can see above it's designed to be a very safe process - not failproof but nearly :)

steven jones’s picture

Status: Active » Fixed

No follow ups, so assuming that all questions are answered.

Status: Fixed » Closed (fixed)

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