无法将瘦服务器作为服务启动,RubyGems:找不到瘦服务器 [英] Can't start thin server as service, RubyGems: Could not find thin

查看:49
本文介绍了无法将瘦服务器作为服务启动,RubyGems:找不到瘦服务器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I used the following instructions to install and configure the Thin server as a service on Ubuntu 10.04.4 with Rails 3.2.3:

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

瘦服务器可以很好地从应用程序根目录运行它,使用瘦启动"

Thin server works fine running it from the application root, using 'thin start'

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

However, when I try to run the service using any of these commands:

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 的问题,'which Thin' 正确返回:

This does not seem to be an issue with PATH, 'which thin' correctly returns:

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

我还验证了 **/bin/thin 在任何被引用的地方的存在

I have also verified the existence of **/bin/thin wherever it's referenced

我尝试使用gem uninstall Thin"、gem install thin"重新安装 gem,但没有成功

I have tried reinstalling the gem using 'gem uninstall thin', 'gem install thin' without success

有没有人遇到过这种情况?我只发现了这个问题的另一个实例:无法通过远程机器重启瘦机

Has anyone experienced this before? I only found one other instance of this problem: Cannot restart thin via remote machine

这个问题似乎只是通过 ssh 解决的,而我什至无法在本地启动瘦服务

That issue seems to have been only over ssh, while I can't even get the thin service started locally

谢谢

推荐答案

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

It seems that each startup job is loaded its own shell. so, Try loading rvm before trying to start thin:

#! /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 &运行

place this in /etc/init.d/thin_service & run

$ sudo update-rc.d  thin_service defaults

最后,您只需输入 sudo start thin_service & 即可进行测试.sudo stop start_thin 而不是重启.如果这仍然不起作用,请尝试使用 railsgems-bundler 和 rvm wrapper.另外,请阅读rvm 的部署最佳实践

Lastly, you can test by by simply typing sudo start thin_service & sudo stop start_thin instead of rebooting. If this still doesn't work, try railsgems-bundler and rvm wrapper. Also, do read rvm's Deployment Best Practices

这篇关于无法将瘦服务器作为服务启动,RubyGems:找不到瘦服务器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