Drupal 10, the latest version of the open-source digital experience platform with even more features, is here.In devshop, I've created a new task I call "Deploy".
This takes two options: git ref and environment. It is a replacement for "Pull Code". Right now that's all it does, as well as checkout if you changed the branch, and optionally runs cc all, updb, and fra.
Let's enhance devshop's "Deploy" task to be really robust. We could make it optional to just pull or....
Deploy
Devshop-speak: "Deploy a git branch or tag to an environment."
Aegir-speak:
- Clone & verify new platform with the chosen git ref.
- Trigger a migrate task for the site to the platform. Fail if it's not compatible.
- Run the desired drush calls (or recipes) on the site post-migrate. Currently aegir runs update.php, and cc all.
- Once the migrate task completes, optionally delete the platform.
- Save a log of the platforms a site has been on over time.
Original Issue
From devshop
I've already started work on a new way to update code.
I'd like to replace the "Pull Code" task with a "Deployment" task, along with a separate node type for tracking deployments.
This will make pushing code to an environment a more discreet task. Editing the project settings page to change all the branches is not a good way to go.
This way, each time code changes, even during an "auto pull" after a git push, we will get a "Deployment" log.
It also means we can more easily configure the post-deployment process per project.
There is already work in the dev-deployment branch.










Comments
Comment #1
Jon PughThis is working really well!
See the dev-deploy branches in devshop_hosting and devshop_provision.
The "deploy" task, provision-devshop-deploy, replaces the pull task. This makes it really easy to put an environment at a tag or branch.
The only task left is to save the new git_ref for the environment within both the project context drush alias and the project node in hostmaster.
I think I need help to get this to just work with provision-devshop-deploy, I'm not sure how to re-saving the project context (drush alias)!
Comment #2
Jon PughComment #3
Jon PughDeployment task work has been merged!
This means we also have a nifty "Deploy branch/tag" dropdown for environments right next to their branch selector! Couldn't be easier to switch an environment between branches or tags.
We still have work to do, like removing the "Pull Code" task, and making git webhooks trigger "Deployment" tasks instead.
This opens the door for removing the poorly conceived "environment settings form".
Comment #4
Jon PughMarking this fixed.
Comment #5
Jon PughI am reopening.
I am not happy with how this is setup. I now realize all tasks should be on sites themselves.
Devshop now treats the site nodes as the "environment" . When you are editing the environment settings, you are editing the site node.
With the new UI, each environment indicates if it has a process running on it. It is based on the site (and soon platform) nodes tasks.
We should move the few remaining project tasks back to sites.
Someone has already done this with Sync. Next is "Pull Code", which should be refactored to a "deploy task" on sites. This should go into hosting_git.module, not in devshop. Then "Commit Features" task will go back to the hosting_features module, which is incredibly ironic, since that was the very first aegir module I wrote, and all of devshop followed.
So I kindof went on a tangent here, but this is where I got the idea.
So let's work on creating this task in hosting_git.module. I actually think we can do more than "Git Pull". Git Pull is really useful when in development. Lots of people want to create new platforms to update, for good reason.
Let's enhance the "Deploy" task to be really robust. We could make it optional to just pull or....
Deploy
Comment #6
Jon PughComment #7
Jon PughComment #8
Jon PughComment #9
helmo CreditAttribution: helmo commentedI'm glad to hear that you want to move some tasks from projects to sites ... that should keep it more compatible with Aegir.
Using hosting_features has potential for confusion ... as we also use it in http://cgit.drupalcode.org/hosting/tree/hosting.features.inc#n32
Using the term features there is not ideal either ....
Comment #10
formatC'vt CreditAttribution: formatC'vt as a volunteer commentedJon Pugh, please, re-assign to yourself if you are planning to work on this.
Comment #11
ergonlogicI'm not sure that 'deploy' is the right term to use here. If I understand correctly, this is intended to safely update a site running on a platform managed under git. Is that correct?
In https://www.drupal.org/node/2555129#comment-10248567, I describe some of the challenges with managing multiple sites on a git-based platform. IMO, putting the platform under Git is the equivalent of having a single site per platform. It seems to me that we'd need to enforce this policy for this functionality to be safe.
Comment #12
Jon PughI'm closing this. We've had the deploy task working on sites for a while.
This is less about "safely updating sites" and more about quickly deploying new code either pulling on the same branch or checking out a new one.