jetty / jetty.project

Eclipse Jetty® - Web Container & Clients - supports HTTP/2, HTTP/1.1, HTTP/1.0, websocket, servlets, and more
https://eclipse.dev/jetty
Other
3.86k stars 1.91k forks source link

Review DeploymentManager and ScanningAppProvider #10437

Open sbordet opened 1 year ago

sbordet commented 1 year ago

Jetty version(s) 12

Description Now that we have multiple environments, each ScanningAppProvider scans the webapps/ directory, and tries to deploy what's in there.

This is not optimal: we should have one scanner only, and offer what's been scanned to the environment deployers to deploy. In this way we can detect if there are applications that do not have a deployer and won't be deployed.

We don't want to end up in situations such as:

2023-08-30 07:50:38.847:INFO :oejdp.ScanningAppProvider:main: Deployment monitor core in [file:///srv/www/websites/webapps/] at intervals 0s
2023-08-30 07:50:38.862:WARN :oejdp.ScanningAppProvider:main: class org.eclipse.jetty.deploy.providers.ContextProvider@781f10f2[file:///srv/www/websites/webapps/] no environment for App@3e14c16d[ee10,null,/srv/www/websites/webapps/download.cometd.org.xml], ignoring
2023-08-30 07:50:38.870:INFO :oejdp.ScanningAppProvider:main: Deployment monitor ee10 in [file:///srv/www/websites/webapps/] at intervals 0s
2023-08-30 07:50:38.874:INFO :oejd.DeploymentManager:main: addApp: App@1ae67cad[ee10,null,/srv/www/websites/webapps/download.cometd.org.xml]
2023-08-30 07:50:39.242:INFO :oejsh.ContextHandler:main: Started oejsh.ContextHandler@f9b7332{download.cometd.org,/,b=file:///var/www/download.cometd.org/,a=AVAILABLE,vh=[download.cometd.org],h=oejsh.ResourceHandler@6bab2585{STARTED}}

The logs above show that the core deployer started, scanned, found an app with explicit *.properties file indicating the ee10 environment, and emitting a warning that it cannot deploy it. But then, the ee10 deployer starts, scans (again), finds the app, and deploys it.

If the app was an ee9 app, neither core nor ee10 would have been able to deploy it, with either a double warning, or no warning (if the warning message is demoted to DEBUG level).

sbordet commented 1 year ago

Also, currently the scanner reports the entries to deploy in random order (by using a HashMap.keySet()).

Would be great if this could be normalized to alphabetical order, so that it would be possible to rely on a consistent deployment order for those cases where webapp B depends on webapp A.

joakime commented 8 months ago

See also tasks in #5748