Play Framework in EC2
-
Upload
kamarul-kawnayeen -
Category
Technology
-
view
85 -
download
4
Transcript of Play Framework in EC2
![Page 1: Play Framework in EC2](https://reader031.fdocuments.in/reader031/viewer/2022020307/55c37177bb61eba8498b468e/html5/thumbnails/1.jpg)
Setting up Play Framework
Deploying Play Framework in EC2 - part # 3
Kamarul kawnayeen
![Page 2: Play Framework in EC2](https://reader031.fdocuments.in/reader031/viewer/2022020307/55c37177bb61eba8498b468e/html5/thumbnails/2.jpg)
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](https://reader031.fdocuments.in/reader031/viewer/2022020307/55c37177bb61eba8498b468e/html5/thumbnails/3.jpg)
Installing JDK
![Page 4: Play Framework in EC2](https://reader031.fdocuments.in/reader031/viewer/2022020307/55c37177bb61eba8498b468e/html5/thumbnails/4.jpg)
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](https://reader031.fdocuments.in/reader031/viewer/2022020307/55c37177bb61eba8498b468e/html5/thumbnails/5.jpg)
now, use sudo apt-get install oracle-java8-installer -y
hit enter to agree with the java license
![Page 6: Play Framework in EC2](https://reader031.fdocuments.in/reader031/viewer/2022020307/55c37177bb61eba8498b468e/html5/thumbnails/6.jpg)
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](https://reader031.fdocuments.in/reader031/viewer/2022020307/55c37177bb61eba8498b468e/html5/thumbnails/7.jpg)
Setup Typesafe Activator
![Page 8: Play Framework in EC2](https://reader031.fdocuments.in/reader031/viewer/2022020307/55c37177bb61eba8498b468e/html5/thumbnails/8.jpg)
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](https://reader031.fdocuments.in/reader031/viewer/2022020307/55c37177bb61eba8498b468e/html5/thumbnails/9.jpg)
It’s downloaded :)
![Page 10: Play Framework in EC2](https://reader031.fdocuments.in/reader031/viewer/2022020307/55c37177bb61eba8498b468e/html5/thumbnails/10.jpg)
install unzip sudo apt-get install unzip
now unzip the activatorsudo unzip typesafe-activator-1.3.2.zip
![Page 11: Play Framework in EC2](https://reader031.fdocuments.in/reader031/viewer/2022020307/55c37177bb61eba8498b468e/html5/thumbnails/11.jpg)
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](https://reader031.fdocuments.in/reader031/viewer/2022020307/55c37177bb61eba8498b468e/html5/thumbnails/12.jpg)
Add this line at the end of the file
![Page 13: Play Framework in EC2](https://reader031.fdocuments.in/reader031/viewer/2022020307/55c37177bb61eba8498b468e/html5/thumbnails/13.jpg)
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](https://reader031.fdocuments.in/reader031/viewer/2022020307/55c37177bb61eba8498b468e/html5/thumbnails/14.jpg)
select “play-java” and then enter application name
![Page 15: Play Framework in EC2](https://reader031.fdocuments.in/reader031/viewer/2022020307/55c37177bb61eba8498b468e/html5/thumbnails/15.jpg)
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](https://reader031.fdocuments.in/reader031/viewer/2022020307/55c37177bb61eba8498b468e/html5/thumbnails/16.jpg)
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)