K
K
Konstantin Kruglov2015-07-08 15:08:34
Ruby on Rails
Konstantin Kruglov, 2015-07-08 15:08:34

How to properly install init script from thin?

If you use apt-get , there will be no problems with the installation. But I don't want to clog the system and I want to keep everything under one user. RVM is installed in /usr/local/rvm . Next is Ruby. I log in as root and do this (on debian jessie):

$ rvm user gemsets
$ rvm use [email protected] --create --default
$ rvm gemset list

gemsets for ruby-2.2.2 (found in /root/.rvm/gems/ruby-2.2.2)
   (default)
=> redmine2

$ gem install thin
...
$ thin -v
thin 1.6.3 codename Protein Powder
$ thin install
$ update-rc.d -f thin defaults
...
$ systemctl start thin.service 
$ systemctl status thin.service 
● thin.service - LSB: thin initscript
   Loaded: loaded (/etc/init.d/thin)
   Active: active (exited) since Wed 2015-07-08 14:51:14 MSK; 2s ago
  Process: 27552 ExecStart=/etc/init.d/thin start (code=exited, status=0/SUCCESS)

Jul 08 14:51:14 web thin[27552]: /usr/local/rvm/rubies/ruby-2.2.2/lib/ruby/site_ruby/2.2.0/rubygems/dependency.rb:315:in `to_specs': Could not find 'thin' (>= 0) among 14 total gem(s) (Gem::LoadError)
Jul 08 14:51:14 web thin[27552]: Checked in 'GEM_PATH=/.gem/ruby/2.2.0:/usr/local/rvm/rubies/ruby-2.2.2/lib/ruby/gems/2.2.0', execute `gem env` for more information
Jul 08 14:51:14 web thin[27552]: from /usr/local/rvm/rubies/ruby-2.2.2/lib/ruby/site_ruby/2.2.0/rubygems/dependency.rb:324:in `to_spec'
Jul 08 14:51:14 web thin[27552]: from /usr/local/rvm/rubies/ruby-2.2.2/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_gem.rb:64:in `gem'
Jul 08 14:51:14 web thin[27552]: from /root/.rvm/gems/[email protected]/bin/thin:22:in `<main>'

How to properly use thin from gemset? Nobody writes about the init script before that.
PS
$ gem env
RubyGems Environment:
  - RUBYGEMS VERSION: 2.4.8
  - RUBY VERSION: 2.2.2 (2015-04-13 patchlevel 95) [x86_64-linux]
  - INSTALLATION DIRECTORY: /root/.rvm/gems/[email protected]
  - RUBY EXECUTABLE: /usr/local/rvm/rubies/ruby-2.2.2/bin/ruby
  - EXECUTABLE DIRECTORY: /root/.rvm/gems/[email protected]/bin
  - SPEC CACHE DIRECTORY: /root/.gem/specs
  - SYSTEM CONFIGURATION DIRECTORY: /usr/local/rvm/rubies/ruby-2.2.2/etc
  - RUBYGEMS PLATFORMS:
    - ruby
    - x86_64-linux
  - GEM PATHS:
     - /root/.rvm/gems/[email protected]
     - /root/.rvm/gems/[email protected]
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :backtrace => false
     - :bulk_threshold => 1000
  - REMOTE SOURCES:
     - https://rubygems.org/
  - SHELL PATH:
     - /root/.rvm/gems/[email protected]/bin
     - /root/.rvm/gems/[email protected]/bin
     - /usr/local/rvm/rubies/ruby-2.2.2/bin
     - /usr/local/sbin
     - /usr/local/bin
     - /usr/sbin
     - /usr/bin
     - /sbin
     - /bin
     - /usr/local/rvm/bin

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
Viktor Vsk, 2015-07-08
@k0st1an

What are you trying to do?
Thin is a ruby ​​application server. Usually, it is launched by the command rails serveror rackup, for example.
Also, it can be run using thin startin the directory where there is a file . I hear config.ru
about the command for the thin installfirst time, to be honest.
Apparently you are installing redmine. Then follow the installation guide, what's the problem there?
The question was asked incorrectly. I have nothing to do with gemsets, it's just a namespace, so to speak (a separate directory on the disk)
If you really don't want to, then use bundle exec instead of gemsets and rbenv instead of RVM :). Especially on the server.

J
Jeiwan, 2015-07-08
@Jeiwan

You need to use rvm wrapper - this is a script that will be installed globally (to /usr/local/rvm/ in this case), at startup it will load the desired gemset and execute the specified command from it. Well, you will also need to tweak /etc/init.d/thin so that this wrapper runs in it. Details on google.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question