[jboss-as7-dev] Overriding Deployment Descriptors

Brian Stansberry brian.stansberry at redhat.com
Wed Apr 4 13:36:13 EDT 2012


On 4/4/12 11:06 AM, ssilvert at redhat.com wrote:
> The tools can handle whatever you want to do, but having these kinds of
> "peer" relationships puts a lot more burden on both tools and operation
> handlers.  Stuart's "approach #1" having a peer (you mean sibling?)

Yes.

> of
> the deployment exposes a weakness in the structure that I've seen other
> places.
>
> As I understand it, the peer would have a simple string that associates
> the override to the deployment.  That's a very brittle association.
>
> Instead, the management model needs the concept of a reference type that
> actually points to the resource in question.  That way, a tool doesn't
> need any magic knowledge to know that "foo.war" really means
> "/deployment=foo.war".   Also, with a simple string, if you remove the
> deployment there is no way to know that this deployment also has
> overrides associated with it.  The only way to know this is to have
> special logic in the remove operation handler.  But with a reference
> type this sort of thing can be taken care of automatically.
>

You're describing a general issue, but I just want to comment a bit on 
the specific example, since the thread is about these overrides.

With Stuart's "approach #1" removing the deployment does not create any 
need to remove the override. The override remains there available for 
use if the user ever re-adds the deployment. That's a pro and a con; 
potential litter left around, but the user and can add/remove the 
deployment (e.g. via the scanner) at will.

This is something of a different usage of references from elsewhere in 
the model though, which I see now is one reason why I was a bit 
uncomfortable about it. Elsewhere, if resource A needs resource B, it 
has a ref to B. Here we have B referring to A.

The issue with dependencies that we'd need to sort out would be if 
test.ear was deployed and then someone did:

/dd-override=my-override:remove

Does that force reload-required? Automatically trigger redeploy?

