Automate Glassfish Application Deployment

glassfishjavalinux

I'm writing a bash script that pulls a specific copy of our java web application from the svn repository and builds it.

I would like that script to be able to deploy the generated .war file on the glassfish server.

The script and glassfish server are on the same machine. The script has access to the glassfish folder containing the "asadmin" utility.

The problem: asadmin asks for a password (I can specify the user name with a "–user" parameter). I'm not sure if it's possible to specify the password through a "–password" parameter, but for obvious reasons, that's not an option on a production server.

Is there some way to automate this deployment process anyway? Setting an empty password for the admin might be an option, but I can only accept it if it is possible to disable the "admin" user in the control panel (accessible by multiple users).

I also thought of simply copying the generated classes to the glassfish/domains/ourdomain/applications/ourapplication/ folder. However, I doubt this is the correct way to perform a deployment. Moreover, the application does not get reloaded that way, and users are still seeing an old version of the application!

Thank you for the suggestions!

Best Answer

While crawling blogs trying to find out how to store the passwords in a keystore and load them automatically, I eventually discovered the use of the glassfish/domains/ourdomain/autodeploy/ directory:

Turns out you can simply copy the .war file to that folder, and it'll be picked up and deployed automatically by glassfish on the first request!

Related Topic