Normally, I build a Java web app using Tomcat or Glassfish into a WAR (web app archive file). This file can easily be deployed into AWS through Elastic Beanstalk with a few clicks. The integration is simple because Elastic Beanstalk allows us to deploy a web app on Tomcat/Glassfish/Java.
I recently started using a lightweight java framework called Spark, www.sparkjava.com . Is it possible to deploy this on Elastic Beanstalk in a few clicks? If not, is there an alternative to easily deploy a Spark Java web app onto AWS? Or, would I need to create an EC2 instance, copy the JAR app, and launch the JAR web app via command line?
Sure you can, either by deploying it as a war via the Tomcat platform, or run it as a fat jar via the Java SE platform.
I published an Archetype for AWS Elastic Beanstalk that uses DropWizard instead of Spark (but both use Jetty) - It should be pretty straightforward to adapt it to Spark. Note it uses the Docker Solution Stack (more flexible and easier to debug locally). This command should get you started:
$ mvn archetype:generate -Dfilter=elasticbeanstalk-docker
Also, AWS allows you to create a custom Java Application, like #k.liakos said in his answer.
Related
I have Java Web Application that runs on tomcat server, without any frameworks. My application works with MongoDB and I need to deploy it to AWS.
What are my steps need to be done?
Deploy war on Elastic Beanstalk?
Install Mongo on EC2?
What would be the process?
Actually, I don't understand how to use Mongo in AWS. Deploying war is simple but how to connect this project with my database?
MongoDB runs well in the cloud, both managed by yourself or through Atlas, the MongoDB-as-a-Service offering from MongoDB. The latter is probably the easiest way to get yourself started and may provide all the capability you require without having to take on management yourself.
https://www.mongodb.com/cloud/atlas
Disclosure: I used to work at MongoDB
I worked with OpenShift and was able to deploy the Java Tomcat web application from a git (bitbucket) repository URL. Another good option was using rhc.
I am new in AWS and need to deploy the Tomcat Web application onto AWS. I cannot find neither the option to upload from a git repository (bitbucket) nor the a shell command interface. Are there any options?
I received some answers that it is possible both from AWS Elastic Beanstalk GUI and from eb. However, I cannot find how to do this, so it would be nice to get the answer in details. How to get to the screen asking the GIT URL? What is the eb command?
It sounds like you were using OpenShift v2 and now you want to migrate to AWS. The AWS Elastic Beanstalk service is a PaaS that should be very similar to what you are used to using with OpenShift v2. Elastic Beanstalk has an eb command that is similar to the rhc command, and Elastic Beanstalk can trigger deployments from Git, very similar to how OpenShift v2 deployments worked.
Docker is convenient to run fat jars, with embedded server. Just add the jar, expose the ports and run it.
But how docker fits with the traditional way of deploying EAR to weblogic server? Is docker still a viable tool for this kind of traditional packaging? Is there some well proven pattern, how to use docker for traditional style of java deployments with heavy emphasis on weblogic configuration? All the tutorials I find considers either executable jars or python scripts.
The WebLogic team seems to think so. The WebLogic team has developed several tools in this space:
WebLogic Deploy Tooling allows you to create WebLogic Server configurations using a metadata model in YAML - https://github.com/oracle/weblogic-deploy-tooling
WebLogic Image Tool helps you to create a Docker image using the WebLogic version and patches of your choosing, and will use the WebLogic Deploy Tooling to create a domain in the Docker image, also. https://github.com/oracle/weblogic-image-tool
WebLogic Kubernetes Operator can be used to run Docker containers with WebLogic domains in a Kubernetes environment. https://github.com/oracle/weblogic-kubernetes-operator
Here's the thing: I need to take a certain Java EE web app and deploy it to Amazon EC2 (which I will need to setup first) starting next month (using the http://aws.amazon.com/free/faqs/ AWS Free Tier Usage - hope it supports Tomcat + MySQL/PostgreSQL).
The problem: I have never ever deployed a Java EE app (not even a normal one on a dedicated hosting) nor have I setup an Amazon EC2 enviorment.
Are there any, idiot proof preferably, tutorials/how-to's/whatever on doing it from the very beginning (signing up to Amazon) till the very end (when your app is all up and running)?
I did find some tutorials on how to setup an Amazon EC2 instance, how to normally deploy a Java EE app but what I'm looking for is a single tutorial putting it all together.
Start with an Ubuntu AMI. Then install tomcat. Now put the WAR file of your J2EE app where tomcat can see it. You can use the AWS console to start/stop your machines, configure firewall rules that allow you to access port 80, etc. There won't be a step by step guide telling you exactly what to do, welcome to being a programmer.
Once we have the instance (like Ubuntu) running http://youtu.be/hJRSti6DsJg then, installs Glassfish (Java EE server) and configure it to work with Java EE. It depends more of the instance itself (Ubuntu) than EC2 Amazon... here a nice video (how to install Glashfish in Ubuntu + Netbeans config) http://youtu.be/CKuoDm6bqRM
Note:
Keep in mind both videos are a little old (may some adjustments are necessary)
The videos are indirectly related. But my point is: there isn't much info about Amazon AWS and Java EE, but there are a lot info about Amazon AWS and Linux, and Linux and Java EE.
Update
You can try Amazon Beanstalk (Deployment & Management) integrated with Netbeans (without Glashfish?) http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/GettingStarted.html
SSH to Elastic Beanstalk instance
http://aws.amazon.com/java/ (Amazon + Java)
Boxfuse now supports deploying Java EE applications using either Tomcat, TomEE Web Profile or TomEE Plus to AWS with a single command
boxfuse run mytomeeapp-1.0.war -env=prod
This will create an image, provision all necessary AWS infrastructure (AMIs, security groups, auto-scaling groups, launch configurations, ELBs, Elastic IPs, ...) and launch the instances. It supports blue/green zero downtime updates with Elastic IPs and ELBs.
You can find a tutorial here: https://boxfuse.com/blog/javaee-aws
Disclaimer: I am the founder and CEO of Boxfuse
Can anyone point me to the steps/resources that describe:
How to deploy a Java EE app on amazon-EC2
Maintain changes to the meta-data of the app server (deploy new applications) after an instance reboot (probably using amazon-ebs)
First check this out if you haven't already ran through it:
http://docs.aws.amazon.com/gettingstarted/latest/awsgsg-intro/intro.html
it'll give you an idea of how it all works.
With regard to running a Java EE app on EC2, you have a couple of choices - but they generally come down to the following recipe:
Start an instance
Install a Java EE application server (tomcat/glassfish/websphere/...)
Install your application (war/ear) into the application server
Now you can bundle the above into an ebs ami, or you can write a script (bash/sh/tcl) which applies those changes when your instance starts (which i prefer). The scripts allow you to modify what gets installed/started/moved around without having to rebundle your instance.
There's some great resources here: http://developer.amazonwebservices.com/connect/kbcategory.jspa?categoryID=100
Hope that helps.
How to deploy a Java EE app on amazon-EC2
You still deploy to an application server so it isn't really different. If you have more specific questions, please clarify. But have a look at Running JEE applications on Amazon EC2 and How to deploy a java web application on an ec2 instance.
Maintain changes to the meta-data of the app server (deploy new applications) after an instance reboot (probably using amazon-ebs)
If you use Amazon EBS, then you don't need to worry, Amazon EBS volumes are off-instance storage that persists independently from the life of an instance.
The Amazon AWS's newly Launched Elastic BeanStalk is here to resolve you concerns.
You can deploy Java EE apps on Amazon Ec2 instances via Bean Stalk. All you need to do is create a new applications and create a environment in it and add you WAR file for deploying, AWS has its own version of Tomcat 6/7 with open JDK which can be customized to Sun JDK if required.
Therefore Amazon offers complete Deployment tool to start using your app by just deploying in BeanStalk. BeanStalk offer Auto Scaling & Elastic Load balancing and a lots more to customize your application Environment.
If you start an ebs-booted instance, you do not need to care about persistency after a reboot (see http://aws.amazon.com/about-aws/whats-new/2009/12/03/amazon-ec2-instances-now-can-boot-from-amazon-ebs/)
Concerning the deployment of Java EE, I don't see any difference to deploying it on a non-virtual OS.
Boxfuse supports deploying Java EE applications using either Tomcat, TomEE Web Profile or TomEE Plus to AWS with a single command
boxfuse run mytomeeapp-1.0.war -env=prod
This will create an image, provision all necessary AWS infrastructure and launch the instances. It supports blue/green zero downtime updates with Elastic IPs and ELBs.
You can find a tutorial here: https://boxfuse.com/blog/javaee-aws.html
You don't have to worry about maintaining changes to the meta-data as all instances are immutable and contain all necessary app server info.
Disclaimer: I am the founder and CEO of Boxfuse