Matt RaibleMatt Raible is a Web Developer and Java Champion. Connect with him on LinkedIn.

The Angular Mini-Book The Angular Mini-Book is a guide to getting started with Angular. You'll learn how to develop a bare-bones application, test it, and deploy it. Then you'll move on to adding Bootstrap, Angular Material, continuous integration, and authentication.

Spring Boot is a popular framework for building REST APIs. You'll learn how to integrate Angular with Spring Boot and use security best practices like HTTPS and a content security policy.

For book updates, follow @angular_book on Twitter.

The JHipster Mini-Book The JHipster Mini-Book is a guide to getting started with hip technologies today: Angular, Bootstrap, and Spring Boot. All of these frameworks are wrapped up in an easy-to-use project called JHipster.

This book shows you how to build an app with JHipster, and guides you through the plethora of tools, techniques and options you can use. Furthermore, it explains the UI and API building blocks so you understand the underpinnings of your great application.

For book updates, follow @jhipster-book on Twitter.

10+ YEARS


Over 10 years ago, I wrote my first blog post. Since then, I've authored books, had kids, traveled the world, found Trish and blogged about it all.

Tomcat Deployment App

On of my clients has asked me to setup a deployment app. Basically, we have seven instances of tomcat setup through one Apache webserver. Apache proxies to each instance based on different domain name. They want the ability to upgrade each instance with the click of a button. Here's my idea:

  • Create a Struts-based app that allows file upload, where they can upload a war file.
  • Part of the file-upload process is selecting which servers they'd like to upgrade.
  • Based on the server names, the war file is copied and expanded in the tomcat/webapps/appname directory for each server.

Will this work, and can I do this through a webapp? It'd be cool to do steps 1 and 2 with a webapp and have step 3 run by Ant. Is it possible for a webapp to call Ant? The second piece that they're probably going to want is the ability to setup these virtual slices on the fly, from a web page as well. That might be a little tougher, as it would involve: editing http.conf/workers.properties, creating a new user for the slice, copying/expanding a base Tomcat install, editing the server.xml for new ports, creating a new MySQL instance for the slice, and finally, creating startup scripts. Yeah, I might have to pass on creating that app - probably not logical to do it from a webapp. Especially when it only takes about 10 minutes to setup right now.

Posted in Java at Dec 15 2002, 07:17:58 AM MST 4 Comments
Comments:

I think parts 1 and 2 can be done via a webapp that writes the filename, and server names to an XML config file, or properties file. Then ant can read the file for those properties (which will be used by ant) and fetch the war and copy it (ftp) to the destination servers. I believe you can drive ant from within a webapp since it is a Java API, have not tried it though (Erik H may know more). Once again the setup of the virtual tomcat servers can be done using a web app and a workers.config XML template (properties) file. The app will get the names of the servers you ant to add, and you can append to the workers.config template and copy it to apache/conf dir for final deployment. The MySQL database setup may be more involved and can be driven from a default setup script or something. All in all it does look like a good bit of work though.

Posted by dsuspense on December 15, 2002 at 04:22 PM MST #

You can do 1, 2 and 3 with Ant alone, without writing a web app. Just copy the catalina-ant.jar file from $CATALINA_HOME/server/lib to your Ant lib directory and you get a set of tasks for deploying war files to Tomcat: <target name="deploy" description="Deploy web application" depends="war"> <deploy url="${url}" username="${username}" password="${password}" path="${path}" war="file:${dest}/${ant.project.name}.war"/> </target> Of course, you need to have Ant installed on your client's machines. I suppose they already have it, or how would they build their web apps otherwise? ;-). Alternatively, you can upload the war file to a webapp and execute "ant deploy" on the server side.

Posted by Ugo Cei on December 15, 2002 at 04:36 PM MST #

Ugo, I knew that this could be done with Ant alone, but my client simply wants to upload a war and select the server to deploy to. So it takes them all of 5 minutes or so. I'm supposed to take the headache out of the whole equation. I guess I'll need to tap into Ant somehow, that's probably the best solution.

Posted by Matt Raible on December 15, 2002 at 08:18 PM MST #

To at least answer "can I do this from a web app"... sure, we've done it (without using Ant, though). Shame I can't share the code :-( I'd love to automate the creation of tomcat instances behind apache, though. Go for it ;-)

Posted by Hans Gerwitz on December 17, 2002 at 09:53 PM MST #

Post a Comment:
  • HTML Syntax: Allowed