Play! Framework app on EC2 - amazon-ec2

I want to deploy and run my Play! Framework app on EC2.
I have installed the Play! Framework on one instance, now I don't want to copy my source code over but instead I want to "build" my app into libraries/jar/wars and copy the binary over and have play run against the binaries. Does Play! support that?

You can deploy your play application as standalone java application without installing play framework on EC2. You will need to generate distribution file of your play application by following step
Navigate to project folder
type play
type dist
This will generate project snapshot zip file in dist folder of your play application.
Upload that zip file to EC2 instance and extract in some folder. There you will find a start shell script file. Just execute that script file
Note: To make file executable type: chmod 777 start
./start
This will publish application and opens port to receive http request on default port 9000. If you want to change port when executing file,
./start -Dhttp.port=8080
This will publish application on port 8080

No, there is no native single-file format for play apps.
But, yes you can use any archive format for your purpose. Instead of running :
play command myfile
you'll do something like this :
unzip myfile; play command file;
Plus, you could always try using wars and rune those across multiple tomcats, but it would be a waste of ressources as native play server is better.

Well, the Play documentation mention it clearly that you can.
play war myapp -o myapp.war
Take a look on Play documentation, its very clear.

If you are using activator you can exploit its stage command which prepares all dependent libraries and compiles your code.
In my blog, I have tried to explain the whole deployment scenario of an Play application to an EC2 instance. Here is the link for more detail:
http://www.javacirecep.com/cloud/deploy-play-scala-applications-on-amazon-ec2/

Related

Google cloud app engine - How to edit code using SSH and debug-mode

I am trying to debug an application I have deployed to google cloud app engine. Reading the docs, I figured out that in order to do so I have to enter the debug mode using
gcloud app --project [Project ID] instances enable-debug
afterwards I am able to SSH into my instance and access root. Now I would like to edit some of the files. However, trying to use vim or nano does not seem to work.
Is there a way to edit those files without re-deploying the entire app?
Once you SSH into the App Engine instance and open a shell into the Docker container, you'll need to download the package list before installing nano or vim:
apt-get update && apt-get install nano
Then you can edit your app's files (which are in /app):
nano composer.json
The deployed app runs live code. It is not generally feasible to edit it. Moreover, changes made to the running container are not permanent; in fact they and are lost at the first re-start.
You may find some information on the Debugging an Instance page.
Unrelated to the above, an actual command-line editor is offered in the cloud shell.

Deploy hippo cms in heroku

In Hippo, There are two web applications packaged as war files inside a directory called webapps, a number of libraries in a directory called shared/lib, another set in a directory called common/lib, and some configuration files such as a log4j descriptor and a Tomcat context descriptor in the conf directory.
But in Heroku, I can not find the directory of tomcat to deploy these directory like the structure of Hippo (shared/lib, common/lib, conf)
Thank you
Hippo requires access to the entire Tomcat instance for setup at least. I've read through the Heroku documentation (most of it just skimmed), but I can't see that they provide that access.
However, there is possibly a second option which you may be willing to try; build Hippo in a docker image, and deploy that into Heroku:
Creating a docker container for hippo
Deploying docker container to Heroku
I haven't tried or tested any of this, so I can't guarantee it's success. But if you're limited to using Heroku, then it's at least worth a try.
Also, if you manage to get it running using docker, I would be extremely interested to know more details.

How to setup Pydevd remote debugging with Heroku

According to this answer I am required to copy the pycharm-debug.egg file to my server, how do I accomplish this with a Heroku app so that I can remotely debug it using Pycharm?
Heroku doesn't expose the File system it uses for running web dyno to users. Means you can't copy the file to the server via ssh.
So, you can do this by following 2 ways:
The best possible way to do this, is by adding this egg file into requirements, so that during deployment it gets installed into the environment hence automatically added to python path. But this would require the package to be pip indexed
Or, Commit this file in your code base, hence when you deploy the file reaches the server.
Also, in the settings file of your project if using django , add this file to python path:
import sys
sys.path.append(relative/path/to/file)

WSO2 Application Server wont start via jenkins post steps shell script

I am using jenkins CI to build my project. After the build I had post steps shell script copy the war to WSO2 application servers /repository/deployment/server/webapps/ folder. But what I observed was sometimes ( not always ), the server failed to redeploy the web application. Most of the times the web application would be redeployed using the new war file copied by jenkins into the webapps folder. But sometimes this did not happen. At such times the only solution was to stop the wso2as server, delete the web applications folder leaving only the new war file in wenapps directory and start the wso2as server again. This deployed the new war file and testing could proceed.
But we need to run automated selenium tests. So for the tests to run we need the new war file to be deployed reliably on every jenkins build.
So I wrote a little script in the jenkins post step like below :
#!/bin/bash
/home/kk/wso2as-5.0.1/bin/wso2server.sh stop &&
sleep 1m &&
rm -rf /home/kk/wso2as-5.0.1/repository/deployment/server/webapps/Duster_App1* &&
cp /home/kk/.jenkins/workspace/Dusters_App1/target/Duster_App1-${MAVEN_VERSION}.war /home/kk/wso2as-5.0.1/repository/deployment/server/webapps/Duster_App1.war &&
/home/kk/wso2as-5.0.1/bin/wso2server.sh start &&
echo Starting wso2as
This script runs. The wso2as server is stopped, the webapp folder is deleted, the new war file is copied corectly in place, I get the 'Starting wso2as' message on jenkins console output, BUT the wso2as server does not start. It remains in the stopped state. I introduced the sleep 1m line after the wso2server.sh stop command thinking the server may be taking time to shut down and hence fails to start again by the time the wso2server.sh start command is run. But no. The server is stopped cleanly before the start command is run as I have verified by following the log file as well as by ps aux command.
So what could be preventing the server from starting again?
IMO writing a script to delete webapp folder and restart the server from time to time would not be a good idea. I would suggest you to do following steps and then try the deployment from your jenkins build server to AppServer repository/deployment/server/webapps.
1.) Stop the server
2.) Open the [AS_HOME]/repository/conf/tomcat/catalina-server.xml config file
3.) Now make the unpackWARs attribute in Host element "false"
4.) restart the server
By default AppServer would extract the WAR file inside webapps, and it is possible that this could cause intermittent issues when deploying the same webapp again and again. Please try this way and see.
The WSO2 servers are OSGI based. The modules offer also web services for all tasks you can do in the admin console. If you start the server as ./wso2server.sh -DosgiConsole and you can list all service interaces with osgi> listAdminServices. You will find i.e. interfaces to upload WAR, CAR and AAR archives. The upload is one stateless call, but the handling of the artifact upload is a little bit tricky and you have also to deal with the self signed certificates of the WSO2 server. You can do the upload in a script language of your choice or make a simple Jenkins plugin and integrate this into your build job.
If you want comfort and don't do it yourself, use this Jenkins post-build plug-in to deploy the WAR into the WSO2 AS via the deployment web service API: https://github.com/ma-ha/Jenkins-WSO2AS-Deployer

XAMPPLITE / Web Application - auto install

Would like to hear comments from you if its possible to accomplish this with a single mouse click on a bat/exe file -> if its possible to accomplish the following two steps into one:
1: Install xampplite
2: Paste a web application into the htdocs folder. The web application has a file install.php. The install.php file will install the database and prepare the web application for further use.
Thanx,
Why should that not be possible? But installing xmapp on a computer with the generall installer asks you where you want to have the files.
An other idea could be by using the zip file. AFAIK you can unzip files from cmd (by invoking the zip function) to a destination you set, copy the webapplication to the htdocs folder, starting up apache and call an URL to your installer script.

Resources