customize Elastic Beanstalk instances - java

We are deploying a java web application in Elastic Beanstalk. The Beanstalk by default provides Redhat instances with Tomcat7 & openjdk. But i want to customize the instances so that i can use Sunjdk.
Followed the steps as mentioned here, I launched a new instance from EC2 & installed sun jdk, tomcat7 and created a custom AMI of the instance and provided its ID in Custom AMI id field in edit Environment configuration in BeanStalk. But my Environment Health status is changing to RED, and the application is not deployed. Can you please suggest me a solution for this.

I have done exactly what you want to do, and am happy to report that it works. In my first attempts I encountered the same issue. Make sure that you:
Create your custom AMI from a running instance of Amazon's beanstalk AMI that you manually launch from EC2, NOT one that was launched from starting your application through beanstalk. This is very important, as Flashing a beanstalk launched EC2 instance won't work!!
install Sun's Java as per these instructions, to make sure all the environment and symbolic links are correct. https://forums.aws.amazon.com/message.jspa?messageID=251168#251168
be patient, as I found for some reason Tomcat takes longer to spin up than with the default OpenJDK config.
If you still can't get it, make sure you check the logs in /opt/tomcat7/logs/catalina.out - I hit a mysterious VerifyException that was resolved by uploading a new .jar to the environment, and I also ran out of permgen space almost immediately, which was resolved by upping the values in the 'Container' configuration area of the beanstalk 'edit configuration'.

Related

Building production environment for Java Server Faces application on server

I am about to start working on a JSF application and I am trying to decide on how to set up my production environment.
I enjoy working off my VPS for production instead of my local host. Is there a way to launch a JSF app to my server and then build on it from there? Or is that not going to work because I have to have a compiler to compile the java each time I update?
If that is the case would it make sense to just install a compiler to the server?
This is my first JSF and real java application so if there is some good info on this please lead me there.
I have someone working with me and I was assuming if we both work of the server it would be easiest.
How would this work in a professional environment, or in other words how would a team working for a company set their environment up?
How it generally works is that each team member has a local installation, and deployments up the chain to servers are handled by the systems admin guys on requests, them being provided with an installation package containing the compiled application (a WAR or EAR file), any other files needed, and quite likely a script with database changes, an installation manual, and things like that.
You should never develop directly on a production server. Only deploy stuff there once it's complete, tested, and verified to be in working order, and secured against attacks.

Amazon Web Service Deployment - free tier

I'm trying to use the AWS free tier for host a java web application. I created an EC2 instance but i don't figure out how can I deploy the application to this instance. I was trying to use the AWS Toolkit for eclipse to deploy the web site to Elastic Beanstalk, but from here i need a second tier to deploy the application to the production.
My question is: What is the free solution to make a deploy to my EC2 instance and how?
Thank you!
If you are using Elastic Beanstalk ( which I recommend), then you should create the Beanstalk stack manually from the AWS console. Before you do that, I suggest you to terminate your other instance, because you wont use that.
The beanstalk stack will create an EC2 instance in the background, also an RDS database if you ask for it. You pay for the resources ( EC2, RDS), but no extra cost for the "Beanstalk stack".
After you having the Beanstalk stack, you can deploy it with the Eclipse plugin, or just simply generate the WAR file and upload it via the AWS console. ( On the Beanstalk page there is a place to upload a war file for deployment.)
Be aware to set the DB connection details to the RDS ( if you are using it).
Also note that the free tier is nice to warm up but not recommended for production.
When you create the Beanstalk stack make sure you create a single AZ web frontend, so you will have only 1 webserver running.

How to automatically upgrade a Java application during its startup?

I have a Java 1.6 application deployed on several machines (~ 30), and started as a Windows service.
My main problem concerns the maintenance of these deployed artifacts: if I develop a new version of this application, I don't want to manually redeploy it on every machine.
Ideally, when the Windows service is starting, it checks on a remote server if an update exists, and if it is found, then it upgrades the application.
Note that it is acceptable that after this upgrade the service requires to be restarted again.
This mechanism can be compared to the Maven snapshot verification: if there is a newer version of a SNAPSHOT version on a remote repository, then Maven download it before running it.
Note that the application itself will be deployed on a Maven repository (in our case Nexus), so the check for an update will be done against this Nexus instance.
What are my technical solutions to implement such an automatically application update?
Do not hesitate to ask me more details about technical information or about the context...
Thanks.
Edit: As stated by Peter Lawrey, I can use Java Web Start. However, how can I integrate JWS within a Java application that is run as a Windows service?
I would look at Java Web Start
A common technique for this is to use a launcher. The steps are something like this:
Start the launcher.
The launcher checks to see if the application should be updated. If yes, the launcher updates the application (I think of this as "the update step").
After the update step, the launcher runs the application.

How to deploy a Java EE application in the Amazon cloud?

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

Run Java EE app on EC2

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

Categories