Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
When working with multiserver environments, a common task is to take a server out of the pool. Currently, I can go to a site node and tack /delete on the end of it, and that'll delete the node, but that also makes lots of other things break.
There should be a safe way to remove a server from the frontend.
Comment | File | Size | Author |
---|---|---|---|
#18 | remove-server-services-2040445-18.patch | 530 bytes | formatC'vt |
Comments
Comment #1
ergonlogicI guess we need to add a 'delete' task to servers. We'll need to check that there aren't any platforms on web servers, and no sites installed on database servers before allowing it. This could be similar to how we block platform deletions if sites remain.
Does anyone know why we don't already have something like this? Were there technical reasons, or did we just never get around to it?
Comment #2
ergonlogicInterestingly, we already have this commented-out in
hosting_server_hosting_tasks()
:Comment #3
ergonlogic... and it works as is. So I guess it's really just the validation that's left.
Comment #4
ergonlogicActually, deleted servers still appear in our server list. This isn't generated through Views (yet? see: #1876354: Convert list of servers to use views), so we'll have to fix that too.
Comment #5
ergonlogicI went ahead and un-commented the above in d359bdb. It appears to delete the server context properly. We still need to add a server_status field so we can filter on it in views.
Since this is in hook_menu(), remember to clear your menu cache after pulling down this change, or you'll get an error on the task confirmation form.
Comment #6
ergonlogicIn 7bd8ea2, I added the deletion of tasks related to a server when it's node is deleted.
Comment #7
ergonlogicPerhaps we should add a 'lock' or 'disable' task, comparable to platforms and sites (respectively). It seems like we'd want to be able to bar usage of a server without necessarily deleting it's configuration.
Comment #9
ergonlogicThis should mostly be fixed by f191376. I added both 'status' and 'verified' fields to servers, including the Views integration, etc.
I say "mostly", because, while we can now delete servers from the front-end, and have the corresponding context alias removed as well, I don't consider this particularly "safe". That is, before allowing a platform to be deleted, we check whether there are any sites installed on it. We should perhaps do something similar here. I suppose we'd have to check what services are being used by platforms/sites, etc...?
Comment #10
cweagansThe code looks good to me. I haven't been able to test it, though, as I don't have a cluster running Aegir 3 just yet.
There are two things we need to check: 1) are there any platforms provisioned on the server, and 2) if there's a database service, are there any sites that are using it?
Comment #11
ergonlogicMaybe we should add a hook to allow entities consuming a service to declare it safe to disable the service. Then the delete task can attempt to disable any active services before proceeding with the deletion of the server.
Maybe something like:
hook_hosting_service_allow_disable($server, $service)
Then sites could implement:
Platforms could do similarly for 'http' services. This way when we add a static site entity that just requires a vhost (for example), we don't have to alter hosting_server overly to accommodate it.
Comment #13
helmo CreditAttribution: helmo commentedOr should we expand drush_http_provision_delete() to have a case for type = server.
And let it check e.g. if there are platforms on the server left?
Comment #18
formatC'vt CreditAttribution: formatC'vt as a volunteer commentedAfter server deleted we should remove services provided by this server, because services still available in list when we create new sites/platforms.
Comment #19
gboudrias CreditAttribution: gboudrias at Praxis Labs Coop commentedHi format, is your patch for 7.x-3.x? Just clarifying since this is an old issue.
Comment #20
formatC'vt CreditAttribution: formatC'vt as a volunteer commentedyes, for 7.x-3.x
Comment #21
gboudrias CreditAttribution: gboudrias at Praxis Labs Coop commentedComment #22
gboudrias CreditAttribution: gboudrias at Praxis Labs Coop commented#18 works great, but maybe it should go into its own issue? I'm hesitant to mark this as RTBC seeing as this is a larger issue than just the form.
Comment #23
cweagansI think it's fine. It's normal cleanup that needs done when a server is deleted. LGTM.
Comment #24
ergonlogicHas #10 been addressed? We need to validate that removing a server won't pull the platform or database from under a site. This is comparable to how a platform won't allow itself to be deleted if there are any sites installed on it.
Comment #26
gboudrias CreditAttribution: gboudrias at Praxis Labs Coop commentedPushed formatC'vt's patch since it seemed important, back to active to address #10.