Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add configuration to allow deferring the initial Deployment until after Server is started #10667

Merged
merged 14 commits into from
Oct 17, 2023

Conversation

joakime
Copy link
Contributor

@joakime joakime commented Oct 4, 2023

Introduce a WebAppProvider (and ScanningAppProvider) configuration .setDeferInitialScan(boolean) (defaults to false), which controls the initial deployment of webapps.

  • true = to have initial scan deferred until the Server component has reached it's STARTED state.
  • false = (default) to have initial scan occur as normal on ScanningAppProvider startup.

Notes:
Having true set will not fail the Server startup.
Having false be default allows for failed deployments to also fail the server start.

Fixes #10669

@joakime
Copy link
Contributor Author

joakime commented Oct 4, 2023

This needs unit tests still.

@joakime joakime added Enhancement Sponsored This issue affects a user with a commercial support agreement labels Oct 4, 2023
Signed-off-by: Joakim Erdfelt <[email protected]>
Signed-off-by: Joakim Erdfelt <[email protected]>
@joakime joakime changed the title Alternate approach for delayed deploy scanning Add configuration to delay Deployment until after Server is started Oct 4, 2023
@joakime joakime self-assigned this Oct 4, 2023
@joakime joakime added this to the 10.0.x milestone Oct 4, 2023
@joakime joakime marked this pull request as ready for review October 4, 2023 22:44
Copy link
Contributor

@gregw gregw left a comment

Choose a reason for hiding this comment

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

I think this approach achieve the goal.... but it might be simpler to make a change to the scanner itself. Specifically reportExisting is not sufficient, I think the doStart of the scanner could be modified to look like:

        if (_scanInStart)
        {
            if (_reportExisting)
            {
                // if files exist at startup, report them
                scan();
                scan(); // scan twice so files reported as stable
            }
            else
            {
                //just register the list of existing files and only report changes
                _prevScan = scanFiles();
            }
        }

That way you could add the scanner normally in the AppProvider and the listener would only need to do a nudge.

@gregw
Copy link
Contributor

gregw commented Oct 4, 2023

Perhaps this approach is best for this release cycle and we can consider improving the implementation by changing the scanner in the next release cycle. @janbartel thoughts?

@joakime
Copy link
Contributor Author

joakime commented Oct 4, 2023

@gregw doh! I already made the change to the Scanner in this branch / PR.
I'm comfortable with delaying this until 10.0.18 (note: 10.0.17 is the release occuring this next week).
But, i'm only comfortable with that change if we can get a quick release of 10.0.18 after this PR has been vetted more.

@joakime joakime requested a review from gregw October 4, 2023 23:46
Signed-off-by: Joakim Erdfelt <[email protected]>
Signed-off-by: Joakim Erdfelt <[email protected]>
@joakime joakime changed the title Add configuration to delay Deployment until after Server is started Add configuration to allow deferring the initial Deployment until after Server is started Oct 5, 2023
@joakime joakime requested a review from janbartel October 5, 2023 20:19
Signed-off-by: Joakim Erdfelt <[email protected]>
gregw
gregw previously approved these changes Oct 5, 2023
Copy link
Contributor

@gregw gregw left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@janbartel janbartel left a comment

Choose a reason for hiding this comment

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

Some name changes to better indicate what is going on: we're not deferring the initial scan, we're deferring starting the whole scan cycle. Also need to remove extra call (currently to startup()) in doStart().

@joakime
Copy link
Contributor Author

joakime commented Oct 6, 2023

Some name changes to better indicate what is going on: we're not deferring the initial scan, we're deferring starting the whole scan cycle. Also need to remove extra call (currently to startup()) in doStart().

We are deferring the initial scan.
The startup() method performs the initial scan AND optionally schedules a scan task (on the scheduler, but only if the scan interval makes sense).

The activateScan() naming is too vague, esp considering we already have a .scan() method.

We use the term "initial scan" in other javadoc currently (like setReportExistingFilesOnStartup), so using it for new methods and techniques doesn't seem off or unusual.

@joakime
Copy link
Contributor Author

joakime commented Oct 6, 2023

@janbartel also, something to think about, what would you call the ScanningAppProvider.setDeferInitialScan(boolean) method in this new naming?
Or would you leave that one alone?

Signed-off-by: Joakim Erdfelt <[email protected]>
@joakime
Copy link
Contributor Author

joakime commented Oct 6, 2023

@janbartel I committed a pass at better naming.
Most of the changes are in Scanner, but the new naming in ScanningAppProvider needs a review too.

Copy link
Contributor

@janbartel janbartel left a comment

Choose a reason for hiding this comment

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

I don't think I really love any of the possible naming changes, even ones I suggested :), so happy to go with the majority decision there. But the call to manually start the scheduler is something that I really want removed.

Signed-off-by: Joakim Erdfelt <[email protected]>
@joakime
Copy link
Contributor Author

joakime commented Oct 13, 2023

@gregw @janbartel The manual scheduler start is removed in this version.

gregw
gregw previously approved these changes Oct 15, 2023
Copy link
Contributor

@gregw gregw left a comment

Choose a reason for hiding this comment

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

Conditional approval. You need to fix a few javadoc comments.

Copy link
Contributor

@janbartel janbartel left a comment

Choose a reason for hiding this comment

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

Couple of javadoc fixes, and it would be good if the test could be more specific that the webapp is not actually deployed at the point in time the DeploymentManager/Scanner starts.

@joakime
Copy link
Contributor Author

joakime commented Oct 16, 2023

@janbartel @gregw I went ahead and applied all of the javadoc changes requested, along with improvements on testDelayedDeploy() to ensure the order of events is sane. (started components and initial scans)

@joakime joakime merged commit 909e99e into jetty-10.0.x Oct 17, 2023
2 checks passed
@joakime joakime deleted the fix/10.0.x/delay-initial-deploy-scan branch October 26, 2023 15:44
chadlwilson added a commit to chadlwilson/gocd that referenced this pull request Oct 31, 2023
Jetty 10.0.18 accidentally added dependencies on `awaitility` and `hamcrest` in `jetty-deploy` via jetty/jetty.project#10667

This workaround can be removed once jetty/jetty.project#10812 is addressed.
Comment on lines +62 to +65
<dependency>
<groupId>org.awaitility</groupId>
<artifactId>awaitility</artifactId>
</dependency>
Copy link
Contributor

Choose a reason for hiding this comment

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

Oops, wrong missing <scope>test</scope>!

Submitted a PR to correct at #10813

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement Sponsored This issue affects a user with a commercial support agreement
Projects
No open projects
Status: ✅ Done
Development

Successfully merging this pull request may close these issues.

Provide ability to defer initial deployment of webapps until after Server has started
4 participants