Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 965883
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T02:04:11+00:00 2026-05-16T02:04:11+00:00

So I’m trying to get thin to run as a service with RVM. After

  • 0

So I’m trying to get thin to run as a service with RVM. After a thin install I manually updated /etc/init.d/thin to use an su - user when running the config command so that thin was running as a local user, rather than root. So far so good.

Now, when I try to sudo service thin start it looks like it’s trying to use the non-RVM version of Ruby (1.8.7 which was installed on the box to start with) to actually execute the command. I did a gem install thin on the non-RVM version, which then gets me a uninitialized constant Bundler message—Bundler is only installed in the RVM gems, not the system gems. It looks like I can’t get the RVM environment set up (even though my RVM startup script is in ~/.bashrc which is then included in ~/.bash_profile).

All I want to do is run thin as a service using the RVM environment, not the system environment. Is this even possible? Should I just give up and commit the ultimate sin of running everything as root? It’s very tempting at this point.

Thanks for any help!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T02:04:12+00:00Added an answer on May 16, 2026 at 2:04 am

    RVM comes with a handy wrapper generator that creates an intermediary loader for an init.d script. This allows you to load a service using a particular Ruby version and gemset. I use it like this (after installing the thin gem):

    1 – create init.d entry for thin

    sudo thin install 
    

    2 – set up some defaults

    sudo /usr/sbin/update-rc.d -f thin defaults 
    

    3 – generate boot config for your rails app

    sudo thin config -C /etc/thin/<appname>.yml -c /var/rails/<appdir> --servers 4 -e production
    

    4 – generate rvm wrapper script

    rvm wrapper <rubyversion>@<gemset> bootup thin
    

    5 – If you’re using a global gemset, you can just use

    rvm wrapper ruby-1.9.2-p125 bootup thin
    

    6 – edit thin init

    sudo nano /etc/init.d/thin
    

    7 – change the original loader

    DAEMON=/usr/local/rvm/gems/ruby-<rubyversion>-<rubyrevision>@<gemset>/bin/thin
    

    8 – to point to the rvm wrapper instead

    DAEMON=/usr/local/bin/bootup_thin
    

    9 – start it up

    sudo service thin start
    

    If you’re running more than one app, just generate a boot config yml file for each one; when booting thin all yml files in /etc/thin/ are parsed. More info here:

    http://wiki.rubyonrails.org/deployment/nginx-thin?rev=1233246014 nb: This is linking to a revision, the most current version has been edited to be empty. Consider looking at the link without the ?rev=... in the url, the current version may be back and potentially more up to date.

    HTH

    2013 BONUS EDIT

    While I no longer use RVM in production, thin is still my production server of choice, and I still use steps 1-3 above to get started. But the default configuration it generates can do with a few tweaks, here are some of mine:

    Set the user & group that thin runs as:

    user: www-data
    group: www-data
    

    Remove the port config and switch to using sockets instead (a little faster):

    # port: 3000
    socket: tmp/sockets/<appname>.sock
    

    Tell thin to restart instances one by one, instead of shutting them all down before starting up again (rolling restart):

    onebyone: true
    

    Give the server processes a "tag" to help identify them (in ps aux etc):

    tag: <appname>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to understand how to use SyndicationItem to display feed which is
I'm trying to use string.replace('’','') to replace the dreaded weird single-quote character: ’ (aka
Basically, what I'm trying to create is a page of div tags, each has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I am trying to render a haml file in a javascript response like so:
I want use html5's new tag to play a wav file (currently only supported
I would like to run a str_replace or preg_replace which looks for certain words
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.