JBoss Community

Re: Thoughts on filesystem action driven hot deployment

created by Max Andersen in JBoss AS7 Development - View the full discussion

Thought I would spend part of my trainride home to outline what I and Brian talked/agreed upon at Devoxx:

 

The intent is to have a "safer" file deployment api via the use of marker files.
In case of a deployment named foo.war the following marker files will have meaning.

 

foo.war.dodeploy - trigger deploy of archive or exploded directory.
foo.war.donotdeploy - Marker for server to ignore foo.war (used to ensure partial deployments does not happen while copying)
foo.war - in case of archive (not exploded directory) it work as  foo.war.dodeploy if file hasn't changed since last scan/some grace  period.

foo.war.faileddeploy - ACK from server that deploy failed (content should contain info about reason for failure)

foo.war.isdeployed - ACK from server that foo.war.isdeployed.

 

There will be flag in server configuration (TBD where exactly) to
enable old style scanning for/reaction on descriptors, but will not be
enabled by default. This will allow existing tooling for pre-AS7 to work sensibly.

 

The deployment folder will have a README or similar explaining the above to spread the word on how this folder works.

 

...and that's it ;)

 

The following show it in us from a pure command line perspective to show the simplicity (and power) of the "File Deployment API".

 

For exploded deployments:

 

1. cp -r target/foo.war/ $AS7/deployment
2. touch $AS7/deployment/foo.war.dodeploy

 

AS will ignore the directory at step #1 but
step #2 will make it deploy foo.war on the next
scan.

 

If deploy is succesfully AS7 will do the following:

 

1. rm $AS7/deployment/foo.war.dodeploy
2. touch $AS7/deployment/foo.war.isdeployed

 

Meaning that you as user (or tool) can explicitly
control when deployment occurs and you get an ACK
from the server on succesfully deployment.

 

In case of error during deployment AS7 will do the following:

 

1. echo $DEPLOY_ERROR_INFO > $AS7/deployment/foo.war.faileddeploy (name TBD)
2. rm $AS7/deployment/foo.war.dodeploy

 

Where $DEPLOY_ERROR_INFO is what the server knows about the reason for deploy error.

 

For archived deployments:

 

For archived deployments the behavior/semantics is the same except
AS7 will automatically start deploying an archive once the file has not changed
in some grace period (i.e. 500 ms? )

 

The user can trigger redeploy by either doing touch foo.war or touch foo.war.dodeploy.

 

"Suspend deployment"

 

To handle the case of possible errors occurring while copying deployments (i.e. network connection error
or sudden crash) it is possible to tell the scanner to ignore an archive or exploded directory by doing:

 

1. touch $AS7/deployment/foo.war.donotdeploy

 

When user want it to be deployed he can simple remove the .donotdeploy and then touch foo.war if its an archive or
touch $AS7/deployment/foo.war.dodeploy in case of directory and archive.

 

Info:
We did not use .deploy, .deployed as markers since it could cause confusion in filebrowser that can cut off the ending.
We did not use dodeploy.foo.war since then it would not show up close to the deployment - if you want sorting by "status" sort by extension.
Important that whatever the deployment does theres should be zero delay for reosurces like .html/.xhtml thus shadow copying is probably out of the question; but at the same time need to reduce chance of jar locking on windows filesystems. TBD how and if it is still a problem these days on pre-AS7 deployments.

 

Questions:
Will subdirectories be allowed in /deployment for separation ? (don't think so - but good to document that you have to add multiple deployment roots)
If I rm foo.war.isdeployed what does that mean ? Should AS7 create it again ? ( I guess not..they are just transient markers)

Reply to this message by going to Community

Start a new discussion in JBoss AS7 Development at Community