Skip to content

Instantly share code, notes, and snippets.

@anaumov
Last active January 1, 2016 08:59
Show Gist options
  • Save anaumov/8121973 to your computer and use it in GitHub Desktop.
Save anaumov/8121973 to your computer and use it in GitHub Desktop.
deploy rails app
IP Address: somehost
Username: root
Password: root_password
ssh root@somehost
# if perl display errors aboul locale
locale
export LC_ALL="en_US.UTF-8"
apt-get update
apt-get -y install curl git-core python-software-properties
apt-get -y install build-essential zlib1g-dev curl git-core sqlite3 libsqlite3-dev libreadline6 libreadline6-dev
add-apt-repository ppa:nginx/stable
apt-get update
apt-get -y install nginx
nano /etc/init.d/nginx
# if nginx don't want to start check
http://askubuntu.com/questions/257108/trying-to-start-nginx-on-vps-i-get-nginx-unrecognized-service
#change daemon path to
/opt/nginx/sbin/nginx
service ngnix start
# your brawser should display nginx hello screen
#go futrther
add-apt-repository ppa:pitti/postgresql
apt-get update
apt-get -y install postgresql-9.2 libpq-dev
sudo -u postgres psql
#in postgres console
\password
pqssword_for_postgres_console
create user app_user with password 'some_pass';
create database app_production owner app_user encoding 'utf-8';
\q
# linux console
apt-get install postfix
apt-add-repository ppa:chris-lea/node.js
apt-get update
apt-get -y install nodejs
adduser deployer -ingroup sudo
user_secret_password
su deployer
cd
git clone git://github.com/sstephenson/rbenv.git ~/.rbenv
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bash_profile
echo 'eval "$(rbenv init -)"' >> ~/.bash_profile
source .bash_profile
git clone git://github.com/sstephenson/ruby-build.git
cd ruby-build/
sudo ./install.sh
rbenv install 2.0.0-p247
rbenv global 2.0.0-p247
ruby -v
gem install bundle --no-ri --no-rdoc
rbenv rehash
bundle -v
ssh git@github.com
# on your local mashine after capistrano deploy script configure
cap deploy:setup
cat ~/.ssh/id_rsa.pub | ssh deployer@somehost 'cat >> ~/.ssh/authorized_keys'
# tweek database.yml on server
# on local mashine
ssh-add -K
be cap deploy:cold
# on server
sudo rm /etc/nginx/sites-enabled/default
# probably you should kill nginx manualy
sudo service nginx restart
sudo update-rc.d unicorn_uni_promo defaults
# after this you can deploy like 'cap deploy'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment