moditect / layrry

A Runner and API for Layered Java Applications
Apache License 2.0
335 stars 33 forks source link

Allow to run with remote layers.yml #37

Closed gunnarmorling closed 3 years ago

gunnarmorling commented 4 years ago

Allow --layers-config https://example.com/layers.yml.

gunnarmorling commented 4 years ago

@aalmiray, @hendrikebbers, this might be interesting for use cases around JavaFX and Web Start?

aalmiray commented 4 years ago

One question though, how would dynamic layers (plugins) work in this case? Currently Layrry assumes relative paths are linked to the basedir of the given config file.

gunnarmorling commented 4 years ago

Good question; one could think about installing plug-ins from remote repos, too. Triggered via an action in the application itself, e.g. like when you install a plug-in into VS.Code.

aalmiray commented 4 years ago

Right. We may be looking at the following combinations

LL = Local layers
RL = Remote layers
LP = Local plugins
RP = Remote plugins

LL | RL | LP | RP
x  |    | x  |
x  |    |    | x
x  |    | x  | x
   | x  | x  |
   | x  |    | x
   | x  | x  | x
aalmiray commented 4 years ago

The following may be used to detect if a parser supports the given URL

aalmiray commented 4 years ago

Good question; one could think about installing plug-ins from remote repos, too. Triggered via an action in the application itself, e.g. like when you install a plug-in into VS.Code.

This is another good use case for #39

brunoborges commented 4 years ago

This would potentially enable WebFX

aalmiray commented 4 years ago
LL = Local layers
RL = Remote layers
LP = Local plugins
RP = Remote plugins

LL | RL | LP | RP
x  |    | x  |
x  |    |    | x
x  |    | x  | x
   | x  | x  |
   | x  |    | x
   | x  | x  | x

Additional considerations based on the table shown above:

  1. LP with RL requires resolving directory paths with a base bath. Currently in RL that base path is dictated by the location of the layers file. We can't assert that with RL. We could use System.getProperty('user.dir'), we could also accept an extra configuration flag for setting the base path. Options:

    • with LL:
    • If --basedir is given, use it as base path.
    • Otherwise use the location of --layers-config as base path (current behavior).
    • with RL:
    • If --basedir is given, use it as base path.
    • Otherwise use System.getProperty('user.dir') as base path.
  2. RP require Layrry to watch over remote resources. I think this can be quite problematic. Perhaps switching from pull mode to push mode would be better to begin with. If so, Layrry requires an external notification that triggers dynamic plugin updates.

aalmiray commented 4 years ago

I think adding the following method to LayesrConfigLoader is the way to begin

static LayersConfig loadConfig(URL layersConfigFile)

This method will check the URL and download the resource to a temporary location (we could think of a cache option at a later point), then proceed to invoke the already existing loadConfig(Path layersConfigFile).

A few impl details:

aalmiray commented 4 years ago

Thinking in how remote plugins could be supported, application code has to reach into boot code (Layrry) to trigger a plugin refresh. What if Layrry were to open a socket to enabled this case, allowing a single command to pass through, i.e, "refresh"?

Pros:

Cons:

gunnarmorling commented 3 years ago

Done.