Ethan
Ethan

Reputation: 146

Azure Tomcat Eclipse Deployment

I have an azure server that runs my Tomcat web apps. Everything works well but I find that exporting my war, undeploying, then redeploying the war to Tomcat is a hassle. On my dev environment I run Tomcat within eclipse and have my latest code to run. What would be the problem with running eclipse on my azure server, having Tomcat run within eclipse to run my web apps? This way with any change I can simply git pull my latest code into eclipse and restart tomcat. Is this a bad idea in production and why? If so any recommendations on how to make this easier? I would rather not expose the tomcat manager application to the world so please don't recommend that.

Upvotes: 0

Views: 631

Answers (2)

Brij Raj Singh - MSFT
Brij Raj Singh - MSFT

Reputation: 5113

Which is all nice and fine if you are doing development, but for production you shouldn't need the Development Code Environment, rather the production should always contain the runtimes. Which anyways in case of Azure Webapp with Tomcat8 is available (you don't actually need eclipse on the server). I think your worry is that if you use the Azure WebApps than your Tomcat manager will be exposed to the world, if thats the case I suggest you use "Jetty" blade to deploy your app rather then using the Tomcat, if you use Jetty than the basic page would be "Nothing" unless you push code. More Detailed overview of Using Azure Webapp deployment with Jetty is Available here https://azure.microsoft.com/en-in/documentation/articles/web-sites-java-get-started/

Upvotes: 0

Peter Pan
Peter Pan

Reputation: 24138

Per my experience, the easy way to continuous deployment for Tomcat web apps in Eclipse is using local Git repository.

First, Create a Dynamic Web Project with Tomcat in Eclipse. There is a key step for creating project different from normal step. When configuring web module settings, need to set webapps/ROOT for Content directory, see below:

enter image description here

Then, the project structure tree as below:

enter image description here

Second, Configure the continuous deployment for Azure WebApp on Azure Portal.

enter image description here

After done above, copy the git clone url for git cmd.

enter image description here

Until now, open the git bash to push project into Azure. The steps as below.

  1. Open the git bash cmd and cd into project directory <app-name>.
  2. git init
  3. git add webapps
  4. git commit -m "Initial Commit"
  5. git remote add <app-name> <git-clone-url>
  6. git push <app-name> master

Now, you can browse https://<app-name>.azurewebsites.net/ to see it.

For continous developement, you just need to repeat the step 3, 4 and 6.

Upvotes: 1

Related Questions