Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Deploying Java Server Applications That Aren't .wars

Are there any well-integrated application-management stacks that allow the build, deployment and updating of non-.war Java applications that run as servers? For example message consumers that are servers (but not webservers and have no Servlets), or executable .jars with Jetty embedded?

Building and deploying .wars is pretty straightforward: Maven has the war archetype, Jenkins has a heap of plugins for deploying .war files to various application servers, most of which accept the upload of new web applications at runtime. Tools like Elastic Beanstalk make this process even easier, tying in the management of server environments.

By contrast deploying executable .jars seems like re-inventing the wheel. One needs to sort out the best way of shading the dependencies and creating an executable artefact with a plethora of Maven plugins, deposit this artefact somewhere, then find a way of installing it on target servers, and replacing/upgrading it if necessary (Debian packages would be one way of doing this).

This all seems very 'manual' to me, to the point that it seems advantageous to deploy applications as .wars to application servers, even if they're not a natural fit for such an environment, just so you get the benefit of tool support.

like image 272
EngineerBetter_DJ Avatar asked Jul 11 '12 10:07

EngineerBetter_DJ


2 Answers

You could implement this by deploying your applications to an osgi container.

You could hook into the osgi lifecycle to run your application when the osgi bundle starts. Then you can remotely start and stop the container (if the container supports that).

Your applications could define their dependencies as part of the osgi manifest - but shading jars using the shade plugin is not difficult when using maven and I think it would be easier to manage rather than deal with hundreds of jars in your container.

This question talks about continuous deployment of osgi bundles using jenkins.

An alternative (and more standard) way would be to write scripts that automate the deployment - possibly using purpose built tools like puppet or chef. There is a maven plugin for puppet that allows you to extract artifacts from a maven repo for use in your puppet scripts.

Running puppet or Chef from jenkins is trivial and if you want, you can provide access to the deployment builds to non-technical staff members, to allow them to deploy new builds to an environment with a click of a button.

Like @bagheera suggests building rpms of your applications and starting them as services is a good way to go and reduces the complexity of your deployment scripts.

like image 120
plasma147 Avatar answered Sep 21 '22 10:09

plasma147


It seems like you are looking for a dependency manager for building your self-contained executable jar, and a package manager for deployment. Other than the tools you have mentioned, you could check out ant+ivy for build+dependency mgmt and rpmbuild+rpm+yum for package management on linux.

like image 43
ottodidakt Avatar answered Sep 22 '22 10:09

ottodidakt