6 Replies Latest reply on Oct 3, 2005 8:22 AM by mr.shiny

    Find deploy date from web application

    mr.shiny

      Hello,

      We do frequent deployments of our application, sometimes two or three times per week, and it is very useful for us to know when a particular build of our application is deployed on our production servers. I would like to display, on an admin page that's part of the application itself, the deploy-date. Note that this isn't when the server was started since we restart more often than we deploy. Is it possible to do this?

      One idea I had was to get the timestamp of the deployed .ear file, since that timestamp should be the time the ear was copied into the deploy directory. However that is problematic since we have several apps with different ear names, and our deploy directories vary from app to app and server to server. So I'd like it if the app could just query JBoss and ask it 'when was I deployed' or 'where is the deployable that I am part of?'. For the latter question my next step would be to open that file on the disk and get its last-modified-time.

      Does what I'm asking make sense? Is there a better way? Or am I just on crack?

        • 1. Re: Find deploy date from web application
          panuv

          One approach is to have a JSP-page that reads and displays the build-number (incl. possibly a timestamp) from a text-file, which is created by the build/deploy-script.


          -panuv

          • 2. Re: Find deploy date from web application
            mr.shiny

             

            "panuv" wrote:
            One approach is to have a JSP-page that reads and displays the build-number (incl. possibly a timestamp) from a text-file, which is created by the build/deploy-script.


            -panuv



            Yes, my application does this already, but sometimes we need to roll-back a build, or a deployment may be delayed, etc. so the build date is not the same as the deploy date. Currently we write the build number and date into the web.xml but once the ear is made the build process is done and deployment is done at a later time (and the same ear will be deployed to multiple servers, i.e. the test servers and multiple production servers). What I need is the date/time that that ear was put into the server's deploy directory.

            • 3. Re: Find deploy date from web application
              panuv

              Note that if you restart JBOSS, it would need to redeploy the ear, and I guess it would need keep track of if the exact same ear eas already previously deployed. You might need to compile JBOSS from source & modify the source to record all deployments with time-stamps.

              More simply consider doing all your deploying (not just 'building') with a script that writes all deployments in a file, or a database.

              -panuv



              • 4. Re: Find deploy date from web application
                mr.shiny

                 

                "panuv" wrote:
                Note that if you restart JBOSS, it would need to redeploy the ear, and I guess it would need keep track of if the exact same ear eas already previously deployed. You might need to compile JBOSS from source & modify the source to record all deployments with time-stamps.


                Well, yes, technically JBoss deploys everything when it starts. Which is why I was planning on using the timestamp of the ear itself as the deployment date; that timestamp is updated when the file is written, or, if the ear is expanded in the deploy/ directory, when the files in that directory are written. So if there is some API in JBoss that i can call from a web-app to ask JBoss "what is the URL of the ear that I am deployed in" then I can just open the file and get the timestamp. My app doesn't need to work on any other app-server at this time so an app-server specific feature is just fine.

                "panuv" wrote:
                More simply consider doing all your deploying (not just 'building') with a script that writes all deployments in a file, or a database.

                Yeah, I thought of that but I don't control the deployment script so I'd like to leave that solution as a last resort.

                Thanks,

                mr.shiny





                • 5. Re: Find deploy date from web application
                  raja05

                  You can possibly use JMX. I dont have a running site right now, but it looks like MainDeployer(with a JMX name of jboss.system:service=MainDeployer) has a method called getDeployment(URL deployURL) and returns a DeploymentInfo object. DeploymentInfo has information about when the deployment was done last in addition to a lot of other properties. Look up the source or the API for more on DeploymentInfo

                  • 6. Re: Find deploy date from web application
                    mr.shiny

                     

                    "raja05" wrote:
                    You can possibly use JMX. I dont have a running site right now, but it looks like MainDeployer(with a JMX name of jboss.system:service=MainDeployer) has a method called getDeployment(URL deployURL) and returns a DeploymentInfo object. DeploymentInfo has information about when the deployment was done last in addition to a lot of other properties. Look up the source or the API for more on DeploymentInfo


                    But then I'd still need to know the URL of the app that my code is deployed in; also wouldn't JBoss just report the last time it deployed the app, which is different from when I put the app into the deploy directory? The thing is, we restart our application servers more often than we deploy applicaitons, and I need to know when the application was physically deployed as opposed to when JBoss loaded the code into the JVM. But thanks for the suggestion anyway, I'll keep the JMX stuff in mind if there is anything else I need to look up.

                    -mr.shiny