background preloader

Prod

Facebook Twitter

Deploy a Java Web Application that launches with Jetty Runner. Java Table of Contents Follow each step to build an app from scratch, or skip to the end get the source for this article. You can also use almost any existing Maven webapp project. Prerequisites Basic Java knowledge, including an installed version of the JVM and Maven. What is Jetty and Jetty Runner? Jetty is a lightweight Java application server that offers a flexible array of options for how it can be launched. Java -jar jetty-runner.jar application.war Jetty Runner will then launch a Jetty instance with the given war deployed to it. Create an application if you don’t already have one mvn archetype:generate -DarchetypeArtifactId=maven-archetype-webapp ... (you can pick any groupId or artifactId). Configure Maven to download Jetty Runner Although not necessary for using Jetty Runner it’s a good idea to have your build tool download Jetty Runner for you since your application will need it to run.

<build> ... Run your application To build your application simply run: That’s it. Create a Procfile. Create a Java Web Application using Embedded Tomcat. Last updated 12 February 2016 This tutorial will show you how to create a simple Java web application using embedded Tomcat. Follow each step to build an app from scratch, or skip to the end get the source for this article. Prerequisites Basic Java knowledge, including an installed version of the JVM and Maven.Basic Git knowledge, including an installed version of Git. Create your pom.xml Create a folder to hold your app and create a file called pom.xml in the root of that folder with the following contents: This pom.xml defines the dependencies that you’ll need to run Tomcat in an embedded mode. The last 3 entries are only required for applications that use JSP files.

There is also a single plugin defined. Add a launcher class Create a file called Main.java in your src/main/java/launch directory and put the following in it: This does just what is enough to launch the server. Add a Servlet Create a file called HelloServlet.java in the src/main/java/servlet directory and put the following into it: Heroku Java. AWS Elastic Beanstalk. Heroku | Cloud Application Platform. Getting started with Amazon's Elastic Compute Cloud (EC2) and the Bitnami Tomcat Stack.

My next couple of blog posts will detail my experiences thus far with Amazon's Elastic Computing Cloud (Amazon EC2) and the Bitnami TomcatStack Amazon Machine Image (AMI). Choosing Amazon's EC2 In the past, I have typically deployed my Java applications within a company intranet or extranet. However, my current project needs to be publicly accessible and it's up to me to choose a suitable and ultra-affordable web hosting provider. My hosting requirements are fairly simple. I want to deploy my application on Apache Tomcat using a MySQL database and several popular Java frameworks including Hibernate, Struts 2, and eventually Spring. Other than that, I don't expect my current web application to require much in terms of bandwidth and resources. I was considering trying Google's App Engine until I learned the App Engine doesn't support the Hibernate ORM framework and requires some tweaking to work with Struts 2.

At first, getting started with EC2 initially seemed a like daunting task. Not another Java blog :): How to setup Java + Tomcat + MySQL on Amazon EC2. Getting Fitocracy Back Online. Like many other startups, we use Amazon Web Services (AWS) to run Fitocracy’s website and iPhone app. Our main stack consists of half a dozen Elastic Cloud Compute (EC2) web instances, an EC2 Redis instance, and an Relational Database Service (RDS) instance that are all located in us-east-1 (Northern Virginia). So, when the colossal electrical storm hit the area last night and brought that entire AWS region’s EC2, RDS, and EBS (Elastic Block Storage) down, we went down with it.

It took us 12 hours to finally get fully operational again. Here’s why: Going downAt 11:05pm, Pindom emails that the site is down. Maintenance modeThe immediate goal after going down was to get up a static maintenance page on the website and maintenance status message returning to the iPhone instead of the unable to connect error. However, this wasn’t going to work very well, because there was going to be a problem with switching the domain.

Turning back on the lights Reflection -Daniel Roesler, CTO, Fitocracy. Rainforest. So, you're hosted in a single zone, and if you're in US-East presumably went down last night. Stop it. AWS has seven regions across the world, three of which are in the US. Each region is split in up to five availability zones. You need to use more than just multiple zones if you want to stay up during one of these outages. The following is a rough guide to making your website available regardless of 'catastrophic' events. Static sites Simple static sites and assets that don't change often have an easy option: just use CloudFront. Assuming so, use the AWS Console, click CloudFront, click create distribution, select download, and select your bucket from the dropdown list. The second and less oft-used way is to use CloudFront as a forward-proxy.

The process for this is more complex as you'll need to alter your webserver config, DNS and setup the distribution. Your website will now be significantly faster. Dynamic sites You want to move to Route53. Route53 is AWS's DNS offering. 2. 3. 4.