Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
# IN AMAZON EC2 SERVER #
########################
sudo su
apt-get -y update && apt-get -y upgrade
apt-get install vim git-core curl openssh-server openssh-client python-software-properties build-essential zlib1g-dev libssl-dev libreadline-gplv2-dev libcurl4-openssl-dev aptitude
/usr/sbin/groupadd wheel
/usr/sbin/visudo
(paste bottom)
%wheel ALL=(ALL) ALL
/usr/sbin/adduser deploy
/usr/sbin/usermod -a -G wheel deploy
su deploy
cd ~
mkdir .ssh
sudo cp /home/ubuntu/.ssh/authorized_keys .ssh/
sudo chmod -R 700 .ssh/
sudo chown deploy:deploy .ssh/authorized_keys
sudo chmod 600 ~deploy/.ssh/authorized_keys
curl -L get.rvm.io | bash -s stable
source ~/.rvm/scripts/rvm
rvm requirements
rvm install 2.0.0
rvm use 2.0.0
ruby -v
rvm @global do gem install passenger
rvmsudo passenger-install-nginx-module
(Select Ruby)
(Select option 1 [recommended])
(/opt/nginx directory)
(Out of memory error? add a swap: https://www.digitalocean.com/community/articles/how-to-add-swap-on-ubuntu-12-04)
wget -O init-deb.sh http://library.linode.com/assets/660-init-deb.sh
sudo mv init-deb.sh /etc/init.d/nginx
sudo chmod +x /etc/init.d/nginx
sudo /usr/sbin/update-rc.d -f nginx defaults
sudo /etc/init.d/nginx stop
sudo /etc/init.d/nginx start
sudo apt-get install nodejs
# NGINX CONFIGURATION #
#######################
sudo mkdir /opt/nginx/sites
sudo vim /opt/nginx/conf/nginx.conf
(remove server {...})
(add the following:)
include /opt/nginx/sites/*;
sudo vim /opt/nginx/sites/<WEBSITE_NAME>
(The following is needed)
server {
passenger_enabled on;
root /home/deploy/WEBSITE/current/public;
passenger_friendly_error_pages off;
rails_env production;
location ~ ^/assets/ {
expires 1y;
add_header Cache-Control public;
add_header ETag "";
break;
}
}
# Things to do: add gzip, set recommended workers etc..
# SSH CONFIGURATION: AMAZON-EC2 SERVER => BITBUCKET #
#####################################################
su deploy
ssh-keygen -t rsa
vim /home/deploy/.ssh/id_rsa.pub
(copy content into: bitbucket.org > manage account > ssh keys > add key)
ssh -T git@bitbucket.org
# EXTRAS #
##########
sudo su
vim ~/.bashrc
(paste bottom)
PS1='\[\033[0;32m\]\u@\h\[\033[0;36m\] \w\[\033[00m\]: '
source ~/.bashrc
su deploy
vim ~/.bashrc
(paste bottom)
PS1='\[\033[0;35m\]\u@\h\[\033[0;33m\] \w\[\033[00m\]: '
alias free="free -m"
alias update="sudo aptitude update"
alias install="sudo aptitude install"
alias upgrade="sudo aptitude safe-upgrade"
alias remove="sudo aptitude remove"
source ~/.bashrc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.