shitou's blog 

  • Home
  • About
  • Feed
  • 十人族
  • MIX BOY
  • 塌客

Tags "架构"

13
Feb

Debian中ruby on rails运行环境的搭建

很久之前的笔记了,现在整理出来, 这里采用的是Apache + Mongrel Cluster, 其实shitou个人还是喜欢Lighttpd + FastCGI搭配的说,因为其他原因只能现在跑这样的环境啦- -||


软件:

ruby-1.8.7-p72.tar.gz

rubygems-1.3.0.tgz

ruby-zlib-0.6.0.tar.gz

mysql-ruby-2.8.tar.gz

 

安装:

安装ruby

#apt-get install gcc libc6-dev make tmake autogen automake \

build-essential indent intltool

#tar zxvf ruby-1.8.7-p72.tar.gz

#cd ruby-1.8.7-p72

##开启最后一行的zlib支持

#vi ext/Setup

#./configure --prefix=/usr/local/ruby

#make; make install

##把/usr/local/ruby/bin加入环境变量PATH中, 并写入文件/root/.profile中

#apt-get install zlib1g-dev

#cd ext/zlib

#ruby extconf.rb;

#make; make install

 

 

安装rubygems

#tar zxvf rubygems-1.3.0.tgz

#cd rubygems-1.3.0

#ruby setup.rb

 

安装rails

#gem install rails –version 2.0.2

 

支持rails console

#apt-get install libreadline5-dev

#cd ruby-1.8.7-p72/ext/readline

#ruby extconf.rb

#make; make install

 

在不安装SSL的话rails应用启动会报错

#apt-get install libssl-dev

#cd ruby-1.8.7-p72/ext/openssl

#ruby extconf.rb

#make; make install

 

安装mysql

#apt-get install mysql-server mysql-client libmysqlclient15-dev

 

安装ruby的mysql的C接口

#tar zxvf mysql-ruby-2.8.tar.gz

#cd mysql-ruby-2.8

#ruby extconf.rb –with-mysql-include=/usr/include/mysql –with-mysql-lib=/usr/lib

#make; make install

 

安装mongrel

#gem install mongrel mongrel_cluster

 

Apache, PHP的安装

#apt-get install apache2

#apt-get install php5 php5-mysql libapache2-mod-php5 php-pear

 

mongrel的配置

/railsapp/config/mongrel_cluster.yml:

cwd: /var/www/rails/cal_point
port: 3000
environment: production
group: www-data
user: www-data
address: 127.0.0.1
pid_file: log/mongrel.pid
servers: 3

 

Apache开启Proxy的相关模块, 配置

/etc/apache2/httpd.conf:

<Proxy balancer://myproxycluster>
    #loadfactor is the weight of the server, range 1-100, the bigger the stronger
    BalancerMember http://127.0.0.1:3000    loadfactor=10
    BalancerMember http://127.0.0.1:3001    loadfactor=10
    BalancerMember http://127.0.0.1:3002    loadfactor=10
</Proxy>

ProxyPass / balancer://myproxycluster/
ProxyPassReverse / balancer://myproxycluster/


启动mongrel cluster:

进去rails项目的根目录:

#mongrel_rails cluster::start

注意: 启动前要保正log文件夹的权限为Apache运行用户(在debian中一般是www-data)可写的

 

Tags: debian,架构

2009-02-13 16:48:23, 956 reviews, comment

send to mailbox

Your email:

24
Oct

几篇rails架构的文章

 找到两篇不错分析rails系统架构的文章, 太长了, 懒得翻译了, 把地址贴出来吧

 

 

Can Rails Scale? Absolutely!

 

The Rebuilding and Scaling of YellowPages.com



Tags: 架构

2008-10-24 11:40:37, 1054 reviews, comment

send to mailbox

Your email:

Tags

json Impactjs Canvas fun gen_server superfly PS3 Webgame HTML5 jquery SSH tenerer MooseFS gearman-ruby Gearman MongoDB MochiChat TCP U-ka saegusa IN db command Mai Kuraki Norah Jones log iPhoneException ACG Mac Safari objective-c CouchDB LVS AJAX debian 推荐 AMQP google mail bug gettext Erlang 北京 iptables 架构 tips mysql backup function 我看 postfix 监控 SEO cache Etag memcache thread 进程 线程 无锡 yield file column mixboy xml rss gems ruby shitou shell lighttpd 安全 csrf 公司 nginx linux 模块 apache webserver 朋友 大学 生活 尼古拉斯凯奇 movie 文件同步 笑笑 歌词 auto complete plugin rails music ubuntu blog

Category

  • HTML5[3]
  • iPhone[17]
  • Erlang[11]
  • google[13]
  • 生活[45]
  • 音乐[13]
  • 电影[11]
  • linux[29]
  • web server[6]
  • mail server[3]
  • cluster[1]
  • system manage[9]
  • ruby[20]
  • ruby on rails[28]
  • 开源[4]

Episode

  • MongoDB
  • MochiChat
  • iPhoneException
  • shell
  • thread
  • memcache


Popular Posts

  • 准备开始学习Erlang了(恶狼, 二郎..)
  • Ruby遍历MemCached的key
  • 服务器监控小脚本
  • MySQL Innodb备份
  • [转载]5个有用的ruby gems

Recommended Posts

  • Tri-survive - HTML5 Game
  • Cut the rope - HTML5版
  • json_formatter
  • 在gen_server中spawn新的进程
  • Superfly - Wildflowers
  • 继续凸墙 for Mac OS
  • MongoDB Beijing 2011
  • MongoDB删除map_reduce生成的tmp collection
  • Mai Kuraki - Future Kiss
  • Erlang OOP
  • 用SSH tunnel凸墙
  • Google的语法高亮工具包
  • 大量数据的批量操作
  • 再次被和谐-_-
  • 十人族: 上线了

Friends' blogs

  • levy
  • sphance
  • andreas
  • yangkunlun
  • {:dev=>:wxianfeng}
  • bheye
  • joeydarko

Login

   注册

留言 查看留言

留言

   取消

留言 查看留言


Statistics

  • 访问次数: 316248
  • 今天访问: 43
  • 日志: 213
  • 评论: 4967
  • 音乐: 9
  • 用户: 1758


少女,不点下广告吗!

 

all by shitou

blog comments powered by Disqus

close