Dries highlighted at the DrupalCon Vienna keynote that a priority for Drupal is to support core updates from within the UI.
This solution will be just as optional as Update Manager is today, aimed at non-Composer people.
We also had a Composer meeting (attended by Dries, xjm, Mixologic and others) where we highlighted the need for that same UI to support fetching Composer dependencies, to avoid exposing users to Composer.
Anyone who's looked at Update Manager knows that it has been abandoned and unloved for a long time. Our best approach would be to build a new solution (core module or app) and then deprecate Update Manager.
The goal of this issue is to investigate how such an implementation would look, and estimate the amount of effort, then try to gather contributors and funding that could help make it happen. Keeping the initial discussion and planning in this issue, it's too early to split work into subissues.
The order of priority:
1) Support updating Core from within Drupal.
2) Support downloading and updating modules.
3) Download dependent modules when adding a module (Commerce requires Address, download that too).
4) Deal with dependent libraries that currently need Composer in order to work.
There is no doubt that we won't be able to solve all of these in a single core release.
Resources:
http://www.drop-guard.net/blog/auto-updates-in-drupal
https://paragonie.com/blog/2016/10/guide-automatic-security-updates-for-...
https://theupdateframework.github.io/
The initial dilemma is figuring out where the new Updater will live. It could be a new module (core/modules), but it might be necessary (or simply preferable) to have the updater be its own app, living next to the core/ folder, with its own kernel (to make it more robust). Once the Update starts handling core (#1), handling modules (#2 and #3) should be a relatively easy followup. The real trickiness is in #4.
Figuring out how to structure the updater, and how to update core will be a big task, so I'd like to avoid discussing the Composer part for now. Still, here's a spoiler:
You click “Update” or “Install” next to the name of your favorite module. The updater downloads and extracts the module tarball. The library process then starts, and the updater sends two things to drupal.org:
a) the site’s composer.json (possibly reduced) with the addition of the name/version of
the new module.
b) The site’s vendor/installed.json, detailing the current state of vendor.
The drupal.org endpoint runs composer install. This is a faster process than usual because drupal.org will maintain a large composer cache (of both metadata and packages). The installed.json file is then evaluated. Every package that the client site already has (in the same version) is removed from vendor/, for a smaller download. The result (composer.lock, vendor/) is packaged and downloaded. The updater replaces the old composer.json, composer.lock, autoloader. It then adds in the new vendor subfolders. A custom file would also need to identify which vendor subfolders can be deleted, because they’re no longer needed.If you click “Update core”, it’s a similar process. The updater downloads the core tarball, extracts it (replacing vendor/ in the process), the reruns the library process to refetch module libraries. This process could be optimized to ensure it only replaces vendor / reruns the library fetch when needed.
Comments
Comment #2
bojanz commentedComment #3
mile23I'd suggest that there be a console component to this process, so it doesn't have the same fate as the update manager itself.
That is: People who don't use the web-based UI can (and should, and will want to) use the CLI part. Then it gets more attention and maintenance.
I'd also suggest that the CLI part be developed first, so we can discover the real sticky parts of the problem without having to re-work forms all day long.
Still a bit of a problem to guarantee the site's composer.json, since composer can build a codebase from an arbitrary composer.json file. Either this process will have to demand that composer.json files be located in certain places, or else have a way to specify the file used (that is, something like a form where you paste in your composer.json file). If we have a CLI this isn't such a big deal and we can account for it, because
COMPOSER=../../special/composer.json ./bin/console update.It's possible that we could make a composer plugin that stores the composer build info in a known location. This would get back to @Xano's idea from #2494073: Prevent modules which have unmet Composer dependencies from being installed (it's a looooong comment thread) of keeping that information during composer install phase. (@Mixologic solved that issue in scope by suggesting we have a
build_dependencieskey in info.yml instead. Much easier set to solve for.)Comment #4
larowlan<cents amount="2">I agree with comment 3 - doing it at API layer with console commands first.
UI later.
I also think we should try and get funding for this initiative like we did for d8 accelerate.
The issue queue is full of people for whom composer is causing a lot of pain and that would rather avoid it. How much pain is it causing? Enough for you to fund a team?
Because the issue is that most people are not willing to work on something that they won't use.
Providing funding will change that view, but also would allow us to contact experts like Paragonie (their blog post is in the issue summary) who already have solved this for airship in a secure manner
</cents>Comment #5
colanSo once the changed are downloaded and applied, Can there be an option to commit to a new branch with a timestamp or some such? There needs to be a way to get this stuff into Git (or some other VCS). Even if the server doesn't have push access (which it shouldn't), someone can run a diff, download it, and then push it from his/her local.
Comment #6
mherchelComment #7
mbayntonWow, I've been working on this for over a year on my own, and feeling like I was the only person who cared. Dries calling out automatic updates as a priority is consequently pretty exciting for me :)
I also love what I'm seeing in the initial implementation suggestions here. In particular, yes yes yes it should be a logically separate, standalone application -- shipped with Drupal, sure, but loading no scripts used by core or the user-facing site. This is the approach I have taken, for reasons including
Its also worth noting that php interpreters at least back to 5.4 will, regardless of configuration, serve entire web applications out of one .phar file and one .php file that simply
includes the .phar. So you can manage a modern, symfony-like app in a neat little package. This is probably the appropriate distribution format.I also wholeheartedly agree on the order of priority. Number 1 is done, if you allow for there not being a UI :p. The code is here. The CI environment is among many other things performing a complete Drupal 7 core update over ftp. In time, we can think about adding cool additional features like a composer UI, or update rollback support -- also things which would be beneficial for Drupal and beyond too.
I'd of course love to see this ultimately solved through direct contributions to the work I've already started, but even if we wanted to start the base app over, some potentially useful components that are already developed and tested are:
This one is optimized for this task.
Very happy to see Dries recognizing that it's time for Drupal to take this seriously.
Comment #8
mbayntonRegarding Paragon IE's work on securing automatic updates: I believe their most important contribution is sodium-compat. It is ostensibly the first native-php library that would allow you to perform and verify code signing, but Paragon themselves believes it should be validated by security experts besides themselves. I was contacted a few weeks ago by the Mozilla Foundation, asking me whether they should fund such a security audit. I told them that imho yeah of course they should, and yeah of course I'll use sodium-compat in my work discussed in #7. But what Mozilla is really looking for is a commitment from Drupal's decision makers that Drupal would incorporate sodium-compat into automatic updates as well. I can't offer that assurance, although I see absolutely zero reasons why we would not want to use a properly audited and highly backwards compatible code signature verification library.
I realize we still have decisions to make and planning to do. But with this currently getting so much attention in Drupal, and Mozilla having potential funding now, who can help me to get an email from the right person sent over to Mozilla?
Comment #9
8thom commented@mbaynton as you've spent a lot of time investigating this, would be interested in your opinion of the feasibility of this concept, basically keeping things as close to the current state, then look into improvements like it's own separate UI -- https://www.drupal.org/node/2908394#comment-12274918
This "remote composer resolution" service could be reused by non Drupal projects and even potentially for CLI in cases where the network latency is extremely poor -- https://www.drupal.org/node/2845379#comment-12068852
Comment #10
mbaynton@8thom, I've not put much thought into the problems of #2908394: Use Composer to build sites without forcing users to learn Composer, actually.
I wish we there there already, but I think the issue summary says it best
Of course, it could be that's shortsighted. If anyone can make a concise argument about that, it could be quite constructive. That's just how I see it right now.
Comment #11
alison100% agree with #3 / @Mile23.
Also, this sounds extremely sensible:
I mean, like, the Drush pm-* commands that are going away with Drush 9 (and that are on shaky ground for later versions of Drupal 8.x) -- if update manager changes, it might make it easier to keep/maintain the Drush pm-* commands that so many site builders know and love? I know this isn't a Drush dev thread, but it's still relevant, since we're talking about CLI things for site builders (AFAIK). (Related Drush PR: #2787)
Also related to this issue, maybe? (I know I can add to the "related issues" list, but I'm not positive, so I'm going to leave it to y'all this time.)
#2242947: Integrate Symfony Console component to natively support command line operations
(And, related conversation over here -- yes the issue is closed, but a good bit of the conversation is relevant: #2906637: [META] Drush and core compatibility is fragile)
Comment #12
mile23There's some question about how much formal Composer-based infrastructure to introduce in #2830880-47: Warn site admins when composer dev dependencies are installed inside of docroot.
Should we introduce a child issue here to define some Composer-oriented services to core, such as discovering the project root?
Comment #13
mbaynton@alisonjo2786, thanks for referencing the problems Drush is running into with Composer. I read the PR description you linked to and the first few comments. Interesting reading. As I understand it, the problem they're running into is more related to just keeping Drush from experiencing its own errors, and less related to adding new automatic composer integrations as part of module installations. Drush installs an autoloader built with its own composer.json, and then, because its raison d'être is to do complex things within Drupal, it needs to bootstrap Drupal, which means loading an additional autoloader built by a different (Drupal's) composer.json. Version conflicts ensue.
This is something it's good for me to be thinking about for sure. I'm all advocating for an implementation of this "more powerful tool" that, like Drush, is a separate project with its own autoloader. It _mostly_ runs independently from and without bootstrapping Drupal, but the way I'm currently doing it there's one point in the Drupal / Curator handoff where both application kernels, or at least their dependencies, both end up being simultaneously loaded in the interpreter. Basically I can't do that because of the risk of encountering this same problem.
Comment #14
alison@mbaynton Cool, welcome, thanks for reviewing and considering!
I don't know but I feel like the other genre of issues is the same dependency management stuff that has been problematic for update manger -- like, I think that some of the pm-* commands use the Drupal core "update manager" system, right? (but I'm not positive!)
Comment #15
mile23Still looking for answers on #12, about #2494073: Prevent modules which have unmet Composer dependencies from being installed and #2830880: Warn site admins when composer dev dependencies are installed inside of docroot
We should move forward on those, regardless of what super-duper dependency machine is being built in the cloud. Then we can modify or remove them as needed.
Comment #16
8thom commentedAgree, these short term solutions would be good to put in place.
If the reference to "super-duper dependency machine" is this project -- https://github.com/thom8/faas-composer
There's 34 lines of code required to make this work...
Comment #17
yoroy commentedComment #18
groovedork commentedAs a site builder with limited coding/console skills and/or drive, the proposal to let drupal.org do Composer-As-A-Service sounds really clever to me.
Am I correct in thinking that this would allow Drupal to once again be easy to install and update on shared hosting?
Comment #19
mbaynton@groovedork out of curiosity, are you talking about Drupal 7 or 8, and what makes it not easy?
Comment #20
groovedork commented@mbaynton I've outlined just a few of the issues in this post:
https://www.drupal.org/forum/support/post-installation/2017-03-24/how-do...
I work with a lot of non-profits who use Drupal on shared hosting, often building the sites themselves. They don't have SSH skills or access and, well, never had to. One of Drupal's core features was that you could build amazing things through WYSIWYG. But that idea seems to have quietly died? #sad
Comment #21
mbaynton@groovedork, thanks for sharing. I think it's fair to summarize the problems you encountered fell into two categories: the tooling provided to do an update was not simple and the update from an earlier version to 8.4 was disruptive. The scope of this issue is improving the update tooling so there's a thing just built into the site, and you don't need Acquia Dev Desktop or Drush or Composer. But no tooling will provide a non-disruptive update experience if the update path itself requires as much manual intervention / fixing as people are reporting with recent 8.x minor releases post-update, so fixing the tooling issue alone would basically just give your site owners a way to shoot themselves in the foot (look! I can update my site! Now it's borked!)
It's these reports that I believe really legitimize the other project I'm trying to get off the ground, iglue, which basically aims to allow you to stick with the Drupal 8 version you started with while keeping your site secure.
Comment #22
8thom commented@mbaynton was discussing this the other day, are you or anyone aware of an initiative to provide an LTS Drupal 8 release?
It could sit outside the normal 6 monthly release cycle and maybe catch up every 4th release (2yrs), whilst backporting any security issues.
Otherwise, we just need to get better at not introducing any BC breaks in minor releases..
Comment #34
quietone commentedThis work is now in #3319030: Drupal Core Roadmap for Package Manager and Update Manager.
Comment #37
xjmSaving credits for what began with a Hard Problems discussion that was one of the first steps toward the Autoupdates Initiative.