wildfly-extras / wildfly-jar-maven-plugin

WildFly Bootable JAR
https://docs.wildfly.org/bootablejar/
Apache License 2.0
56 stars 40 forks source link

Preconfigure Extension #352

Closed chrisruffalo closed 1 year ago

chrisruffalo commented 1 year ago

What this does:

What needs to be done:

Why this is useful: In some situations a bootable jar still needs to execute shell commands to finish configuration before the container can run but after the wildfly container is started.

Some examples:

jfdenise commented 1 year ago

@chrisruffalo , I am wandering if --cli-script option, that you can provide at bootable JAR boot time, would be not enough?

chrisruffalo commented 1 year ago

@jfdenise the specific need in this case is to be able to invoke the add-user command at runtime which would require the wildfly server to have been unpacked. i don't think I can do that with cli scripts alone. keystore/truststore management can be done before the server starts but including it as a package is helpful in my case.

jfdenise commented 1 year ago

As a note: I think that the add-user in future wildfly is going to be deprecated in favor of the elytron. For example: https://github.com/wildfly-extras/wildfly-jar-maven-plugin/blob/main/examples/scripts/add-user.cli

To come back to your case I am wandering if you could package this extension in your own jar, add it to the classpath when launching the bootable JAR and the extension would get discovered. You could package the extensions/postconfigure,sh directory and file at build time thanks to the extra-server-content-dirs option.

That could be a first step. Adding an example to Bootable JAR examples would be great with your use-case.

chrisruffalo commented 1 year ago

I didn't even think about adding it on the classpath! That's a lot easier than what I've been doing (trying to get it into the jar). I'm sure that having a way to launch arbitrary runtime extensions is something that people would be interested in though and an example is a great way to do that.

jfdenise commented 1 year ago

@chrisruffalo would you be ready to contribute an example? That would be great!

chrisruffalo commented 1 year ago

@jfdenise I will look into what that would take. Probably won't do this example but I'll try and find a way. You can close this MR I think.

jfdenise commented 1 year ago

Closing as we agreed that it could be done, at least for now, as an extension external to the Bootable JAR src code.