How/where to deploy my webapp on my own server? - java

I have a built small web app using Java/J2ee. I want to host it myself in my own servers (I have none now). I have already downloaded Ubuntu Server OS. I prefer to host my app on my own servers (preferably using Linux, Apache and MySQL) rather than google app engine or any other hosting service?
Can some one guide me to look for server
hardware?
Where should I buy them?
What sort of things I should look
for in webserver hardware?
Which is cheaper, hosting on 3rd party
servers or our own servers?
Can you provide some links where I can learn about creating webapps and hosting on our own servers?

The software you list can run on virtually any computer hardware, your requirements and intended use/target audience would be the starting point to assess what kind of hardware you need for scalability.
If it's for learning purposes or development just run it on your own pc or get the cheapest hosting account you can find.
Additional info needed to properly suggest anything.

If you want to host app for testing/trial purposes, go for for google app engine or 3rd party cheap shared hosting. If you are looking for reliable hosting or dedicated server, it is better to go for grid hosting providers such as media temple.
I would not suggest hosting app on your own servers. Running own servers is overhead and comes along with its own set of maintenance problems. Instead going for reliable hosting provider is a smart move.
Some of web hosting providers you can look for..
MediaTemple ( Highly recommended )
GoDaddy
Blue Host
DreamHost

You might want to see if you can get hold of a copy of Professional Apache Tomcat 6 , which gives good advice on administering Apache (both web-server, and tomcat).

Related

Publish WebService for public access

So, i have some experience developing Java WebServices.
The problem is, all i do is deploy them to localhost.
My question is:
How can we deploy a WebService to a server other than localhost?
How can i search the web and find the WSDL description for my WebService so that i, or anybody else around the world, can call its services?
If i have it in localhost, nobody else but me on my computer can acess it right?...
Thank you for your time
I don't think you'd want to make an application running in your development environment accessible to anybody else around the world for a variety of reasons. Others on your local network could access your local host via its network hostname, but this isn't users around the world.
Let's discuss your two questions individually:
How can we deploy a WebService to a server other than localhost?
You'll want to establish a server environment that is available (on) as much as possible. If you want to keep using Apache Tomcat, you could sign up with a variety of service providers that host Apache Tomcat applications - there are many who offer tiered pricing based on number and size of pre-configured virtual servers (CPU, memory, disk space, and/or monthly data transfer of the application). You could even sign up with a cloud service provider such as Google Cloud, Amazon Web Services, or Microsoft Azure. All provide the tools to build, provision, and manage virtual server(s) which you would then deploy Tomcat and web service application into. Here's a detailed tutorial on setting up a Tomcat virtual server on Azure. You'd then need to manage those server(s), watch them to see how much they're utilized (which will impact how much they cost you per month, by the way).
If server management isn't what you're looking for - you could also explore "serverless" options such as Google AppEngine or AWS Elastic Beanstalk. In this model, you just upload your WAR file and the hosting service manages things like how many servers are needed to handle all the application SOAP requests your users around the world are making. You'll need to read the specifications for each, as you technically aren't providing Tomcat itself - in Google's example, you're actually running in their own proprietary container, so your app may need some changes depending on what it does.
Depending on what hosting or cloud service provider you select, your "how to deploy" steps vary wildly. On the bright side, all offer tutorials on how to specifically deploy applications into them "their way."
How can i search the web and find the WSDL description for my WebService so that i, or anybody else around the world, can call its services?
Once you've settled on a hosting or cloud services provider and have deployed your application, you'll have a URL to reach it, but you'll need to work on getting the word out. There are some open specifications on (SOAP) web service discovery, but more than likely that's not what you're really looking for. You could also submit your WSDL URL to an online API directory such as ProgrammableWeb or Public APIs.
The simplest way to do-it-yourself would be to run a web site that links to the WSDL, then use search engine optimization techniques to list the site on search engines and make it (and the WSDL it links to) relevant to web searches.
Getting fancier, you can treat your web service as a product via an API Management system. At a high level, this works by hiding the real URL to your web service on its server(s) and instead direct clients to a small website for developers where you document, market, facilitate discovery of your service as well as offer a sign up to use it (so you can track and manage who around the world is using your web service). Clients then consume the web service via separate URL behind what's called an API Gateway. You could charge for access or offer it for free but limit the amount of concurrent requests a client can make - after all, you're likely paying your hosting provider for utilization. Some of the cloud service providers Amazon, Azure, standalone API management vendors such as Apigee, Mashery, and many others.

Deploying java coded server jar on web

