Play Framework application deployment - java

it's been a long time working on a play app & now comes the time to deploye it. that my first time so i'm kind of lost. which hosting compagny is the best & offer good pricing ?

I'll probably post a detailed instruction of what I did, but here's a quick 2-min general idea.
Buy an Amazon Micro Instance Virtual Server (costs around $11/mo) with a debian squeeze (6.0) image
$> sudo apt-get install sun-java6-jdk6
$> sudo apt-get install mysql5
~: wget <playDownloadURL>
~: unzip *.zip
~: set path to java, play
sftp/scp your source code to /var/www/<yourApp>
$> cd /var/www/<yourApp>
$> play start
~: (not actual commands but the concept)
and you are in business.

The creator company of Play Framework, Zenexity, propose a hosting solution dedicated to Play applications: PlayApps
It's probably the best choice since it is native Play hosting.
Otherwise, you can export your Play application as a classic war:
play war yourapp -o yourapp.war
Then, this war can be deployed on every Java server (Tomcat, Glassfish, etc.). For hosting a Java application server, you'll probably need a dedicated or virtualized server.
Another solution is to deploy your app on Google App Engine. But for that, you have to developp your Play application in a specific way. In particular, you can't use classic persistence. You have to use the Siena Play module to manage your entities for Google App Engine.
I don't know if Play apps can easily be deployed on other cloud structures. Maybe on Cloud Foundry since it supports Java application but I did not tested it and there are not deploy plugins yet for this platform.

You can look at this direction Heroku

Cloudbees, http://cloudbees.com, is an excellent choice. There is even a Play Framework Module for it.
http://www.playframework.org/modules/cloudbees-0.1/home

All of my Play! apps are hosted on Google App Engine, which is free for small sites. But you can host Play! apps on any Java web hosting provider.

In this question Experiences on free and low-cost hosting for play framework applications?
there are several cloud options for play framework...

There are a number of cloud hosting solutions supported by Play. There is a module for Stax, and the message boards have mentioned success on several others. A quick search for 'deploy' on the google groups will show a number of options.
I would recommend PlayApps though, It is actually hosted on Ghandi (i think!) and the pricing plan is the same, so the Zenexity guys actually make no money from this. They have set it up to be a convenience to us developers.
GAE is an option, but it restricts what you can do with Play. The WAR file deployment option, allowing to deploy to any java servlet container is also an option, but adds the overhead and resource of the container unnecessarily, so again, not the best option.

You could try Play! Manager. It's a Manager for Play Applications much like the Tomcat Manager. Worth trying:
https://github.com/mbarbieri/playmanager

Lately I've been playing around with openshift for hosting playframework application
It looks really good, you have mysql, phpmyadmin, mongodb, mongorock, jenkins, and what's even more important, you get 5 applications with 500MB op data space for each one... for free...
I'm also using this play module to ease deployment to openshift
https://github.com/opensas/openshift/blob/master/documentation/manual/home.textile
have a look at these articles:
playlatam.wordpress.com
detailed github tutorial
article found at openshift's site

If anyone is interested on uploading on Linode please follow this thread.
Linode 512 and play! framework

I advise you to have a look at http://www.playframework-cloud.com
This PaaS platform can automatically scale up and down your application regarding your traffic. You can also finely customize if you want vertical, horizontal or both types of scalability. The consequence of this scaling is that you pay as you go : you only pay for your real consumption and not the potential one.
Deployment via git.
Non AWS, hosted in tier-4+ datacenters.
Free trial !

For AWS Boxfuse offers a very easy solution.
With Boxfuse's native Play 2 support you can now simply execute
boxfuse run my-play-app-1.0.zip -env=prod
and this will automatically:
create a minimal AMI tailor-made for your Play 2 app
create an elastic IP
create a security group with the correct permissions
launch an instance of your app
All future updates are performed as blue/green deployments with zero downtime.
This also works with Elastic Load Balancers and Auto-Scaling Groups and the Boxfuse free tier is designed to fit the AWS free tier, which effectively means that you can deploy your app at no cost.
You can read more about it here: https://boxfuse.com/blog/playframework-aws
Disclaimer: I'm the founder and CEO of Boxfuse

I would look into cloud hosting.
If you developed your application in .NET, look into Windows Azure.
Otherwise, check out Amazon EC2.
Little confusing to setup if your a firs-timer, but they have guides and stuff to help you through it, and you get 100% scalability going with the cloud.

