Aegir - ben600324/wiki GitHub Wiki

Working with Aegir Jon Moss edited this page on 9 May 2019 · 8 revisions NOTE: Webform module has updates in external file, when trying to migrate the updates show it is at 8000. Provision is patched to fix this but can break after an update. See this ticket for patch: https://www.drupal.org/project/provision/issues/2938015

Housekeeping Several basic housekeeping tasks should be run on a monthly basis to make sure Aegir runs fast and error free.

Removing old platforms The longer the platform list gets the slower Aegir becomes. Platforms are created every time someone pushes code to a git repository, these can build up fast. It is good practise to keep 10 ~ 20 platforms per project just in case things go wrong in a build and you need to roll back to something more stable.

For our example we'll clean up platforms for the Schools Portal project.

First visit the platforms page on Aegir: http://aegir.dev.teachfirst.org.uk/hosting/platforms

Use the pager to find the platforms list for the project, this should look like: schools_NNN

Next, check what the latest platform number is. In this example we will say the latest platform is schools_483 and we want to keep at least 20 platforms. We usually remove platforms in groups of 10 as it is easier on the command line (eg rm -rf 45* will delete all items from 450 to 459). Considering the above we decide to remove all platforms up to schools_459 (and our platforms are starting at 430 since the last clean up).

Steps to take Taking the above in to account, we need to delete the platforms 430 to 459.

On the Aegir platforms listing page '/hosting/platforms' find the platforms listed. Check each platform shows 0 sites installed (this is the last column). If any platforms show an active site you will need to migrate that site up the chain or remove it if no longer required. Once all sites are removed you can move to the next step. SSH to Aegir and change directory to the sites project folder (eg. cd /var/aegir/platforms/projects/schools). List the platforms with ls -la. For each platform we want to remove we need to give ownership to Aegir (eg. sudo chown -R aegir:aegir 43* 44* 45*). Return to the Aegir front end ('/hosting/platforms'). Put a 'Check' on each site you want to remove (Check box in first column, you can do it in batches). At the top of the page, open 'Operations' and select 'Delete'. Make sure you have not selected any sites you do not intend to delete, this will stop Apache from reloading and could take down the sites! When you are happy, click 'Execute'. You will see each of the delete tasks appear in the queue on the right hand side. If deleting in batches you can now repeat steps to add more delete tasks to the queue. Once the queue has finished processing, check there were no errors (all tasks should be green, fix any broken delete tasks before continuing). Only when you are happy that all tasks are complete - You may now go and delete the folders (rm -rf 43*). If you are unsure, it is safe to leave these folders in place as they will not slow down Aegir. The hard disk is full Several things can fill up the hard disk. If it's filling slowly over time, you may just need to clean out old platforms. However if the entire disk filled up fast, you should first check the temp folder (/tmp). If this folder is full of thousands of cachegrind.out files it is very likely that Xdebug Profiler is enabled for a site, or maybe even running globally.

Check the PHP info page on any site and look for xdebug.profiler_enable this should be disabled globally always and only enabled for the local (current) site if you are currently using it. When enabled it will slow down the site and create terabytes of cachegrind.out files in very little time.

When things go wrong Module update mismatch when trying to migrate Sometimes, when trying to migrate a site, the target will be unavailable. This is usually because one or more of the modules are missing or not compatible. You can find the issue by clicking compare ad looking through the differences between the source and target platforms.

Module update sync issues If you find a module update is showing the incorrect database update (eg the crop module says you are using update 8003, but the target shows 8002). You can manually set the installed schema version in use on the site with drush.

drush @test.schools.dev.teachfirst.org.uk ev "drupal_set_installed_schema_version('crop', 8002)"

After you will need to reverify the broken site and then attempt migration again.

Note: This does not actually change the database in any way, this only tells drupal/aegir that the installed database update is a now incorrect number.

Debugging a hosting task If a task (eg verify) fails, you can view the task to see what part of the task failed. But sometimes the output is not very helpful.

You can also rerun the same task in debug mode from the command line, this will give you much more verbose output.

On the task view popup, check the task ID in the URL, for this example let's say the task ID is 1234 (#overlay=hosting/task/1234), run the following command as the Aegir user: drush @hostmaster hosting-task --debug --force 1234

Manually deleting a site Sometimes you may want to delete a site and it will fail, after the failure you may find not subsequent tasks will run. If this is the case you may need to manually remove the site from the server.

The full Aegir guide to manually removing sites is here: https://community.aegirproject.org/node/26/index.html

Steps taken from document:

Manually remove the site files on the server if they exist (i.e /var/aegir/platforms/drupal-6.16/sites/my-failed-site.com) Drop the database and revoke db user privileges associated with this site if it got created before failing (check the vhost configuration file's 'SetEnv' parameters, or the settings.php if the credentials are uncloaked, for the site's database name and user) Manually remove the Apache vhost file for this site if it is still present (in /var/aegir/config/server_master/apache/vhost.d/) Manually remove the Drush alias for this site if it is still present (in /var/aegir/.drush/) Enter the Aegir database from mysql and set the status of the node in the hosting_site table to -2 (deleted). For example, if your site node was nid 83 (the 'Edit' tab of the site node will tell you this), run UPDATE hosting_site SET status = '-2' WHERE nid = 83; Still in the Aegir database, delete the node record in the hosting_context table. For example, if your site node was nid 83 (as above), run DELETE FROM hosting_context WHERE nid = 83; Alternatively, if you want to even remove the node altogether from the system (not recommended), go to /node/83/delete in your browser on the Aegir frontend and delete the node. This will remove the site node and all associated task nodes from the system, as well as remove the entry from the hosting_site table in the database. Re-verify the Platform node where the Platform is the one where your site was hosted on. This will regenerate some metadata whereby the Platform believed it still had that site contained within it. Notes: You only need to perform the steps highlighted on the Teach First Aegir environment. We use a shared SSL certificate which works for all sites, you do not need to do any of the steps for SSL. We do not use DNS so this step is also not needed.