Skip to content

Add dedicated API for apps' bootstrapping process - #20865

Merged
ChristophWurst merged 6 commits into
masterfrom
enhancement/app-bootstrapping
Jun 17, 2020
Merged

Add dedicated API for apps' bootstrapping process#20865
ChristophWurst merged 6 commits into
masterfrom
enhancement/app-bootstrapping

Conversation

@ChristophWurst

@ChristophWurstChristophWurst commented May 7, 2020

Copy link
Copy Markdown
Member

Fixes#20573

Possible registrations (ticket=implemented there, rest follows in other PRs)

Possible ideas for the register or boot context

  • Version of Nextcloud (e.g. to only call registration on things that are really available)
  • CLI or web request flag

@ChristophWurstChristophWurst added 2. developing Work in progress technical debt 🧱 🤔🚀 labels May 7, 2020
@ChristophWurstChristophWurst added this to the Nextcloud 20 milestone May 7, 2020
@ChristophWurst
ChristophWurst marked this pull request as draft May 7, 2020 19:13
Comment threadapps/admin_audit/lib/AppInfo/Application.php
Comment threadlib/private/AppFramework/Bootstrap/Coordinator.php Outdated
Comment threadlib/public/AppFramework/Bootstrap/IRegistrationContext.php
@ChristophWurst

Copy link
Copy Markdown
MemberAuthor

apps/comments/lib/AppInfo/Application.php is the new show case example for the new registration style 🕺

@ChristophWurst
ChristophWurstforce-pushed the enhancement/app-bootstrapping branch 2 times, most recently from ee55e01 to 8c54e4aCompareJune 8, 2020 17:31
@ChristophWurstChristophWurst mentioned this pull request Jun 9, 2020
@juliusknorrjuliusknorr mentioned this pull request Jun 9, 2020
7 tasks
@ChristophWurst
ChristophWurstforce-pushed the enhancement/app-bootstrapping branch from 8587cc3 to 40153caCompareJune 9, 2020 18:02
}

/**
* Now that all register methods have been called, we can delegate the registrations

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we don't have to do this here. we could actually either wait until right before the first boot method invocation or when the individual services are used

Comment threadapps/comments/lib/AppInfo/Application.php
@rullzer

Copy link
Copy Markdown
Member

I like it.
I guess we should merge this sooner rather than later. I'm still not 100% sure how to handle disabled apps for users.

But I gues we should start to do that differently anyways. And revamp that. So that it actually works as expected.

@ChristophWurst
ChristophWurstforce-pushed the enhancement/app-bootstrapping branch 3 times, most recently from 285837e to 1359f2cCompareJune 16, 2020 12:17
@ChristophWurstChristophWurst added 3. to review Waiting for reviews and removed 2. developing Work in progress labels Jun 16, 2020
@ChristophWurst
ChristophWurst marked this pull request as ready for review June 16, 2020 12:35

@rullzerrullzer left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀 lets do this!

@ChristophWurstChristophWurst added the pending documentation This pull request needs an associated documentation update label Jun 16, 2020
@kesselb

Copy link
Copy Markdown
Contributor

Looks good to me 🚀

  • Commands

Good idea. I have a suggestion for the command implementation: I looked at https://symfony.com/doc/current/console/lazy_commands.html to make occ faster. Eventually loading the apps is the expensive step and not to create all those command objects itself but it's still a good thing to do (because if one calls occ maintenance:repair we only need the RepairCommand object).

Here is a POC https://github.com/nextcloud/server/compare/enh/occ-lazy-load?expand=1. The basic requirement is that the name of the command is known before creating the object. Please consider to make the command name a required parameter for the command registration. That makes migration to lazy commands much easier and ensures that apps using the new way to register a command do it right.

@ChristophWurst

Copy link
Copy Markdown
MemberAuthor

Makes sense, @kesselb. What I would also like to experiment with is proxy services instead of getting the real thing through constructor injection. Because right now you always build this huge tree of instances, when you'll most likely only every use some branches of that. Pimple, however, does not support it right now.

The commands are only slowing down occ operations, right? I hope we don't load them for web requests.

Looks good to me rocket

Mind pressing the approve button? :P

@@ -3,12 +3,9 @@
declare(strict_types=1);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gotta love this "git rename" ....

@nickvergessennickvergessen left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, didn't check to deeply nor transition over an app. But let's do it early.

@kesselb

Copy link
Copy Markdown
Contributor

I would like to withdraw my suggestion for commands. It's good to have all the commands definitions in appinfo.xml. If we add a attribute like <command name="mail:account:diagnose">OCA\Mail\Command\DiagnoseAccount</command> we are able to load only the required app for a occ command similar to what the router does with routes.php.

The commands are only slowing down occ operations, right?

Yes

I hope we don't load them for web requests.

No

Actually creating the command instances is not the expensive task. Loading all apps is the expensive one.

Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
@ChristophWurst
ChristophWurstforce-pushed the enhancement/app-bootstrapping branch from 1359f2c to a2c8bfaCompareJune 17, 2020 07:22
@ChristophWurstChristophWurst added 4. to release Ready to be released and/or waiting for tests to finish and removed 3. to review Waiting for reviews labels Jun 17, 2020
@ChristophWurst
ChristophWurst merged commit c1183fa into masterJun 17, 2020
@ChristophWurst
ChristophWurst deleted the enhancement/app-bootstrapping branch June 17, 2020 08:47
@ChristophWurstChristophWurst removed the pending documentation This pull request needs an associated documentation update label Nov 14, 2022
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

4. to releaseReady to be released and/or waiting for tests to finishtechnical debt🧱 🤔🚀

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Organizing the app bootstrapping code

5 participants

@ChristophWurst@rullzer@kesselb@nickvergessen@MorrisJobke