Play Framework in EC2

Post on 06-Aug-2015

84 Views

Category:

Technology

4 Downloads

Preview:

Click to see full reader

Transcript

Setting up Play Framework

Deploying Play Framework in EC2 - part # 3

Kamarul kawnayeen

PrefaceThis is the final part of deploying playframework in EC2 tutorial series. At part one, I showed how to setup a virtual server. At part two, I setup lamp stack on that virtual server. In this part, I’ll show how to deploy a play application. It will require following steps:-➢ Install Java Development Kit (jdk)➢ Setup typesafe activator➢ Create & deploy play application

Installing JDK

Connect with your remote server using terminal & use the following two command -

sudo add-apt-repository ppa:webupd8team/java -ysudo apt-get update

now, use sudo apt-get install oracle-java8-installer -y

hit enter to agree with the java license

Select “<Yes>” to install oracle jdk

Once you are done, use the following command to check java versionjava -version

Setup Typesafe Activator

create a directory for activator and go theresudo mkdir /usr/share/activator

cd /usr/share/activator

now download activator using the following commandsudo wget http://downloads.typesafe.com/typesafe-activator/1.3.2/typesafe-activator-1.3.2.zip

It’s downloaded :)

install unzip sudo apt-get install unzip

now unzip the activatorsudo unzip typesafe-activator-1.3.2.zip

now, sudo chmod -R a+x activator-1.3.2

open bash.bashrc using nanosudo nano /etc/bash.bashrc

Add this line at the end of the file

now either restart your virtual machine or use “source .bashrc”

go to the directory where you want to create your application and type “activator new”

select “play-java” and then enter application name

As we are working on a free t2 micro instance & we have only 1 GiB of Ram, so we must face problem in starting the play application. An easy work around is lowering the heap memory.

So first set initial heap size to 128 M & max heap size to 512 M by the following commandexport _JAVA_OPTIONS=”-Xms128m -Xmx512m”

then use the followingactivator start

once the application started, go to your browser & type{ip_address_of_your_virtual_machine}:9000

and hit enter

All praises and thanks be to Allah, the lord of ‘Alamin (mankind, jinns and all that exists)

(Al-Fatihah : 2)

top related