4
我试图在我的Web服务器上运行瘦服务。运行后“命令瘦安装”,薄创建以下文件中/etc/init.d/thin以瘦为服务运行Rails应用程序
#!/bin/sh
DAEMON=/usr/local/lib/ruby/gems/1.9.1/bin/thin
SCRIPT_NAME=/etc/init.d/thin
CONFIG_PATH=/etc/thin
# Exit if the package is not installed
[ -x "$DAEMON" ] || exit 0
case "$1" in
start)
$DAEMON start --all $CONFIG_PATH
;;
stop)
$DAEMON stop --all $CONFIG_PATH
;;
restart)
$DAEMON restart --all $CONFIG_PATH
;;
*)
echo "Usage: $SCRIPT_NAME {start|stop|restart}" >&2
exit 3
;;
esac
当薄服务已启动,正在运行
thin start --all /etc/thin以下这将扫描所有的YAML配置文件定义如何为每个定义的应用程序运行精简。这不起作用。
我在日志中看到:
/usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.0.0/lib/bundler/runtime.rb:27:in `block in setup': You have already activated eventmachine 0.12.6, but your Gemfile requires eventmachine 0.12.11. Consider using bundle exec. (Gem::LoadError)
from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.0.0/lib/bundler/spec_set.rb:12:in `block in each'
from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.0.0/lib/bundler/spec_set.rb:12:in `each'
from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.0.0/lib/bundler/spec_set.rb:12:in `each'
from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.0.0/lib/bundler/runtime.rb:17:in `setup'
from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.0.0/lib/bundler.rb:100:in `setup'
from /srv/app/current/config/boot.rb:8:in `<top (required)>'
from <internal:lib/rubygems/custom_require>:29:in `require'
from <internal:lib/rubygems/custom_require>:29:in `require'
from /srv/app/current/config/application.rb:1:in `<top (required)>'
from <internal:lib/rubygems/custom_require>:29:in `require'
from <internal:lib/rubygems/custom_require>:29:in `require'
from /srv/app/current/config/environment.rb:2:in `<top (required)>'
from <internal:lib/rubygems/custom_require>:29:in `require'
from <internal:lib/rubygems/custom_require>:29:in `require'
from /srv/app/current/config.ru:3:in `block in <main>'
from /usr/local/lib/ruby/gems/1.9.1/gems/rack-1.2.1/lib/rack/builder.rb:46:in `instance_eval'
from /usr/local/lib/ruby/gems/1.9.1/gems/rack-1.2.1/lib/rack/builder.rb:46:in `initialize'
from /srv/app/current/config.ru:1:in `new'
from /srv/app/current/config.ru:1:in `<main>'
from /usr/local/lib/ruby/gems/1.9.1/gems/thin-1.2.7/lib/rack/adapter/loader.rb:36:in `eval'
from /usr/local/lib/ruby/gems/1.9.1/gems/thin-1.2.7/lib/rack/adapter/loader.rb:36:in `load'
from /usr/local/lib/ruby/gems/1.9.1/gems/thin-1.2.7/lib/rack/adapter/loader.rb:45:in `for'
from /usr/local/lib/ruby/gems/1.9.1/gems/thin-1.2.7/lib/thin/controllers/controller.rb:163:in `load_adapter'
from /usr/local/lib/ruby/gems/1.9.1/gems/thin-1.2.7/lib/thin/controllers/controller.rb:67:in `start'
from /usr/local/lib/ruby/gems/1.9.1/gems/thin-1.2.7/lib/thin/runner.rb:177:in `run_command'
from /usr/local/lib/ruby/gems/1.9.1/gems/thin-1.2.7/lib/thin/runner.rb:143:in `run!'
from /usr/local/lib/ruby/gems/1.9.1/gems/thin-1.2.7/bin/thin:6:in `<top (required)>'
from /usr/local/lib/ruby/gems/1.9.1/bin/thin:19:in `load'
from /usr/local/lib/ruby/gems/1.9.1/bin/thin:19:in `<main>'
当Capistrano的部署,我缓存我的包在$ APP_PATH /共享/包目录;所以,这就解释了为什么薄抱怨不被安装为薄服务不会在$ APP_PATH /共享/束
看宝石这不工作:
cd $APP_PATH/current; bundle exec thin start -d -C /etc/thin/app_x.yml
但事实不是这样的薄/etc/init.d/thin中的服务文件起作用。我想我可以写我自己的。我只是不想解决已经解决的问题。
请注意,该错误不是关于未安装的宝石。问题是ActiveMachine被激活了两次,针对不同的版本,并且建议的解决方法是像你一样运行bundle exec。 – 2010-11-23 22:25:58