Comparing versions 1 and 1.

SetupDeployment

This page describes how to set up and deploy to staging and production servers.

Required server software

You need nginx or apache, ruby, rails, mongrel. For Debian/Ubuntu server execute:

apt-get install nginx ruby1.8 rdoc1.8 irb1.8
apt-get install sudo subversion gcc make libstdc++6-dev ruby1.8-dev libmysql-ruby
cd /tmp
wget http://rubyforge.org/frs/download.php/29548/rubygems-1.0.1.tgz #from http://rubyforge.org/frs/?group_id=126
tar xzf rubygems-1.0.1.tgz
cd rubygems-1.0.1 && ruby setup.rb
gem install rails -v=2.0.2 -y
gem install mongrel -y
apt-get install librmagick-ruby # if you need image magick support 

Edit the deploy.rb capistrano script

Adjust your application settings in config/deploy.rb
  • Replace all my_project string with your application_name.
  • Set username and password for your repository by modifing scm_username and scm_password variables.
  • Set your stage and production servers in role statements
Install capistrano gem:
gem install capistrano -y

Configure server, first time

Execute to setup application directories on servers:
cap deploy:setup
Create a folder /etc/rails/<application_name>
Create production db
# mysqladmin create <application_name>_production
# mysql
> GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,DROP,ALTER,INDEX ON <application_name>_production.* TO <app_user>@localhost IDENTIFIED BY 'Str0ng-Passw0rd!';
> FLUSH PRIVILEGES;
Copy to above folder database.yml and configure production db
Copy nginx.conf from the file tab to the /etc/nginx/ folder and modify it to sweet your needs and reload config
/etc/init.d/nginx reload
Run on local computer:
cap deploy
cap deploy:migrate
Note: To deploy to production servers, use:
ruby script/production_deploy
export PRODUCTION=1 && cap deploy:migrate
# or execute on the server:
rake db:migrate RAILS_ENV=production

Setting up continuous integration

You will need to install capistrano gem on deploy machine:
gem install capistrano -y
Copy deploy_project.sh from Files tab to machine, checkout your project in ~/projects folder and setup a cron job with command: crontab -e
0       *       *       *       *       /path/to/deploy_project.sh my_project

History Key

  • New content
  • Removed content

Recent Versions

Choose two versions to compare, or click the link to view it.

  1. 1. 5 months by andy