I have created a Web Application with the latest version of the play framework and am ready to deploy it. Since this is the first time I will deploy a web application onto a server I am not 100% sure how to to that.
I need to run a lot of cronjobs on the databases, which is why I have ordered a Vserver which came with Debian 7.8 LAMP installed.
What I am asking now is what is the simplest way to deploy my App onto my server?
What I would try if I wouldn't ask this question now, is to install play on my debian server (well actually I probably would have to install the activator thing nowadays instead right?) than upload my app to the server, change the deployment port of the app to 80, put the application in production mode and than start the app on the server or use the stage task command.
Is this the right way to do it? I do not want to make mistakes.
There is no right way to do it.
You have 4 choices (more if you include Maven distributions, etc.) but for the case 'I want to run my app on my server' there you go:
use start but it needs human intervention (interaction) so you might not want to do this in an actual production settings.
use stage to prepare your app for deployment. stage prepares some scripts which you can then call from /etc/init
The above methods NEED Play to be present on the server machine. So if you do not want to have Play! on your server... here you go:
use dist to create a zip file with everything in it... then just unzip the file somewhere in the server and run the scripts in the bin directory
Create a native package that will install your app as a (in your case) a Debian package.
Check this out (official docs):
https://www.playframework.com/documentation/2.3.x/Production
Related
Perhaps I pop this question to early as Openshift v3 is still in preview, nevertheless there might be a solution to my problem that I don't see :).
I'm taking my first steps in building a java Play framework app and chose Openshift as my hosting platform. I just was able to get my app + mysql db working on Openshift v2 as they released v3 preview and got notice v2 will eventually disappear.
In the new images/templates there is still no Java Play version showing and no 'do it yourself cartridge' way.
Any hints or 'tutorial' links are much appreciated :).
Thanks and kind regards!
Erik
You have two options here.
SBT Native Packager
First option would be using the SBT Native Packager SBT builder to create your Docker images (either manually or using something like Jenkins). Out of the box you should be able to run sbt docker:publishLocal and get a local docker image which you can then push to a Docker repo. You can then launch it in openshift with oc new-app <docker repo>/<docker image>:<image version>.
Down side to this is that you aren't really taking advantage of OpenShift fully since your images are being built elsewhere. But it might fit well with your current development flow.
Upside is that your docker images will be quite small. SBT does a good job of packaging up all the dependencies.
Source to Image
Second option would be to create your own source to image builder that knows how to build sbt/play projects. This is the path my team has taken. You can take a look at our sbt builder for reference but its still beta quality at best.
Downside to this process is that all your source is included in the image so its a big larger. Also no one supports this builder so if you have bugs you are on your own.
Upside is that OpenShift will build your images and you will see your build status inside the OpenShift web console.
Notes
With OpenShift Origin 1.3.0 you will also get access to the Jenkins pipeline. This can make either of the two above scenarios easier. You end up with a cool web interface that looks like this:
Hopefully RedHat will support sbt natively at some point but for now one of these two flows should work for you.
For everyone looking for an answer to my own question, here is how I got a Play app running on Openshift (own installation).
First of all, a big thank you #PatrickTescher. His answer pointed me in the right direction.
I did not yet succeed in getting a docker build by activator to work in Openshift (guessing it has to do with running under root), but I have gotten to the point where I have a Source to Image build running on my own Openshift Cluster. This approach is not yet possible with the online developer preview of Openshift. By all the reading I have done so far, I agree with Patrick to say this is the best approach.
By diving into the following links, you should get up and running:
Installing docker on a Windows vm: https://docs.docker.com/toolbox/overview/
Installing your own Openshift Cluster: https://github.com/openshift/origin/blob/master/docs/cluster_up_down.md#windows-with-docker-toolbox (in addition: https://github.com/openshift/origin/issues/11277)
Get a s2i image up and running: https://github.com/redhat-cop/containers-quickstarts/tree/master/s2i-play
In the last link you can change registry.access.redhat.com/rhel7.2 by registry.centos.org/centos/centos:latest (rhel needs certification, centos is the free community equivalent)
for those who are familiar with the web application iteraplan, I really need help. I've been having trouble getting iteraplan to work on my Mac because some factors or requirements can't be fulfilled.
For this reason I needed to install Tomcat since it's a web application but I'm a newbie to it. Tomcat doesn't work even though I installed it properly, moved it to the right folder and made sure that Eclipse recognizes it as a server. When I'm trying to open anything on Tomcat on my localhost I can't open further pages of Tomcat because I always receive the same error:"The requested resource is not available" When I'm trying to run the web application iteraplan through my terminal, the localhost doesn't open either and I get the same error.
I already changed most of the server file (which seems necessary for getting the web application to work) but that doesn't help either. Is there anything I might gave forgotten? Maybe something I would have to launch or something?
I would be glad for any advice because I desperately need this to work for my thesis.
Thanks in advance.
Yash, have you made sure that your Tomcat installation is working properly? You should be able to access the manager app (usually under localhost:8080/manager/html) and see all running applications, regardless of whether you have iteraplan deployed on the server or not. Also, to run iteraplan, you need a database (details can be found in the iteraplan installation guide: http://www.iteraplan.de/wiki/display/iteraplan34/Installation+Guide). Finally, if you just want to run the application, without modifying the code, it would be simpler to download one of the bundles available in sourceforge (http://sourceforge.net/projects/iteraplan/files/iteraplan Community Edition/). They have a Tomcat server and a database included.
So ive made a client-server application with java and Netbeans , the server is a glassfish server and they communicate with SOAP .
Everything is working perfectly , but the problem is that its a uni project and they dont look at the source code , they need binaries or jars .
Now when you build a web app , the IDE generates a .war file that would be deployed in your glassfish server (thats how i know it works , correct me if im wrong) .So in order for it to work on another PC that PC would need to have glassfish installed ?
Usually the teacher would click some "client.exe" and a "server.exe" and test things out , but im afraid this wouldnt work this time .
Is there a way like an .exe that opens a window and one would select what .war to deploy or the teacher has to install glassfish and go to admin page and deploy the war just like i would do on my PC ? if its the only way i can include a glassfish installation with some tutorial in a power point to explain how to deploy the app ... but i wonder if theres a fool-proof way since i dont know if my teacher is smart enough to do it the right way .
Actually he would need to deploy the application on a local application server as well. Unfortunately the only solution I can think of is to make it accessible via public URL. Maybe your university does provide some kind of a free VPS.
If (!) Java SDK 7 is installed you could try Payara Micro, which is derived from GlassFish 4 and enables you to run war files from the command line without any application server installation.
I have created a java application.
I also created another java application which install the first application.
The program runs perfectly.
However the program isn't displayed in control panel->programs.
I also want to create an uninstaller (let's say unintaller.bat). But i want to works like any other uninstaller. When someone goes to Control Panel->serach program->uninstall this program it will run the uninstaller.bat
In other words, the concept is how to declare the java application in windows...
Any idea???
Installing an application doesn't necessarily mean registering it with the operating system. For example, for a Mac, I can open an App without having it added to the Applications folder.
Same with Windows. Just because a new file can be added to the Start menu, it doesn't mean it was registered.
Use a Windows installer. There are tons that are open source, and even MS provides a free one: http://support.microsoft.com/kb/942288.
This will allow you to install an uninstall an application using standard tools. Yes. It can be called from a bat file.
Java open source installers: http://java-source.net/open-source/installer-generators
Trying to run basic java application (backbone.js and jax-rs) I was pleasantly surprised that modifying js or html file in src/main does not require application rebuild. Just refreshing it in browser is enough to update the application.
However changing java file, I can't find how to make application be updated locally.
Using Eclipse it's automatically compiled into target/classes, however applicaiton is not updated in browser. I can't find any bees command to cause update. I don't see compile command also.
Killing running tomcat and 'bees run' makes the trick, but the question is, if instant update is possible in case of basic java web application?
I'm not sure how to do it with a normal Java app. One option would be to use Playframework has this auto-reloading stuff built in, and is supported well on CloudBees. http://wiki.cloudbees.com/bin/view/RUN/Playframework
You need to use something like JavaRebel or Javeleon if you wish to reload Java classes in a running application.