專案用到的 thinking_sphinx 沒有正常執行 crontab index,於是下去 trace,
發現是在 cap deploy 時造成的錯誤。

在 contab 裡的設定如下:


而我的 cap deploy 是這樣跑的
#cap deploy -n
* 以上略
* executing `deploy:after_update_code'
* executing `thinking_sphinx:start'
* executing `thinking_sphinx:configure'
* executing "cd /myapp/current; rake RAILS_ENV=production thinking_sphinx:configure"
* executing "cd /myapp/current; rake RAILS_ENV=production thinking_sphinx:start"
* executing `deploy:symlink'
* executing "rm -f /myapp/current && ln -s /myapp/releases/20100525083656 /myapp/current"

因為在執行 thinking_sphinx:configure thinking_sphinx:start 後才做 symlink,
結果生出來的 production.sphinx.conf 就這樣被砍掉,
而 crontab 執行時就會找不到 production.sphinx.conf 檔。

因為很明顯的是 thinking_sphinx 的 bug,於是看了一下版號,是個有夠舊(1.2.12, 現在[2010/05/25]是 1.3.16)
跑去找最新的版本來測試,果然。

* executing `deploy:after_update_code'
* executing `thinking_sphinx:start'
* executing `thinking_sphinx:configure'
* executing "if [ -d /myapp/releases/20100525085056 ]; then cd /myapp/releases/20100525085056; else cd /myapp/current; fi; rake RAILS_ENV=production thinking_sphinx:configure"
* executing "if [ -d /myapp/releases/20100525085056 ]; then cd /myapp/releases/20100525085056; else cd /myapp/current; fi; rake RAILS_ENV=production thinking_sphinx:start"
* executing `deploy:symlink'
* executing "rm -f /myapp/current && ln -s /myapp/releases/20100525085056 /myapp/current"

production.sphinx.conf 就不會因為 deploy:symlink 的關係消失了。

算是一個有趣的 trace bug 經驗,還趁機熟悉了一些事。

arrow
arrow
    全站熱搜

    沒力小僧 發表在 痞客邦 留言(0) 人氣()