> Here is an example of where a reference type is needed today.  Look at
> /subsystem=logging/async-handler=*/:read-resource-description.  The last
> attribute is "subhandlers":
>    "subhandlers" =>  {
>                      "type" =>  LIST,
>                      "description" =>  "The Handlers associated with this
> async handler.",
>                      "expressions-allowed" =>  false,
>                      "nillable" =>  true,
>                      "value-type" =>  {"handler" =>  {
>                          "type" =>  STRING,
>                          "description" =>  "The subhandler associated with
> this async handler.",
>                          "expressions-allowed" =>  false,
>                          "nillable" =>  true,
>                          "min-length" =>  1L,
>                          "max-length" =>  2147483647L
>                      }},
>                      "access-type" =>  "read-write",
>                      "storage" =>  "configuration",
>                      "restart-required" =>  "no-services"
>                  }
>
> The attribute is just a list of strings, but they are really references
> to real handlers.  So instead of:
> "value-type" =>  {"handler" =>  {
>                          "type" =>  STRING,
>
> you would have something like "-->" that means "reference":
>
> "value-type" =>  {"handler" =>  {
>                          "type" =>
> -->/subsystem=logging/custom-handler=* ||
> -->//subsystem=logging/file-handler=*,
>

I think this should be a separate piece of metadata. The "type" of the 
attribute is still a STRING -- i.e. the user needs to provide a string 
name. We could force users to provide an address instead of a name, but 
that's an incompatible API change. So this reference stuff would need to 
be additional metadata describing what a string means.

I can definitely see how this would be useful though.

> Now a tool can let the user choose subhandlers by finding all the
> instances of custom-handler and file-handler.  It then presents a pick
> list of the handlers it found.  The tool doesn't need any special
> knowledge about handlers.  It just knows how the list is defined and
> acts accordingly.  All the UI logic can be generated from the resource
> description.
>
> And when you go to delete a handler, the management model will know that
> an async handler has subhandler references pointing to it.  So, it thows
> an exception.
>

That's not the case, as the referent does not know what all refers to 
it. For example, there's no way socket-binding=* can know from its own 
static metadata what all the other resources are that might refer to a 
socket-binding. Some custom subsystem yet to be written by an end user 
may refer to it. The server itself needs to track that at runtime.

> On 4/4/2012 10:41 AM, Brian Stansberry wrote:
>> Customer requested feature is ability to externalize a file from a
>> deployment archive and have it be an addition to the files in the
>> archive or to override an existing file. Use cases:
>>
>> 1) Production: can't crack the deployment archive for policy reasons,
>> but need to change some config. So they add an override deployment
>> descriptor. This AIUI is the customer requested use case.
>>
>> 2) QE: override the production config to make some settings match the QE
>> environment.
>>
>> 3) Dev: same as QE, but to match the dev environment.
>>
>> The original idea we had for this can be seen in the structure of a
>> deployment=foo.war resource in the management API. It has a "content"
>> attribute of type LIST. The LIST was to allow multiple pieces of
>> content, the first being the archive, the rest being overrides.  That's
>> "approach 2)" in Stuart's original email in this thread.
>>
>> The new proposed approach (Stuart's "1)") is to have an entire new
>> resource type, peer to deployment=foo.war, called dd-override=x. That
>> resource would include attribute deployment=foo.war used to associate
>> the override with a particular deployment.
>>
>> Both cases, the override descriptor would need to be uploaded to the
>> server and stored in the data/contents dir, just like a deployment. I
>>
>> Either way, the user would need to use some sort of tooling to do the
>> upload and associate the override descriptor with a deployment.
>>
>> Stuart's approach 1) is more deployment-scanner friendly. The user does
>> whatever to get the override uploaded and registered. The scanner
>> uploads the archive and tells the server to deploy it like it does now,
>> and doesn't need to know anything about overrides. With approach 2) the
>> scanner really can't handle it; it has no way to know two separate files
>> it finds in the deployments/ dir are associated with each other.
>>
>> What I'm looking for is some perspective on how JBoss Tools would deal
>> with this kind of feature.
>>
>> On 4/4/12 8:24 AM, Max Rydahl Andersen wrote:
>>> Hi brian,
>>>
>>>> Max, any thoughts on this subject? I think a tooling perspective is critical here.
>>> I'm trying to decipher the real question but seems i'm missing some context ;)
>>>
>>> Care to give a summary/hint ?
>>>
>>> /max
>>>
>>>> On 3/29/12 6:50 AM, Emanuel Muckenhuber wrote:
>>>>> On 03/29/2012 05:12 AM, Stuart Douglas wrote:
>>>>>> On 28/03/2012, at 5:48 AM, Emanuel Muckenhuber wrote:
>>>>>>> The part i am trying to figure out is that we basically would have 2
>>>>>>> things doing the same. Another issue people are complaining about is
>>>>>>> that we don't support symlinks in .war deployments. One of the easiest
>>>>>>> ways to solve this would be to just mount a local file system path.
>>>>>>> Where i am not sure if moving this to the dd-overrides makes more sense.
>>>>>>> Hopefully i do remember correctly that we support VFS in our web
>>>>>>> integration :)
>>>>>>>
>>>>>>> I think the dd-override sounds like less work in the beginning, but if
>>>>>>> you include invalidation of overrides i am not sure if that is also true
>>>>>>> for all the tooling. The deployment-scanner seems to be an edge case in
>>>>>>> general, so perhaps we it can just adapt (be smarter) once we have some
>>>>>>> other workflows.
>>>>>>>
>>>>>> I don't know if invalidation of the overrides is really that much of a problem. If you have to specify the overrides at deployment time then you need to make sure your environment is setup so that you will always provide that override file whenever you deploy, which means that for developers they would need tooling support, and for production they would need to have their deployment scripts setup to make sure that the override is always deployed with the deployment. Both of these use cases will still work with dd-override (i.e. you can just have tools or scripts to modify it every time before deployment).
>>>>>>
>>>>> Hmm, redeploying works through the :replace operation, which should
>>>>> allow you to replace a single content-item, but preserve exiting ones.
>>>>> So you would also have to provide it only once.
>>>>>
>>>>> But yeah, once you call :remove it would also invalidate all the
>>>>> overrides. However the lifecycle seems more straightforward and there is
>>>>> the option that you just disable the deployment as well.
>>>>>
>>>>> I do see that this does not work that well for the deployment-scanner,
>>>>> but then there is no deployment-scanner in the domain. So for me that is
>>>>> more an issue of the scanner and should perhaps better be solved there.
>>>>>
>>>>> Emanuel
>>>>>
>>>>>> If on the other hand these descriptors only change infrequent, then dd-override has a major advantage, in that it can just be setup once and then left alone.
>>>>>>
>>>>>> Stuart
>>>>>>
>>>>>>
>>>>>>> On 03/27/2012 08:04 PM, Brian Stansberry wrote:
>>>>>>>> It's not immediately critical. But a little voice inside my ear tells me
>>>>>>>> we'll be *strongly* pressured to support it at some point. People love
>>>>>>>> the deployment scanner. And I think once people get used to being able
>>>>>>>> to have override descriptors they will love that as well.
>>>>>>>>
>>>>>>>> Override descriptors are very nice for keeping a base deployment but
>>>>>>>> adapting it for different environments. I'd thought of it as more of a
>>>>>>>> production thing (a workaround to a corporate policy that says a jar
>>>>>>>> can't be cracked open and change) but David convinced me it's more of a
>>>>>>>> developer or staging thing (override the production settings with
>>>>>>>> dev-workstation-specific settings). And once you are talking developers,
>>>>>>>> you are also talking deployment scanner.
>>>>>>>>
>>>>>>>> A big question I'd like to see talked through on this thread is how best
>>>>>>>> to do tooling around this (including CLI and web console.) What's
>>>>>>>> easiest for the user, in common workflows?
>>>>>>>>
>>>>>>>> In option 1, the dd-override is a separate resource from the deployment.
>>>>>>>> That means it can be independently controlled. Good and bad there. Good,
>>>>>>>> it can be added once and then left alone while the war, whatever is
>>>>>>>> tweaked and redeployed many times. Bad, it's a separate thing.
>>>>>>>>
>>>>>>>> Conversely, with 2, the content items are part of a list attribute of
>>>>>>>> the deployment resource. The good and bad points are the opposite of 1.
>>>>>>>>
>>>>>>>> On 3/27/12 12:47 PM, Emanuel Muckenhuber wrote:
>>>>>>>>> Hmm, so we really have to support the deployment-scanner use case? I
>>>>>>>>> mean beside some API/address differences - the (not implemented)
>>>>>>>>> deployment content thing is basically doing the same. Just wondering if
>>>>>>>>> i missed something obvious?
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> On 03/27/2012 03:55 PM, Brian Stansberry wrote:
>>>>>>>>>> On 3/27/12 12:34 AM, Stuart Douglas wrote:
>>>>>>>>>>> We have had a few requests for the ability to override deployment descriptors without having to open up a deployment archive and manually change the descriptor. I think there are two different approach that we can use to accomplish this, and I am was wondering what other people thought.
>>>>>>>>>>>
>>>>>>>>>>> 1) Allow the user to specify alternate deployment descriptors as part of the deployment process
>>>>>>>>>>>
>>>>>>>>>>> At deployment time the user would be able to select specific deployment descriptors to override. I don't really like this approach, as it means that this information must also be provided on every re-deployment. It is also not really compatible with the deployment scanner, and would require changes to every client that does deployment to properly support it.
>>>>>>>>>>>
>>>>>>>>>>> 2) Allow the user to specify deployment descriptor overrides before a deployment takes places. These descriptors would be stored in the content repository, and the corresponding information in the model. When a deployment is performed that matches the deployment name in the model the deployment descriptors from the content repository are merged into the deployment.
>>>>>>>>>>>
>>>>>>>>>>> e.g.   to add the descriptor you would do something like:
>>>>>>>>>>>
>>>>>>>>>>> /dd-override:my-deployment-descriptor:add(deployment="test.ear", file="test.jar/META-INF/ejb-jar.xml", content=…)
>>>>>>>>>>>
>>>>>>>>>>> or for domain mode
>>>>>>>>>>>
>>>>>>>>>>> /server-group=foo/dd-override:my-deployment-descriptor:add(deployment="test.ear", file="test.jar/META-INF/ejb-jar.xml", content=…)
>>>>>>>>>>>
>>>>>>>>>> For domain mode, this should be basically a parallel to the existing
>>>>>>>>>> deployment=* handling:
>>>>>>>>>>
>>>>>>>>>> a) The override is a top level resource, adding an item to the
>>>>>>>>>> "pallette" that is usable in any server-group:
>>>>>>>>>>
>>>>>>>>>> /dd-override=my-deployment-descriptor:add(deployment="test.ear",
>>>>>>>>>> file="test.jar/META-INF/ejb-jar.xml", content=…)
>>>>>>>>>>
>>>>>>>>>> b) The server-group part is just a mapping that says "use this from the
>>>>>>>>>> pallette:
>>>>>>>>>>
>>>>>>>>>> /server-group=foo/dd-override=my-deployment-descriptor:add
>>>>>>>>>>
>>>>>>>>>> Actually, this last bit is probably unnecessary, since the HC can figure
>>>>>>>>>> out what dd-overrides are required from the deployment="test.ear"
>>>>>>>>>> attribute on the dd-override=my-deployment-descriptor resource.
>>>>>>>>>>
>>>>>>>>>>> Then when test.ear is deployed the contents if the overridden deployment descriptor will be override test.jar/META-INF/ejb-jar.xml.
>>>>>>>>>>>
>>>>>>>>>>> 2) is the approach that I prefer, as I think it gives the most flexibility.
>>>>>>>>>>>
>>>>>>>>>>> What does everyone think?
>>>>>>>>>>>
>>>>>>>>>>> Stuart
>>>>>>>>>>> _______________________________________________
>>>>>>>>>>> jboss-as7-dev mailing list
>>>>>>>>>>> jboss-as7-dev at lists.jboss.org
>>>>>>>>>>> https://lists.jboss.org/mailman/listinfo/jboss-as7-dev
>>>>>>>>>>
>>>>>>>>> _______________________________________________
>>>>>>>>> jboss-as7-dev mailing list
>>>>>>>>> jboss-as7-dev at lists.jboss.org
>>>>>>>>> https://lists.jboss.org/mailman/listinfo/jboss-as7-dev
>>>>>>>>
>>>>>>> _______________________________________________
>>>>>>> jboss-as7-dev mailing list
>>>>>>> jboss-as7-dev at lists.jboss.org
>>>>>>> https://lists.jboss.org/mailman/listinfo/jboss-as7-dev
>>>>> _______________________________________________
>>>>> jboss-as7-dev mailing list
>>>>> jboss-as7-dev at lists.jboss.org
>>>>> https://lists.jboss.org/mailman/listinfo/jboss-as7-dev
>>>>
>>>> --
>>>> Brian Stansberry
>>>> Principal Software Engineer
>>>> JBoss by Red Hat
>>
>
> _______________________________________________
> jboss-as7-dev mailing list
> jboss-as7-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/jboss-as7-dev


-- 
Brian Stansberry
Principal Software Engineer
JBoss by Red Hat


More information about the jboss-as7-dev mailing list