sudo apt-get update
sudo apt-get install build-essential zlib1g-dev libssl-dev libreadline-dev libyaml-dev libcurl4-openssl-dev curl git-core python-software-properties libsqlite3-0 libsqlite3-dev sqlite3
cd /tmp/
wget ftp://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p194.tar.gz
tar -xvzf ruby-1.9.3-p194.tar.gz
cd ruby-1.9.3-p194/
./configure
make
sudo make install
echo "gem: --no-ri --no-rdoc" >> ~/.gemrc
sudo gem install bundler
apt-get install vim
Move in the text with the arrow keys.
To start to edit press the key (I)(i).
To save and exit the file press (Esc) and write ":wq".
":" for command, "w" for write and "q" to quit.
sudo apt-get install postgresql-9.1 postgresql-server-dev-9.1
gem install pg
Add an user for deploy in your postgres
sudo -u postgres createuser some_user
cd /etc/init.d/
sudo -u postgres psql template1
template1=# ALTER USER some_user WITH PASSWORD 'some_password';
To exit the postgres console, press Control + D.
Now you need edit this file: vim /etc/postgresql/9.1/main/pg_hba.conf
Where is the 'postgres' your replace by some_user, will be something like that:
# Database administrative login by Unix domain socket
local all some_user peer
And restart your postgres
sudo service postgresql restart
sudo apt-get install memcached libmemcached-dev
gem install dalli
sudo apt-get install imagemagick libmagickwand-dev
gem install rmagick mini_magick
gem install passenger
sudo chown -R `whoami` /opt
passenger-install-nginx-module --auto-download --auto
sudo adduser deploy
vim /opt/nginx/conf/nginx.conf
server {
listen 80;
server_name www.example.com;
location / {
root /home/deploy/www/application_name/current/public;
passenger_enabled on;
rails_env production;
}
}
Nginx as a service
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
Now you can do something like that:
sudo service nginx start
sudo service nginx stop
sudo service nginx restart
In your local app add gem 'capistrano'
in your Gemfile
In your application dirictory:
bundle install
capify .
This will create the files Capfile
and config/deploy.rb
where settings are stored deploy, as well as tasks.
Replace this files by gist:3868139 and edit with your data.
Create the database.yml for your server configuration in:
/home/deploy/database.yml
Still in your local app and run this:
cap deploy:setup
This will create the directories in your server.
Now you can make deploy of your application:
cap deploy