<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<body link="#355491" alink="#4262a1" vlink="#355491" style="background: #e2e2e2; margin: 0; padding: 20px;">
<div>
        <table cellpadding="0" bgcolor="#FFFFFF" border="0" cellspacing="0" style="border: 1px solid #dadada; margin-bottom: 30px; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                <tbody>
                        <tr>
                                <td>
                                        <table border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF" style="border: solid 2px #ccc; background: #dadada; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                                                <tbody>
                                                        <tr>
                                                                <td bgcolor="#000000" valign="middle" height="58px" style="border-bottom: 1px solid #ccc; padding: 20px; -moz-border-radius-topleft: 3px; -moz-border-radius-topright: 3px; -webkit-border-top-right-radius: 5px; -webkit-border-top-left-radius: 5px;">
                                                                        <h1 style="color: #333333; font: bold 22px Arial, Helvetica, sans-serif; margin: 0; display: block !important;">
                                                                        <!-- To have a header image/logo replace the name below with your img tag -->
                                                                        <!-- Email clients will render the images when the message is read so any image -->
                                                                        <!-- must be made available on a public server, so that all recipients can load the image. -->
                                                                        <a href="http://community.jboss.org/index.jspa" style="text-decoration: none; color: #E1E1E1">JBoss Community</a></h1>
                                                                </td>
                                                        </tr>
                                                        <tr>
                                                                <td bgcolor="#FFFFFF" style="font: normal 12px Arial, Helvetica, sans-serif; color:#333333; padding: 20px; -moz-border-radius-bottomleft: 4px; -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 5px; -webkit-border-bottom-left-radius: 5px;"><h3 style="margin: 10px 0 5px; font-size: 17px; font-weight: normal;">
Re: Thoughts on filesystem action driven hot deployment
</h3>
<span style="margin-bottom: 10px;">
created by <a href="http://community.jboss.org/people/max.andersen%40jboss.com">Max Andersen</a> in <i>JBoss AS7 Development</i> - <a href="http://community.jboss.org/message/572083#572083">View the full discussion</a>
</span>
<hr style="margin: 20px 0; border: none; background-color: #dadada; height: 1px;">
<div class="jive-rendered-content"><p>Thought I would spend part of my trainride home to outline what I and Brian talked/agreed upon at Devoxx:</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>The intent is to have a "safer" file deployment api via the use of marker files.<br/>In case of a deployment named foo.war the following marker files will have meaning.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p><strong>foo.war.dodeploy</strong> - trigger deploy of archive or exploded directory.<br/><strong>foo.war.donotdeploy</strong> - Marker for server to ignore foo.war (used to ensure partial deployments does not happen while copying)<br/> <strong>foo.war</strong> - in case of archive (not exploded directory) it work as  foo.war.dodeploy if file hasn't changed since last scan/some grace  period.</p><p><strong>foo.war.faileddeploy</strong> - ACK from server that deploy failed (content should contain info about reason for failure)</p><p><strong>foo.war.isdeployed</strong> - ACK from server that foo.war.isdeployed.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>There will be flag in server configuration (TBD where exactly) to<br/>enable old style scanning for/reaction on descriptors, but will not be<br/>enabled by default. This will allow existing tooling for pre-AS7 to work sensibly.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>The deployment folder will have a README or similar explaining the above to spread the word on how this folder works.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>...and that's it <span> ;) </span></p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>The following show it in us from a pure command line perspective to show the simplicity (and power) of the "File Deployment API".</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>For exploded deployments:</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>1. cp -r target/foo.war/ $AS7/deployment<br/>2. touch $AS7/deployment/foo.war.dodeploy</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>AS will ignore the directory at step #1 but <br/>step #2 will make it deploy foo.war on the next<br/>scan.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>If deploy is succesfully AS7 will do the following:</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>1. rm $AS7/deployment/foo.war.dodeploy<br/>2. touch $AS7/deployment/foo.war.isdeployed</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>Meaning that you as user (or tool) can explicitly<br/>control when deployment occurs and you get an ACK<br/>from the server on succesfully deployment.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>In case of error during deployment AS7 will do the following:</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>1. echo $DEPLOY_ERROR_INFO > $AS7/deployment/foo.war.faileddeploy (name TBD)<br/>2. rm $AS7/deployment/foo.war.dodeploy</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>Where $DEPLOY_ERROR_INFO is what the server knows about the reason for deploy error.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>For archived deployments:</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>For archived deployments the behavior/semantics is the same except<br/>AS7 will automatically start deploying an archive once the file has not changed<br/>in some grace period (i.e. 500 ms? )</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>The user can trigger redeploy by either doing touch foo.war or touch foo.war.dodeploy.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>"Suspend deployment"</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>To handle the case of possible errors occurring while copying deployments (i.e. network connection error<br/>or sudden crash) it is possible to tell the scanner to ignore an archive or exploded directory by doing:</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>1. touch $AS7/deployment/foo.war.donotdeploy</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>When user want it to be deployed he can simple remove the .donotdeploy and then touch foo.war if its an archive or<br/>touch $AS7/deployment/foo.war.dodeploy in case of directory and archive.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>Info:<br/>We did not use .deploy, .deployed as markers since it could cause confusion in filebrowser that can cut off the ending.<br/>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.<br/>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.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>Questions:<br/>Will subdirectories be allowed in /deployment for separation ? (don't think so - but good to document that you have to add multiple deployment roots)<br/>If I rm foo.war.isdeployed what does that mean ? Should AS7 create it again ? ( I guess not..they are just transient markers)</p></div>
<div style="background-color: #f4f4f4; padding: 10px; margin-top: 20px;">
<p style="margin: 0;">Reply to this message by <a href="http://community.jboss.org/message/572083#572083">going to Community</a></p>
        <p style="margin: 0;">Start a new discussion in JBoss AS7 Development at <a href="http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2225">Community</a></p>
</div></td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</div>
</body>
</html>