How to deploy java application to EC2 like Heroku? - java

I really like Heroku style to commit the code and everything is deployed to the server. However, I'm building a java webservice which requires read/write file system. So, heroku is not the best option for me. So, I think my best option would be to host it on EC2. However, I want to setup something like when I committed the code and push to Github it also pushes to EC2 server as well.
So, Github would be just a source control, but the server is on EC2. How can I achieve that?

You could use AWS Elastic Beanstalk, which manages server/app container for you.
You can find more information here: http://aws.amazon.com/elasticbeanstalk/

Yes. Java on Play or Spring stack for example can run on Heroku.
Check this article to view all the stacks supported by Heroku.

Related

How Does One Deploy a Jersey Application to a Remote Tomcat Server

I need to state up front that I am not a Java developer. So it is fair to assume that I know very little about the tooling etc. that Java dev's will be naturally familiar with.
So, I have created a Jersey web api (2.25.1) on my home server running Windows 2012. It serves data to a Xamarin application. I need to deploy this to a Linux server (Ubuntu) on AWS which my friend spun up.
At the moment, the only access I have is via SSH (Putty).
Tomcat (and Glassfish) have been installed on the Linux machine.
How do I go about deploying that application to that AWS server?
The official Jersey documentation seems to be MIA, and my Googling efforts don't yield much. There's a lot of SO questions with a similar title to this one. But I have not found any of the answers (and in many cases, questions) helpful to my cause.
Cheers
I assume that you are using maven to create your jersey web app .
Upon build you will get a *.war file .Copy the same to tomcat/webapps folder .
Start your tomcat then.
To take your file there on remote use winscp tool with your ssh credentials.

Simple things about jelastic & jetty

I create maven project with dependencies. Than write simple jetty server which return html page on request. Simple "Hello World" application. Now i want relocate it on jelastic cloud, but can't understand how.
When creating cloud on jelastic you can add jetty server, but i need run my own. Maybe i need connect my servlets or another things. Or maybe i can run server.jar file which assembled by maven.
My google traveling failed. I even not imagine what i must search. Pls help me.
Indeed, you can't up your own servers on the native containers. Moreover, such containers don't provide the root access for a customer.
If you want to run your own server you can use either VPS or Docker solution in Jelastic Cloud.

Amazon AWS WebApp with MongoDB

I have built a mobile application that needs to connect to my SpringBoot-WebApp which in turn has a MongoDB and some other things in the background.
I want to deploy this WebApp at Amazon AWS, but I am overwhelmed by all the possibilities. So far, I have just created it as a .jar, and ran it that way, and it worked fine at my other server.
Now, for traffic reasons and such, we want to move it to AWS. I have found out, that I need to create a .war instead of a .jar, which is not a problem. I then learned to upload this .war to Elastic Beanstalk. However, my application needs to connect to a MongoDB. I have logged on to AWS via SSH and installed MongoDB there and created the database, but it does not seem like this is the right way to do it.
It'd greatly appreciate if anyone could give me a hint on how to do this as I am very confused.
Thanks and best regards!
It isn't clear if you are doing this, but don't run MongoDB on Elastic Beanstalk. The Elastic Beanstalk server you have it installed on may be automatically deleted by AWS. In general you do not want to manually install anything on Elastic Beanstalk as it is a managed environment where servers may be automatically created or deleted based on server load.
Amazon doesn't provide a MongoDB service directly, so you either need to install and manage MongoDB on an EC2 instance (or fleet of instances) yourself, or use a third party MongoDB service that runs on AWS. You could use something like MongoLab which provides a MongoDB service that runs on AWS. This allows your network traffic between your web servers and database servers to stay within the AWS network, which you will want for both performance and security reasons.
If you use MongoLab just make sure you choose to create your database in the same AWS region that you are deploying your application to. Also, I wouldn't recommend their free sandbox databases for any sort of critical production application.
If you decide to install and manage MongoDB on AWS yourself, here is some documentation from Amazon, and some from MongoDB.

Running netty application in Amazon Elasticbeanstalk

I have a regular netty application server that runs on port 44080 and is built as a .jar file. I would like to use elastic beanstalk to manage the lifecycle of the application. Is there a way I can deploy the jar or something similar using elastic beanstalk?
It seems netty is currently not supported by elastic beanstalk. If your application can also run on Tomcat, you could do that - with Tomcat, you just need to enter some basic settings in the webinterface and you´ll get a fully working environment where you can upload jar files to.
If you need netty as a platform, you could try using Amazon OpsWorks. I never worked with it myself, but I know you can create your own "environment configurations" there. You´d basically create a few scripts to setup your server and deploy your application and OpsWorks lets you execute those through the web ui and also provides capabilites for auto-scaling, failover, etc. in OpsWorks environments.
There's nothing wrong about using Netty. In fact, one of our archetypes for AWS Elastic Beanstalk contains support for Dropwizard (by using Docker as its stack), thus not being dependent on a Java Web Container.
$ mvn archetype:generate -Dfilter=elasticbeanstalk-docker-dropwizard
It might need a few tweaks, but the overall idea is to package all your dependencies into a zip file and deploy it. Also, make sure your Dockerfile EXPOSEs port 44080.

How do I migrate a Java webapp to Heroku

I have an app that uses Spring and is run with Jetty. I was hosting it on an Amazon EC2 instance but now I want to put it on Heroku. If found the following link but I don't know if it covers everything and since I'm new to Heroku and, to a lesser extent GIT, it seems overwhelming:
http://blog.neo4j.org/2012/01/spring-onto-heroku.html
Does anyone have experience doing this and if so what is the first step? I do have a test Java app running on Heroku.
The Heroku Dev Center should answer most of your questions:
http://devcenter.heroku.com/categories/java
In particular, the Spring MVC example article should help you get started:
http://devcenter.heroku.com/articles/spring-mvc-hibernate

Categories

Resources