2010年6月21日 星期一

capistrano path rake fail

http://blog.zerobearing.com/2009/04/27/capistrano-rake-command-not-found/
http://stackoverflow.com/questions/588934/using-ruby-enterprise-edition-gems-are-not-installed-where-i-would-expect
http://forum.slicehost.com/comments.php?DiscussionID=3657
http://stackoverflow.com/questions/257616/sudo-changes-path-why
http://groups.google.com/group/emm-ruby/browse_thread/thread/d0c685bbd096823a#msg_effa7d6ad42c541c
http://www.f15ijp.com/2009/11/30/sudo-no-tty-present-and-no-askpass-program-specified/

/etc/ssh/sshd_config:

PermitUserEnvironment yes
/etc/init.d/sshd restart


~/.ssh/environment
PATH=/opt/ruby-enterprise-1.8.7-2010.02/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games


http://formatinternet.wordpress.com/2009/07/06/sudo-rake-command-not-found/
~/.bashrc
alias sudo='sudo env PATH=$PATH'


sudo ln -s `which rake` /usr/local/bin/

#sudo: no tty present and no askpass program specified error
the /etc/sudoers file.
#commend sudo visudo
Defaults visiblepw

2010年6月13日 星期日

delayed_job capistrano production fail

主要參考
http://railscasts.com/episodes/171-delayed-job
http://www.magnionlabs.com/2009/2/28/background-job-processing-in-rails-with-delayed_job

不知道哪邊弄錯了用capistrano deploy 想啟動delayed_job 卻好像都沒反應
後來終於看到 有script/delayed_job run的指令 這個動作才可以讓你看到你錯在哪, start 只會無聲無息

2010年6月3日 星期四

nginx passenger config

nginx, worker_processes, and passenger_max_pool_size
Production Rails Tuning with Passenger: PassengerMaxProcesses

 
worker_processes 4; <= Setting the number of Nginx workers to the number of CPU cores should be sufficient.

http {
passenger_max_pool_size 20; # memory 256M should be 2, 2G should be 30, max_pool 不要設太大, 不要讓它吃到swap, free -ml ; vmstat 2 都可以看到現在memory 的情況
passenger_max_instances_per_app 15; #每種ap 能用到最多的instance, 所以如果跑兩個app 就會再少一點

# PassengerPoolIdleTime
# Recommended to be avg time per page * 2
# In Google Analytics... (Avg time on site / Avg page views) * 2
# Default: 300
passenger_pool_idle_time 144

}


超小型web server 設定
How to save MUCH RAM when running rails (linode/slicehost) and mod_rails passenger

2010年5月7日 星期五

改變預設的cache 目錄

http://railsforum.com/viewtopic.php?id=11033

2010年4月20日 星期二

[Ptt][心得] Restful下遇到params[:id]含有.的解法

在restful的前提下, 遇到class的to_param是字串, 而剛好某筆
紀錄的to_param欄位含有.

一般情形下會發生錯誤, 因為restful會把.後的東西當成format
這時的解法, 變成要在routes.rb中的xxx.resources加上參數

ex:

paramter change permanently, header status