16
Setting up Play Framework Deploying Play Framework in EC2 - part # 3 Kamarul kawnayeen

Play Framework in EC2

Embed Size (px)

Citation preview

Page 1: Play Framework in EC2

Setting up Play Framework

Deploying Play Framework in EC2 - part # 3

Kamarul kawnayeen

Page 2: Play Framework in EC2

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

Page 3: Play Framework in EC2

Installing JDK

Page 4: Play Framework in EC2

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

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

Page 5: Play Framework in EC2

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

hit enter to agree with the java license

Page 6: Play Framework in EC2

Select “<Yes>” to install oracle jdk

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

Page 7: Play Framework in EC2

Setup Typesafe Activator

Page 8: Play Framework in EC2

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

Page 9: Play Framework in EC2

It’s downloaded :)

Page 10: Play Framework in EC2

install unzip sudo apt-get install unzip

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

Page 11: Play Framework in EC2

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

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

Page 12: Play Framework in EC2

Add this line at the end of the file

Page 13: Play Framework in EC2

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”

Page 14: Play Framework in EC2

select “play-java” and then enter application name

Page 15: Play Framework in EC2

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

Page 16: Play Framework in EC2

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)