Drupal 10, the latest version of the open-source digital experience platform with even more features, is here.The requirement of having to create a "platform" before you can create a site has been a challenge for user experience and for the API for a very long time.
DevShop jumps through hoops (hooks) just to clone a codebase and install drupal. It hooks into platform_verify and then creates the site node. When all I want to do is create a site and platform in one shot.
You can't spin up a new site in a single request unless you already have the codebase created in a separate request.
You can't even just "save a site node" and make that work. Any API should be able to handle this, especially given how simple platforms are.
So, my proposal is to start simple:
- Patch the node API so that saving a site node without an existing platform ID is possible.
- If the site node has the needed properties that a platform needs (publish path, makefile/git url) then hosting_site_insert() creates the platform node automatically, along with it's verify task.
- Don't do much else than that, so as to get accepted in the 3.x branch.
If I can get this to work. DevShop will adopt this patch now in it's next release and use it instead of the hook jumping.
| Comment | File | Size | Author |
|---|---|---|---|
| #27 | api_only_allow-2824731-27.patch | 1.1 KB | helmo |
| #23 | 2824731-site-create-platform.patch | 6.58 KB | Jon Pugh |
| #14 | 2824731-site-create-platform-install-method.patch | 6.06 KB | Jon Pugh |











Comments
Comment #2
Jon PughComment #3
helmo CreditAttribution: helmo as a volunteer and at Initfour websolutions for Aegir Cooperative commentedI can see where that would simplify things for devshop... and it could pave the way for site repo's that describe their desired platform in a makefile/composerfile or whatelse...
Comment #5
colanThis would be quite useful for Aegir Services, especially #2634074: Allow remote platform creation.
Comment #6
helmo CreditAttribution: helmo as a volunteer and at Initfour websolutions for Aegir Cooperative commentedAdded for extra review to https://github.com/aegir-project/hosting/pull/8
Comment #8
Jon PughUpdated patch. I'm using this in devshop now.
Comment #9
Jon PughComment #13
Jon PughJust pushed code that allows install profile to be specified by "profile_name". This has to happen post-platform-verify because the packages don't exist until then.
If $site_node->profile is empty, but $site_node->profile_name is, then lookup the profile package ID and save it to the site node.
Comment #14
Jon PughComment #15
Jon PughComment #16
helmo CreditAttribution: helmo as a volunteer and at Initfour websolutions for Aegir Cooperative commentedI don't see this in the feature branch ... and don't think it's intended ;)
Where can we document this API addition? small example in hosting.api.php?
Comment #23
Jon PughFixed a few bugs and added an example function, that I tested, it works!
Branch pushed and patch attached.
Comment #25
helmo CreditAttribution: helmo as a volunteer and at Initfour websolutions for Aegir Cooperative commentedThanks, merged.
Comment #26
Jon PughAwesome, thanks helmo!
This is a good step but I think we have more to do to get a better API. A few thoughts:
Comment #27
helmo CreditAttribution: helmo as a volunteer and at Initfour websolutions for Aegir Cooperative commentedWe have a build failure :( looks like an issue with one of the hosting commits from here ... I suspect ff9e5e68c6b89e5bba6603e569fce62bb1f00eb1
Regression ... and release blocker.
Comment #29
helmo CreditAttribution: helmo as a volunteer and at Initfour websolutions for Aegir Cooperative commentedThe testbot seems happy with this fix.
Error: https://gitlab.com/aegir/provision/builds/17263601
Passes: https://gitlab.com/aegir/provision/builds/17290272
Comment #30
helmo CreditAttribution: helmo as a volunteer and at Initfour websolutions for Aegir Cooperative commentedThere's little to review as most of the work here seems to be committed already.
Setting back to needs work to look at #26
Comment #35
Jon PughMarking fixed, any follow up should get a new issue.