Related

Activator Play Framework with google app engine

I am wanting to develop a GAE application. However, I have used the play framework before and very much liked its layout. I was wondering whether the latest version (2.3 I think) works with Google App Engine? I have seen posts about this before. Some say it is not possible; I've seen a github project on porting the code over but no one has ever commented on the success of the project. I am concerned about losing efficiency/too much functionality.
Can it be done?
If not, any suggestions on frameworks (I know I am not really supposed to ask this second question on stackoverflow).
Have a look at this repo which enables you to package your Play app in a war that you can deploy onto GAE.
But you should consider the trade-offs before doing this. Play was designed to be stateless/Asynchronous and GAE runs on Java Servlet Spec. This means (generally):-
your Play app will not be truly asynchronous on GAE
you may reduce performance a bit because you are running in servlet container on GAE (depending on your app though you may not even be able to measure this so I wouldn't worry too much about it)
I have personally found that deploying my Play apps into Digital Ocean (I use Docker but you don;t have to) work really well for me. I have used GAE in the past but I wouldn't deploy a Play app there for the reasons stated above. Heroku is a nice alternative but gets a bit costly if you need to scale out.
I got Playframework to work on Goole App Engine (Flexible, Custom runtimes). It involves writing our own Docker image. The integration isn't seamless (e.g. default credential doesn't work, so we have to use a JSON credential).
See: http://tanin.nanakorn.com/blogs/345

serving static content and java web apps from one server

I'm trying to build my own site where initially I will only host my profile and resume but will also build and publish some simple web applications that I can use as coding samples for jobs. The idea is people can see a demo of the apps and then see the code on github.
Can I do all this using only tomcat or should I use another server for this purpose?
I have heard that tomcat should only be used for java web applications but I've tried it locally and it seems to work...
You can totally do it all with tomcat.
Arguably, tomcat is not as efficient as apache or ngnix for serving static assets, 10% less so, and does not scale as well. There's a good article on the subject here:
http://tomcat.apache.org/tomcat-3.2-doc/tomcat-apache-howto.html
This is not not going to be an issue for you with a small site. Go with what gets you up and running the fastest.
If you want, later you can show off your technical prowess by running tomcat behind a web server. You can tell folks at interviews the story.

Does OSGi-as-a-Service exist?

Are there any Java PaaS solutions out there that offer OSGi containers as a service?
Google App Engine --> has their own GAE server which is modified Jetty
CloudBees --> has their own RUN#Cloud container which is modified Tomcat
OpenShift --> uses JBoss/Wildfly
??? --> uses, say, Karaf or Equinox
If not a full-blown PaaS, just a clusterable/scalable OSGi host. Google turned up nothing, so I'm assuming there isn't anything like this. Thanks in advance!
(In contrast to the other answers:) No, there is no OSGi-as-a-Service in the cloud, yet.
I am currently writing my master thesis about porting an OSGi application on a PaaS, so I did my own researches about PaaS and OSGi. I did not find any satisfying solution based on OSGi in the cloud (however I did find other solutions ;). The problem is that OSGi is pretty unpopular and the cloud is notoriously trendy.
As the other questions mentioned, OSGi is a Java library. So you could set it up pretty much everywhere where Java is supported. But that would be more a IaaS solution as a PaaS solution (which you seem to look for, as you are asking for OSGi-as-a-service). You would need to setup a OSGi framework on your own and you would have no support for deploying bundles. Which degenerates this solution pretty much. So no, there is no special cloud offer for OSGi, despite there are many for Java.
However, there is a nice book called Modular Cloud Apps with OSGi from Paul Baker and Bert Ertman published by O’Reilly. The book describes their PaaS-like solution to use OSGi in the cloud. The basically setup a repository of OSGi bundles, where they stored all their stuff. Then they created a cloud image, which only contains an empty OSGi framework/server (just like Apache Karaf, but they wrote their own tool called Apache ACE for what reason ever...). They were able to boot those images and as soon as the machine was up, they just deployed the bundles from their repository to the instance (via a web interface).
There is also a video of their demo on youtube: https://www.youtube.com/watch?v=oN3jYKOQ1Tk
I think this strategy is the best PaaS-like solution you could get. But - unfortunately - this is not supported by any cloud vendor out of the box. But you could set it up on (for exmaple) Amazon very easily.
EDIT
There also exists a Build Pack for Cloud Foundry to setup a Virgo server which can run OSGi apps: https://github.com/glyn/virgo-buildpack
Take a look at Gyrex. It's not a service yet but can be used to build you're own OSGi PaaS cluster. It uses Equinox, p2 for provisioning and Jetty.
http://eclipse.org/gyrex
Disclaimer: I'm a committer and heavy user of it.
There is a commercial provider of OSGi cloud services - Paremus. They have 2 cloud products - Nimble and Service Fabric. You might want to check them out. The Nimble product is available in a limited free edition for trial.
OSGi can be used on pretty much any cloud provider that offers Java support, since it is essentially just a Java library.
The exception to this would be Google App Engine, since they don't just modify Jetty, they modify Java itself and remove the ability to create threads and classloaders, both of which are required for full OSGi support.
OSGi is basically a Java library that can run on a virtual machine that has a JDK/JRE support. But remember one stuff, out of the box support is what you are looking for and you need to customize the PaaS you choose to run your app. I think to do this, you need to choose the provider that is easiest to configure and scale. Try out Jelastic. It is easiest of the lot to cinfigure and get started. Check their jar uploads, and I think it will suffice your needs.
Let me know what you think and if this answer is of any help.
Surya

