繁体   English   中英

无法启动瘦服务器作为服务,RubyGems:找不到瘦

[英]Can't start thin server as service, RubyGems: Could not find thin

我使用以下说明在Ubuntu 10.04.4上使用Rails 3.2.3在瘦服务器上安装和配置服务:

http://articles.slicehost.com/2008/5/6/ubuntu-hardy-thin-web-server-for-ruby

瘦服务器可以从应用程序根运行它,使用'瘦启动'

但是,当我尝试使用以下任何命令运行该服务时:

service thin start
sudo service thin start
/etc/init.d/thin start
sudo /etc/init.d/thin start

我收到以下错误:

/home/myuser/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:247:in `to_specs': Could not find thin (>= 0) amongst [bigdecimal-1.1.0, io-console-0.3, json-1.5.4, minitest-2.5.1, rake-0.9.2.2, rdoc-3.9.4] (Gem::LoadError)
    from /home/myuser/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:256:in `to_spec'
    from /home/myuser/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/site_ruby/1.9.1/rubygems.rb:1210:in `gem'
    from /home/myuser/.rvm/gems/ruby-1.9.3-p125/bin/thin:18:in `<main>'

这似乎不是PATH的问题,'瘦'正确返回:

home/myuser/.rvm/gems/ruby-1.9.3-p125/bin/thin

我还在其所引用的地方验证了** / bin / thin的存在

我尝试使用'gem uninstall thin'重新安装gem,'gem install thin'没有成功

有谁之前经历过这个吗? 我只找到了另一个此问题的实例: 无法通过远程计算机重新启动瘦身

这个问题似乎只是在ssh上,而我甚至无法在本地启动瘦服务

谢谢

由于它似乎来自你的堆栈跟踪,你正在使用rvm,并且你使用瘦安装作为gem,你需要使用rvm包装器来使服务工作。 首先删除服务端重新安装它rvmsudo thin install而不是sudo thin install 您还应该在创建配置文件时使用rvmsudo thin config

要创建一个包装器,

rvm wrapper <your_rvm_ruby_version>@<your_rvm_gemset_in_use> bootup thin

您可以分别使用rvm listrvm gemset list找到名称。 包装器将具有名称bootup_thin ,您可以确认它正在使用正确的rvm bootup_thin 您可以在创建时为其提供任何名称。 然后你需要编辑瘦脚本

sudo nano /etc/init.d/thin

将原始DAEMON更改为

DAEMON=location_of_bootup_thin 

哪个应该是which bootup_thin的结果。 然后你就可以开始服务了。

sudo service thin start

我希望这有帮助

似乎每个启动作业都加载了自己的shell。 所以,在尝试开始瘦之前尝试加载rvm

#! /bin/sh
# Load RVM into a shell session *as a function*
if [[ -s "$HOME/.rvm/scripts/rvm" ]] ; then

  # First try to load from a user install
  source "$HOME/.rvm/scripts/rvm"

elif [[ -s "/usr/local/rvm/scripts/rvm" ]] ; then

  # Then try to load from a root install
  source "/usr/local/rvm/scripts/rvm"

else

  printf "ERROR: An RVM installation was not found.\n"

fi

rvm use 1.9.3
cd /path/to/your/application/code
bundle exec thin -d

把它放在/etc/init.d/thin_service并运行

$ sudo update-rc.d  thin_service defaults

最后,您可以通过简单地键入sudo start thin_servicesudo stop start_thin而不是重新启动来进行测试。 如果仍然无效,请尝试使用railsgems-bundler和rvm包装器。 另外,请阅读rvm的部署最佳实践

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM