Skip to content

Instantly share code, notes, and snippets.

@jakob85
Last active December 26, 2015 21:19
Show Gist options
  • Save jakob85/7214876 to your computer and use it in GitHub Desktop.
Save jakob85/7214876 to your computer and use it in GitHub Desktop.
1. Key
Download key.
Move to ./ssh
Make visible for ssh sudo chmod 400 ../.ssh/reco-keypair.pem
2. Connect to instance
ssh -i ../.ssh/reco-keypair.pem [email protected]
3. Download java 1.7 and install
sudo mkdir -p /usr/lib/jvm
cd /usr/lib/jvm
sudo wget --no-cookies --header "Cookie:gpw_e24=xxx" http://download.oracle.com/otn-pub/java/jdk/7u45-b18/jdk-7u45-linux-x64.tar.gz
sudo tar -xvf jdk-7u45-linux-x64.tar.gz
sudo update-alternatives --install "/usr/bin/java" "java" "/usr/lib/jvm/jdk1.7.0_45/bin/java" 1
sudo update-alternatives --install "/usr/bin/javac" "javac" "/usr/lib/jvm/jdk1.7.0_45/bin/javac" 1
sudo update-alternatives --install "/usr/bin/javaws" "javaws" "/usr/lib/jvm/jdk1.7.0_45/bin/javaws" 1
vi /etc/profile
JAVA_HOME=/usr/lib/jvm/jdk1.7.0_45
JRE_HOME=/usr/lib/jvm/jdk1.7.0_45
PATH=$PATH:$HOME/bin:$JAVA_HOME/bin:$JRE_HOME/bin
export JAVA_HOME
export JRE_HOME
export PATH
4. Install scala 2.10.3
wget http://www.scala-lang.org/files/archive/scala-2.10.3.tgz
tar zxf scala-2.10.3.tgz
sudo mv scala-2.10.3 /usr/share/scala
sudo ln -s /usr/share/scala/bin/scala /usr/bin/scala
sudo ln -s /usr/share/scala/bin/scalac /usr/bin/scalac
sudo ln -s /usr/share/scala/bin/fsc /usr/bin/fsc
sudo ln -s /usr/share/scala/bin/scaladoc /usr/bin/scaladoc
sudo ln -s /usr/share/scala/bin/scalap /usr/bin/scalap
5. User
groupadd playapps
useradd -m -g playapps playapps
passwd playapps
set pass
6. Play2
sudo apt-get install unzip
sudo mkdir /usr/share/play
cd /usr/share/play
sudo wget http://downloads.typesafe.com/play/2.2.0/play-2.2.0.zip
sudo unzip play-2.2.0.zip
sudo ln -s play-2.2.0/play play
sudo ln -s /usr/share/play/play /usr/bin/play
sudo chmod a+x /usr/share/play/play-2.2.0/play
In .profile add :/usr/share/play
sudo chmod a+x /usr/share/play/play
sudo chown -R playapps:playapps /usr/share/play
Remember to change all permissions like:
sudo chown playapps:playapps -R /usr/share/play/play-2.2.0/repository/
7. Nginx
sudo apt-get install nginx
sudo service nginx start
// To start when restart
update-rc.d nginx defaults
http://www.playframework.com/documentation/2.2.0/HTTPServer
add to /etc/nginx/nginx.conf:
vi /etc/nginx/nginx.conf
upstream my-backend {
server 127.0.0.1:9003;
}
#server {
# server_name www.mysite.com mysite.com;
# rewrite ^(.*) https://www.mysite.com$1 permanent;
#}
server {
# listen 443;
# ssl on;
# ssl_certificate /etc/ssl/certs/my_ssl.crt;
# ssl_certificate_key /etc/ssl/private/my_ssl.key;
# keepalive_timeout 70;
# server_name www.mysite.com;
location / {
proxy_pass http://my-backend;
}
}
8. Http.d
Add script and set permissions
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment