Rails & mongrel & mongrel_cluster
今日は夜9:00過ぎにうちに帰ってきてからRails & mongrel & mongrel_cluster環境を一気につくってみた。環境はCentos5。よしよし。だいぶ自分の中でRailsの環境が飲み込めてきた。
ちなみにgem install の--include-dependenciesオプションはいらなくなったので書いてない。
MySQL関連
yum -y install mysql mysql-devel mysql-server ================================================= 手作業で/etc/my.cnfを編集してUTF-8に統一 ================================================= service mysqld restart chkconfig mysqld on mysqladmin -u root password 'xxxxx' gem install mysql -- --with-mysql-config=/usr/bin/mysql_config
RMagick
#RMagickのインストールに必要なフォント wget htt{長いので省略}msttcorefonts-2.0-1.noarch.rpm rpm -ivh msttcorefonts-2.0-1.noarch.rpm ln -s /usr/share/fonts/msttcorefonts/ /usr/share/fonts/default/TrueType/ # ポストスクリプトエラーが出る場合に必要らしい yum -y install ghostscript* # imagemagick関連のインストール yum -y install ImageMagick ImageMagick-devel # rmagickのインストール gem install rmagick
大方そろったところでディプロイ
=================================================
ここでCapistranoか何かでRailsアプリのディプロイ。
でも今日はCapistrano調べるところまで手が回らなかったので
手作業。
DBはMigrationとか使いこなしてないひとは、
開発環境で使ってるMySQLのテーブルコピーとかしても吉。
=================================================
apacheサーバの設定ファイル
以下のファイルを/etc/httpd/conf.d/配下にxxx.confと言う名前で保存
ProxyRequests OffOrder deny,allow Allow from all # 自分のサーバ内でMongrelに分散する設定 # サーバに一つ。BalancerMemberの数はサーバ負荷に応じて調整BalancerMember http://127.0.0.1:3000 BalancerMember http://127.0.0.1:3001 BalancerMember http://127.0.0.1:3002 ServerAdmin admin@example.com ServerName ホスト名+ドメイン名とか <=うちだとwww.clickyourstyle.com ServerAlias ドメイン名とか <=うちだとclickyourstyle.com ProxyPass / balancer://mongrelcluster/ ProxyPassReverse / balancer://mongrelcluster/
その後
chkconfig httpd on service httpd restart