VPS vs Dedicated JVM Java Hosting

looking into hosting sites (for a play framework application) i have noticed 2 options VPS & Dedicated JVM Java Hosting. will i be able to achieve same result using both options eventually or is one more limited ?
Borderline question. In fact, both strategies have advantages and inconvegnients. But for Playframework, you must be thinking about :
Playapps
Heroku
Jelastic
for the JVM Hosting. Just take into account the fact, Play is supposed to be served through it's embedded Jetty for better performance. When deploying to Jelastic, it will be deployed as a WAR. Performance issues might appear when using WARs instead of the out-of-the-box solution.
On the other side, a VPS must be configured can have security issues and all that. As I said, both have good and bad.
There are a couple of things that should be cleared.
Play framework comes with netty web server (not jetty, which is the server used by heroku), and play developers advice users to deploy on that server for production, mainly in order not to waste resources (a servlet container comes with lots of stuff that is not needed) and to deploy on the same platform that you are developing.
There are no performance issues deploying your application as a war exploded folder on any servlet container, it's just that you might be wasting resources.
The only disadvantage is that you won't be able to take profit of asynchronous requests.
Now there are lots of options to deploy a play application: openshift, heroku, gae, cloudbees, jelastic, dotCloud, playapps... in fact any servlet container will do.
have a look at this question: Experiences on free and low-cost hosting for play framework applications?.
if you are looking for an unexpensive option, I would go with openshift.
Apart from that is like Zenklys said, on a VPS you are your own IT department...

Cloud for Flex, Java, mongoDb?

I am about to develop my masters project using Flex as front end, BlazeDs, Java Web Services and MongoDB in the backend. I am looking to deploy and manage it on a cloud. (The application analyzes financial data from various sources, I will need to query multiple endpoints for news articles and DB for processing)
It is my experiment to usage of cloud rather than deploying on my local for demo and presentation purposes.
I saw heroku (http://www.heroku.com/), but I am not sure if it allows flash.
Please suggest a cloud application platform which allows Flex, BlazeDs, Java Web Services and MongoDB?
Amazon Web Services is a good place to start. You can have a instance ready in like 15-30min from signing up. If you are just experimenting, you ought to try to get the Amazon Linux Image (AMI) up and running. Scour the net on HOWTO set up Tomcat, for your requirements it might be too much to go J2EE, but you might know better.
But a word of advice, it's better to get your application working on a local machine first. Then drop the programmer hat and put on the deployment hat 100% cause it's a b!tch configuring deployment environment for Tomcat configurations, Blaze DS, Mongo's failover servers, load balancers and all kinds of non-programming tasks. You will want to work your development stack close to home so you can diagnose quickly.
Cloud business is great only when you want 1) Not use your home PC and bandwidth as a server 2) You want to have global mirror points to your application so that user's latency in one area of the world is not slower than another part of the world 3) You want to distribute computing load burden on one application across many instances of the same application.
Clouds are relatively cheap to deploy but if you got an application that hording GB's of bandwidth and storage, be prepared to fork over $1000's+ in costs. You can save money by going with an OS with no licensing costs to get a better rate.

Categories

Resources