Here is the steps I used to deploy a Rails application on a clean CentOS 5.7. Please comment if you have any suggestions.
- Install Prereq Package
- Install Ruby
- Step 1: Download
- Step 2: Install
- Step 3 Install Passenger
- Step 4: Make Phusion Passenger use Ruby Enterprise Edition instead of regular Ruby
- Step 5: Add Ruby enterprise to path
- Reboot
- Deploy the rails app
yum update -y yum install -y curl curl-devel mysql mysql-server mysql-devel httpd httpd-devel autoconf automake binutils gcc gcc-c++ zlib-devel openssl-devel readline-devel apr-devel apr-util-devel /sbin/chkconfig --levels 235 mysqld on /sbin/chkconfig --levels 234 httpd on
# Source code: version 1.8.7-2011.12 curl -O http://rubyenterpriseedition.googlecode.com/files/ruby-enterprise-1.8.7-2011.12.tar.gz
# Extract it: tar xzvf ruby-enterprise-1.8.7-2011.12.tar.gz # Run the installer (completely safe, none of your system files will be touched!): ./ruby-enterprise-1.8.7-2011.12/installer # Simply press Enter if asking for your input
/opt/ruby-enterprise-1.8.7-2011.12/bin/passenger-install-apache2-module # Simply press Enter if asking for your input
# Follow the instructions that the Ruby Enterprise Edition installer gave you.
export PATH=/opt/ruby-enterprise-1.8.7-2011.12/bin:$PATH reboot
1. gem install rubygems-update2. update_rubygems3. gem install sqlite3 -v '1.3.5' # create /etc/httpd/conf.d/passenger.conf# LoadModule passenger_module /opt/ruby-enterprise-1.8.7-2011.12/lib/ruby/gems/1.8/gems/passenger-3.0.11/ext/apache2/mod_passenger.so # PassengerRoot /opt/ruby-enterprise-1.8.7-2011.12/lib/ruby/gems/1.8/gems/passenger-3.0.11
# PassengerRuby /opt/ruby-enterprise-1.8.7-2011.12/bin/ruby
#
# virtualhost *:80="" /virtualhost
# ServerName server_name/server_name
# DocumentRoot app_dir/public/app_dir
# SetEnv rails_env production
# directory="" app_dir="" p="" public=""=""/app_dir=""/directory
# Allow from all
# Options -MultiViews
#
# # Place the rails app under
# Configuration of the database setting. Open the /config/database.yml with editor
# Change the username and password under the production tag according the database settings
# For example2:
# production:
# adapter: mysql2
# encoding: utf8
# database: production
# username:
# password:
# socket: /var/lib/mysql/mysql.sock- Init the rails app
- restart http server
/opt/ruby-enterprise-1.8.7-2011.12/bin/bundle install --no-deployment --without development --without test # Run only if the db is not created and the user has privilege to create database. # RAILS_ENV=production /opt/ruby-enterprise-1.8.7-2011.12/bin/rake db:create RAILS_ENV=production /opt/ruby-enterprise-1.8.7-2011.12/bin/rake db:migrate RAILS_ENV=production /opt/ruby-enterprise-1.8.7-2011.12/bin/rake assets:precompile # change the permissions of the application's directory chown -R apache:apache chmod -R u=rw,g=r,o-rwx chmod -R ug+X chcon -R -u system_u -t httpd_sys_content_t
/etc/init.d/httpd restart
Hiç yorum yok:
Yorum Gönder