I have coded a Jersey based java server which is all wrapped in one excecutable jar.
I am looking for a web host service in which i can deploy the jar and run it.
I saw some dedicated servers which can do this but this is overshooting the need, any suggestions?
As per your comment I understand that you created a web application with a Jetty embedded server.
I think the best solution for you in this case is to get a virtual machine host, install JRE, upload your *.jar and run it from there. Given firewall permissions and correct configuration you should be able to receive requests on the 80 port. Cons? It costs. A lot.
Most of the Java hosts have already a servlet container running (almost always Tomcat) and you can only deploy your web application in it. Having an embedded Jetty server messes up everything for you.
I strongly suggest you to detach your web application (or as you called it REST server) from Jetty and deploy the *.war in any of the multiple free Java hosts to test it online.
EDIT
Thanks to you I made a deeper research on the topic and found an interesting guide to deploy a web application with embedded Jetty server in Heroku. I've never tried it nor I know if its free, but maybe you can give a try.
Digital Ocean work pretty well for me. Their basic packages are really cheap and you get root control over your own machine, meaning you can host whatever you want without restrictions. The only downside is that they are pretty old school - you have to set up EVERYTHING yourself, including firewalls etc. There are a lot of guides available on their website though, which makes life a lot easier!
http://www.digitalocean.com
I know this is a touch redundant but I don't have voting or comment rights yet so this is the only method for me to communicate.
Digital Ocean is a solid choice. I am paying 5$ a month for a VM with 512 Mb Ram and 20 gigs of storage (which for my use is just fine.) I am still working on my first proper deploy but as stated above there are tons of tutorials to guide you through it. I have no prior command line experience but I've managed to get the server running, Created an SSH key, uploaded my landing page and have gotten a test project using Spark as the embedded server up and functional in a matter of a few hours. The Droplets are easily scalable from what I've seen. I'm still having trouble deploying an Rest based app with Postgres as the DB but it seems more to do with the ports in play than anything else. Keep getting 404s.

What is the difference between PaaS and app server hosting?

In terms of deploying a java web app on the internet, what is the difference between sites that offer app server hosting such as Tomcat, Jboss and Glassfish, and sites that offer platform as a service such as Google app engine, Heroku and Amazon EC2?
Difficult question, since PaaS is often misused term.
But I'll try: PaaS usually involves (another) layer of abstraction (you usually don't really know on which server exactly your app is running). Plus your application may or may not share the hardware with one or many other tenants.
Traditionally providers of app server hosting just used N (like 1000) customers per server and calculated that way. GAE etc. try to optimize (distribute the load more cleverly) this and usually charge you on what you actually use.
IMHO: In theory you could use more resources on a app server than you actually pay. But since they usually over-sell, you'll find it hard to get what you pay for. In theory, with pay-what-you-use PaaS offerings you get should what you pay for. /IMHO

Custom Domain for Google AppEngine Apps

I have been fooling around with Google App engine for few days, the question I wanted to ask was,
If i want to deploy the web app to custom domain does the server need to be hosted on Windows Server???
No, you do not need a Windows server. You just need to sign-up for Google Apps, then add the application to the domain. If this is all you are using Google Apps for, then the free version will be fine.
I think you might have some misunderstandings about App Engine. With App Engine, your applications run on Google's servers, not yours.
Also, the I believe servers are Linux, not Windows.
If you are wanting to run your own servers 'using' App Engine Java check out AppScale.

Java Web Apps virtual host

I have just became a partner of a company that has a site developed in JAVA. As part of the agreement they allow me to create a section on their site (so I can take benefit of their traffic), but the development of this section needs to be as less intrusive as possible.
So ideally I would like to implement an independant web application in JAVA (with same layout) with a separate database that runs in the same application server. And in the application server to make a mapping like this:
All the traffic that comes to www.domain.com/MY_FOLDER
its served by my web application, all the rest should be served by my partners site.
I have no experience in JAVA but I found that in php this can be done, so I was wondering if it can be done also in JAVA.
About the application server I dont know yet which one they are using but I guess that are using "resing server" (by caucho: http://www.caucho.com/).
I would really appreciate if you can give me any ideas of how I can achieve this.
Thanks in advance,
Juan
Only one application can listen at a given socket at one time, so you need to have the existing server forward "your" requests to your web application, if it is not Java capable in itself.
The way to do that is not standardized so you will have to talk to the server administrator.
The easiest way to start from scratch with a Java Web Application is in the Netbeans bundle with Glassfish.

Categories