Rails Nginx Passenger Cannot checkout session because a spawning error occurred

17,616

It looks like the problem was with my .bashrc file.

I had the following at the bottom of the file:

if [ -f /etc/bash_completion ] && ! shopt -oq posix; then
    . /etc/bash_completion
fi
export PATH="$HOME/.rbenv/bin:$PATH"
eval "$(rbenv init -)"
export PATH="$HOME/.rbenv/plugins/ruby-build/bin:$PATH"

Which was not setting my rbenv environment variable. Once I moved it to the top of .bashrc I could deploy without an error. And passenger now spins up the application.

My whenever gem doesn't seem to be working (setting my crontab for rake tasks), but I'll open another question regarding that.

Share:
17,616
nulltek
Author by

nulltek

coding

Updated on June 15, 2022

Comments

  • nulltek
    nulltek almost 2 years

    I have a Rails 3.2.14 app that deploys and operates fine on a production server. I'm working on deploying it to another server to test changes before I push out to production. I'm running the latest version of passenger/nginx and using Capistrano 2.12.0 with Ruby 1.9.3-p194 due to this being a legacy app and I'm trying to mimic the environment.

    I can deploy the app without a problem, but it won't spawn passenger and start up the app.

    Here's one of the errors I get in /var/log/nginx/error.log

    [ 2014-08-10 07:09:08.7782 733/7f2626fb2700 Pool2/Implementation.cpp:284 ]: Could not spawn process for application /home/d
    eploy/exigencad/current: An error occured while starting up the preloader.
      Error ID: aa5360f9
      Error details saved to: /tmp/passenger-error-0aEhJZ.html
      Message from application: cannot load such file -- bundler/setup (LoadError)
      /home/deploy/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
      /home/deploy/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
      /usr/lib/ruby/vendor_ruby/phusion_passenger/loader_shared_helpers.rb:263:in `block in run_load_path_setup_code'
      /usr/lib/ruby/vendor_ruby/phusion_passenger/loader_shared_helpers.rb:366:in `running_bundler'
      /usr/lib/ruby/vendor_ruby/phusion_passenger/loader_shared_helpers.rb:261:in `run_load_path_setup_code'
      /usr/share/passenger/helper-scripts/rack-preloader.rb:100:in `preload_app'
      /usr/share/passenger/helper-scripts/rack-preloader.rb:158:in `<module:App>'
      /usr/share/passenger/helper-scripts/rack-preloader.rb:29:in `<module:PhusionPassenger>'
      /usr/share/passenger/helper-scripts/rack-preloader.rb:28:in `<main>'
    
    
    [ 2014-08-10 07:09:08.7874 733/7f2624c8d700 agents/HelperAgent/RequestHandler.h:2305 ]: [Client 20] Cannot checkout session
     because a spawning error occurred. The identifier of the error is . Please see earlier logs for details about the error.
    App 1521 stdout: 
    App 1521 stdout: 
    

    I noticed an error about bundler but I did install the bundler gem, and here's my output running as deploy user or root user:

    bundle -v
    Bundler version 1.1.4
    

    Here's the specific error log file for passenger

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
    <html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <meta name="generator" content="Phusion Passenger">
        <title>Web application could not be started</title>
        <style type="text/css">
            body {
        font-family: Verdana, 'Bitstream Vera Sans', Arial, Sans-Serif;
        font-size: 10pt;
        background: white;
        color: #222222;
        margin: 0;
        padding-top: 3em;
        padding-bottom: 3em;
        padding-left: 4.5em;
        padding-right: 4.5em;
    }
    
    h1 {
        font-size: 17pt;
        font-weight: medium;
        color: #533e72;
        border-bottom: 1px solid #533e72;
    }
    
    h1.title {
        margin-top: 0;
    }
    
    h1.error_title {
        color: red;
        border-bottom: 1px solid red;
    }
    
    a {
        text-decoration: none;
    }
    
    a:hover {
        text-decoration: underline;
    }
    
    dt {
        font-weight: bold;
        color: #280050;
    }
    
    dd {
        margin-top: 0.5em;
        margin-bottom: 1em;
    }
    
    .commands {
        border: 1px solid #b594e7;
        background: #ddc6ff;
        padding: 0.5em;
        margin: 0.5em;
        font-family: 'Bitstream Vera Sans Mono', 'Courier New', Monospace;
    }
    
    pre {
        overflow: auto;
        white-space: pre-wrap;
        text-align: left;
    }
    
    table.backtrace th {
        background: #8470a6;
        color: white;
    }
    
    table.backtrace th,
    table.backtrace td {
        padding: 0.2em;
        padding-left: 0.4em;
        padding-right: 0.4em;
    }
    
    table.backtrace tr td {
        background: #ecdfff;
    }
    
    table.backtrace tr.even td {
        background: #f7f2ff;
    }
    
    table.backtrace td.index {
        font-weight: bold;
    }
    
    #site_footer {
        border-top: solid 1px black;
        margin-top: 1em;
        padding-top: 1em;
        font-size: small;
        color: #777777;
    }
    
    #site_footer a {
        color: #65498e;
    }
    
    #site_footer a:hover {
        color: #9681d9;
    }
    
    #site_header .corporate_identity {
        display: none;
    }
    
        </style>
        <link rel="stylesheet" type="text/css" href="http://www.modrails.com/error_pages/1.0/error_page.css">
        <style type="text/css">
            dd {
                text-align: left;
            }
    
            dd pre {
                margin-top: 0;
                margin-bottom: 0;
            }
        </style>
    </head>
    
    <body>
    
        <div id="site_container">
            <div id="site_header">
                <ul class="corporate_identity">
                    <li class="logo"><a href="https://www.phusionpassenger.com"><span>Phusion Passenger</span></a></li>
                </ul>
            </div>
            <div id="site_body">
                <h1 class="error_title">Web application could not be started</h1>
                <div id="content">
                    <pre>cannot load such file -- bundler/setup (LoadError)
      /home/deploy/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/rubygems/custom_require.rb:<wbr>36:<wbr>in `require&apos;
      /home/deploy/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/rubygems/custom_require.rb:<wbr>36:<wbr>in `require&apos;
      /usr/lib/ruby/vendor_ruby/phusion_passenger/loader_shared_helpers.rb:<wbr>263:<wbr>in `block in run_load_path_setup_code&apos;
      /usr/lib/ruby/vendor_ruby/phusion_passenger/loader_shared_helpers.rb:<wbr>366:<wbr>in `running_bundler&apos;
      /usr/lib/ruby/vendor_ruby/phusion_passenger/loader_shared_helpers.rb:<wbr>261:<wbr>in `run_load_path_setup_code&apos;
      /usr/share/passenger/helper-scripts/rack-preloader.rb:<wbr>100:<wbr>in `preload_app&apos;
      /usr/share/passenger/helper-scripts/rack-preloader.rb:<wbr>158:<wbr>in `&lt;module:<wbr>App&gt;&apos;
      /usr/share/passenger/helper-scripts/rack-preloader.rb:<wbr>29:<wbr>in `&lt;module:<wbr>PhusionPassenger&gt;&apos;
      /usr/share/passenger/helper-scripts/rack-preloader.rb:<wbr>28:<wbr>in `&lt;main&gt;&apos;
    </pre>
    
                    <dl>
                    <dt>Error ID</dt>
                    <dd>aa5360f9</dd>
                    <dt>Application root</dt>
                    <dd>/home/deploy/exigencad/current</dd>
                    <dt>Environment (value of RAILS_ENV, RACK_ENV, WSGI_ENV, NODE_ENV and PASSENGER_APP_ENV)</dt>
                    <dd>production</dd>
    
                        <dt>Ruby interpreter command</dt>
                        <dd><pre>/home/deploy/.rbenv/shims/ruby</pre></dd>
    
                    <dt>User and groups</dt>
                    <dd><pre>uid=<wbr>1000(deploy) gid=<wbr>1000(deploy) groups=<wbr>1000(deploy),<wbr>27(sudo)
    </pre></dd>
                    <dt>Environment variables</dt>
                    <dd><pre>RBENV_VERSION =<wbr> 1.9.3-p194
    TERM =<wbr> xterm-256color
    SHELL =<wbr> /bin/bash
    PYTHONUNBUFFERED =<wbr> 1
    PASSENGER_DEBUG_DIR =<wbr> /tmp/passenger.spawn-debug.XXXX3H8hx2
    SERVER_PORT =<wbr> 80
    USER =<wbr> deploy
    DOCUMENT_ROOT =<wbr> /home/deploy/exigencad/current/public
    SCGI =<wbr> 1
    RBENV_ROOT =<wbr> /home/deploy/.rbenv
    REQUEST_URI =<wbr> /
    IN_PASSENGER =<wbr> 1
    RACK_ENV =<wbr> production
    RBENV_HOOK_PATH =<wbr> :<wbr>/home/deploy/.rbenv/rbenv.d:<wbr>/usr/local/etc/rbenv.d:<wbr>/etc/rbenv.d:<wbr>/usr/lib/rbenv/hooks
    REMOTE_PORT =<wbr> 64649
    PATH =<wbr> /home/deploy/.rbenv/versions/1.9.3-p194/bin:<wbr>/home/deploy/.rbenv/libexec:<wbr>/home/deploy/.rbenv/plugins/ruby-build/bin:<wbr>/usr/local/sbin:<wbr>/usr/local/bin:<wbr>/sbin:<wbr>/bin:<wbr>/usr/sbin:<wbr>/usr/bin
    WSGI_ENV =<wbr> production
    PWD =<wbr> /home/deploy/exigencad/current
    LANG =<wbr> en_US.UTF-8
    NODE_PATH =<wbr> /usr/share/passenger/node
    NODE_ENV =<wbr> production
    REMOTE_ADDR =<wbr> 75.89.97.25
    SERVER_NAME =<wbr> prod.hcems.com
    HOME =<wbr> /home/deploy
    SHLVL =<wbr> 0
    RAILS_ENV =<wbr> production
    RBENV_DIR =<wbr> /usr/share/passenger/helper-scripts
    SERVER_SOFTWARE =<wbr> nginx/1.6.0
    LOGNAME =<wbr> deploy
    QUERY_STRING =<wbr> 
    SERVER_ADDR =<wbr> 72.14.181.99
    SERVER_PROTOCOL =<wbr> HTTP/1.1
    PASSENGER_APP_ENV =<wbr> production
    REQUEST_METHOD =<wbr> GET
    </pre></dd>
                    <dt>Ulimits</dt>
                    <dd><pre>Unknown</pre></dd>
    
                        <dt>System metrics</dt>
                        <dd><pre>------------- General -------------
    Kernel version    :<wbr> 3.15.4-x86_64-linode45
    Uptime            :<wbr> 14h 3m 25s
    Load averages     :<wbr> 0.01%,<wbr> 0.22%,<wbr> 0.27%
    Fork rate         :<wbr> unknown
    
    ------------- CPU -------------
    Number of CPUs    :<wbr>    4
    Average CPU usage :<wbr>   0%  --   0% user,<wbr>   0% nice,<wbr>   0% system,<wbr> 100% idle
      CPU 1           :<wbr>   0%  --   0% user,<wbr>   0% nice,<wbr>   0% system,<wbr> 100% idle
      CPU 2           :<wbr>   0%  --   0% user,<wbr>   0% nice,<wbr>   0% system,<wbr> 100% idle
      CPU 3           :<wbr>   0%  --   0% user,<wbr>   0% nice,<wbr>   0% system,<wbr> 100% idle
      CPU 4           :<wbr>   0%  --   0% user,<wbr>   0% nice,<wbr>   0% system,<wbr> 100% idle
    I/O pressure      :<wbr>   0%
      CPU 1           :<wbr>   0%
      CPU 2           :<wbr>   0%
      CPU 3           :<wbr>   0%
      CPU 4           :<wbr>   0%
    Interference from other VMs:<wbr>   0%
      CPU 1                    :<wbr>   0%
      CPU 2                    :<wbr>   0%
      CPU 3                    :<wbr>   0%
      CPU 4                    :<wbr>   0%
    
    ------------- Memory -------------
    RAM total         :<wbr>   4002 MB
    RAM used          :<wbr>    205 MB (5%)
    RAM free          :<wbr>   3797 MB
    Swap total        :<wbr>    255 MB
    Swap used         :<wbr>      0 MB (0%)
    Swap free         :<wbr>    255 MB
    Swap in           :<wbr> unknown
    Swap out          :<wbr> unknown
    
    </pre></dd>
    
    
                        <dt>General Ruby interpreter information</dt>
                        <dd><pre>RUBY_VERSION =<wbr> 1.9.3
    RUBY_PLATFORM =<wbr> x86_64-linux
    RUBY_ENGINE =<wbr> ruby
    RubyGems version =<wbr> 1.8.23
    RubyGems paths =<wbr> [&quot;/home/deploy/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1&quot;,<wbr> &quot;/home/deploy/.gem/ruby/1.9.1&quot;]
    </pre></dd>
    
    
                        <dt>Ruby configuration (RbConfig::CONFIG)</dt>
                        <dd><pre>DESTDIR =<wbr> 
    MAJOR =<wbr> 1
    MINOR =<wbr> 9
    TEENY =<wbr> 1
    PATCHLEVEL =<wbr> 194
    INSTALL =<wbr> /usr/bin/install -c
    EXEEXT =<wbr> 
    prefix =<wbr> /home/deploy/.rbenv/versions/1.9.3-p194
    ruby_install_name =<wbr> ruby
    RUBY_INSTALL_NAME =<wbr> ruby
    RUBY_SO_NAME =<wbr> ruby
    exec =<wbr> exec
    ruby_pc =<wbr> ruby-1.9.pc
    PACKAGE =<wbr> ruby
    BUILTIN_TRANSSRCS =<wbr>  newline.c
    USE_RUBYGEMS =<wbr> YES
    MANTYPE =<wbr> doc
    NROFF =<wbr> /usr/bin/nroff
    vendorhdrdir =<wbr> /home/deploy/.rbenv/versions/1.9.3-p194/include/ruby-1.9.1/vendor_ruby
    sitehdrdir =<wbr> /home/deploy/.rbenv/versions/1.9.3-p194/include/ruby-1.9.1/site_ruby
    rubyhdrdir =<wbr> /home/deploy/.rbenv/versions/1.9.3-p194/include/ruby-1.9.1
    UNIVERSAL_INTS =<wbr> 
    UNIVERSAL_ARCHNAMES =<wbr> 
    configure_args =<wbr>  &apos;--prefix=<wbr>/home/deploy/.rbenv/versions/1.9.3-p194&apos; &apos;LDFLAGS=<wbr>-L/home/deploy/.rbenv/versions/1.9.3-p194/lib &apos; &apos;CPPFLAGS=<wbr>-I/home/deploy/.rbenv/versions/1.9.3-p194/include &apos;
    vendordir =<wbr> /home/deploy/.rbenv/versions/1.9.3-p194/lib/ruby/vendor_ruby
    sitedir =<wbr> /home/deploy/.rbenv/versions/1.9.3-p194/lib/ruby/site_ruby
    ruby_version =<wbr> 1.9.1
    sitearch =<wbr> x86_64-linux
    arch =<wbr> x86_64-linux
    RI_BASE_NAME =<wbr> ri
    ridir =<wbr> /home/deploy/.rbenv/versions/1.9.3-p194/share/ri
    rubylibprefix =<wbr> /home/deploy/.rbenv/versions/1.9.3-p194/lib/ruby
    MAKEFILES =<wbr> Makefile
    THREAD_MODEL =<wbr> pthread
    SYMBOL_PREFIX =<wbr> 
    EXPORT_PREFIX =<wbr> 
    COMMON_HEADERS =<wbr> 
    COMMON_MACROS =<wbr> 
    COMMON_LIBS =<wbr> 
    MAINLIBS =<wbr> 
    ENABLE_SHARED =<wbr> no
    DLDLIBS =<wbr>  -lc
    SOLIBS =<wbr> 
    LIBRUBYARG_SHARED =<wbr> -Wl,<wbr>-R -Wl,<wbr>/home/deploy/.rbenv/versions/1.9.3-p194/lib -L/home/deploy/.rbenv/versions/1.9.3-p194/lib 
    LIBRUBYARG_STATIC =<wbr> -Wl,<wbr>-R -Wl,<wbr>/home/deploy/.rbenv/versions/1.9.3-p194/lib -L/home/deploy/.rbenv/versions/1.9.3-p194/lib -lruby-static
    LIBRUBYARG =<wbr> -Wl,<wbr>-R -Wl,<wbr>/home/deploy/.rbenv/versions/1.9.3-p194/lib -L/home/deploy/.rbenv/versions/1.9.3-p194/lib -lruby-static
    LIBRUBY =<wbr> libruby-static.a
    LIBRUBY_ALIASES =<wbr> libruby.so
    LIBRUBY_SO =<wbr> libruby.so.1.9.1
    LIBRUBY_A =<wbr> libruby-static.a
    RUBYW_INSTALL_NAME =<wbr> 
    rubyw_install_name =<wbr> 
    LIBRUBY_DLDFLAGS =<wbr> 
    LIBRUBY_LDSHARED =<wbr> gcc -shared
    warnflags =<wbr> -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Werror=<wbr>pointer-arith -Werror=<wbr>write-strings -Werror=<wbr>declaration-after-statement -Werror=<wbr>implicit-function-declaration
    debugflags =<wbr> -ggdb
    optflags =<wbr> -O3
    cxxflags =<wbr>  -O3 -ggdb -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Werror=<wbr>pointer-arith -Werror=<wbr>write-strings -Werror=<wbr>declaration-after-statement -Werror=<wbr>implicit-function-declaration
    cflags =<wbr>  -O3 -ggdb -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Werror=<wbr>pointer-arith -Werror=<wbr>write-strings -Werror=<wbr>declaration-after-statement -Werror=<wbr>implicit-function-declaration
    cppflags =<wbr> -I/home/deploy/.rbenv/versions/1.9.3-p194/include 
    NULLCMD =<wbr> :<wbr>
    INSTALLDOC =<wbr> all
    CAPITARGET =<wbr> nodoc
    RDOCTARGET =<wbr> rdoc
    EXECUTABLE_EXTS =<wbr> 
    ARCHFILE =<wbr> 
    LIBRUBY_RELATIVE =<wbr> no
    EXTOUT =<wbr> .ext
    PREP =<wbr> miniruby
    TEST_RUNNABLE =<wbr> yes
    setup =<wbr> Setup
    EXTSTATIC =<wbr> 
    STRIP =<wbr> strip -S -x
    TRY_LINK =<wbr> 
    LIBPATHENV =<wbr> LD_LIBRARY_PATH
    RPATHFLAG =<wbr>  -Wl,<wbr>-R%1$-s
    LIBPATHFLAG =<wbr>  -L%1$-s
    LINK_SO =<wbr> 
    LIBEXT =<wbr> a
    DLEXT2 =<wbr> 
    DLEXT =<wbr> so
    LDSHAREDXX =<wbr> g++ -shared
    LDSHARED =<wbr> gcc -shared
    CCDLFLAGS =<wbr> -fPIC
    STATIC =<wbr> 
    ARCH_FLAG =<wbr> 
    DLDFLAGS =<wbr> 
    ALLOCA =<wbr> 
    WERRORFLAG =<wbr> -Werror
    CHDIR =<wbr> cd -P
    RMALL =<wbr> rm -fr
    RMDIRS =<wbr> rmdir --ignore-fail-on-non-empty -p
    RMDIR =<wbr> rmdir --ignore-fail-on-non-empty
    CP =<wbr> cp
    RM =<wbr> rm -f
    PKG_CONFIG =<wbr> pkg-config
    DOXYGEN =<wbr> 
    DOT =<wbr> 
    MAKEDIRS =<wbr> /bin/mkdir -p
    MKDIR_P =<wbr> /bin/mkdir -p
    INSTALL_DATA =<wbr> /usr/bin/install -c -m 644
    INSTALL_SCRIPT =<wbr> /usr/bin/install -c
    INSTALL_PROGRAM =<wbr> /usr/bin/install -c
    SET_MAKE =<wbr> 
    LN_S =<wbr> ln -s
    NM =<wbr> nm
    DLLWRAP =<wbr> 
    WINDRES =<wbr> 
    OBJCOPY =<wbr> objcopy
    OBJDUMP =<wbr> objdump
    ASFLAGS =<wbr> 
    AS =<wbr> as
    AR =<wbr> ar
    RANLIB =<wbr> ranlib
    try_header =<wbr> 
    COUTFLAG =<wbr> -o 
    OUTFLAG =<wbr> -o 
    CPPOUTFILE =<wbr> -o conftest.i
    GNU_LD =<wbr> yes
    GCC =<wbr> yes
    EGREP =<wbr> /bin/grep -E
    GREP =<wbr> /bin/grep
    CPP =<wbr> gcc -E
    CXXFLAGS =<wbr>  -O3 -ggdb -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Werror=<wbr>pointer-arith -Werror=<wbr>write-strings -Werror=<wbr>declaration-after-statement -Werror=<wbr>implicit-function-declaration
    CXX =<wbr> g++
    OBJEXT =<wbr> o
    CPPFLAGS =<wbr> -I/home/deploy/.rbenv/versions/1.9.3-p194/include   -I/home/deploy/.rbenv/versions/1.9.3-p194/include 
    LDFLAGS =<wbr> -L. -L/home/deploy/.rbenv/versions/1.9.3-p194/lib  -rdynamic -Wl,<wbr>-export-dynamic
    CFLAGS =<wbr>  -O3 -ggdb -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Werror=<wbr>pointer-arith -Werror=<wbr>write-strings -Werror=<wbr>declaration-after-statement -Werror=<wbr>implicit-function-declaration
    CC =<wbr> gcc
    target_os =<wbr> linux
    target_vendor =<wbr> unknown
    target_cpu =<wbr> x86_64
    target =<wbr> x86_64-unknown-linux-gnu
    host_os =<wbr> linux-gnu
    host_vendor =<wbr> unknown
    host_cpu =<wbr> x86_64
    host =<wbr> x86_64-unknown-linux-gnu
    RUBYW_BASE_NAME =<wbr> rubyw
    RUBY_BASE_NAME =<wbr> ruby
    build_os =<wbr> linux-gnu
    build_vendor =<wbr> unknown
    build_cpu =<wbr> x86_64
    build =<wbr> x86_64-unknown-linux-gnu
    RUBY_RELEASE_DATE =<wbr> 2012-04-20
    RUBY_PROGRAM_VERSION =<wbr> 1.9.3
    BASERUBY =<wbr> echo executable host ruby is required.  use --with-baseruby option.;<wbr> false
    target_alias =<wbr> 
    host_alias =<wbr> 
    build_alias =<wbr> 
    LIBS =<wbr> -lpthread -lrt -ldl -lcrypt -lm 
    ECHO_T =<wbr> 
    ECHO_N =<wbr> -n
    ECHO_C =<wbr> 
    DEFS =<wbr> 
    mandir =<wbr> /home/deploy/.rbenv/versions/1.9.3-p194/share/man
    localedir =<wbr> /home/deploy/.rbenv/versions/1.9.3-p194/share/locale
    libdir =<wbr> /home/deploy/.rbenv/versions/1.9.3-p194/lib
    psdir =<wbr> /home/deploy/.rbenv/versions/1.9.3-p194/share/doc/ruby
    pdfdir =<wbr> /home/deploy/.rbenv/versions/1.9.3-p194/share/doc/ruby
    dvidir =<wbr> /home/deploy/.rbenv/versions/1.9.3-p194/share/doc/ruby
    htmldir =<wbr> /home/deploy/.rbenv/versions/1.9.3-p194/share/doc/ruby
    infodir =<wbr> /home/deploy/.rbenv/versions/1.9.3-p194/share/info
    docdir =<wbr> /home/deploy/.rbenv/versions/1.9.3-p194/share/doc/ruby
    oldincludedir =<wbr> /usr/include
    includedir =<wbr> /home/deploy/.rbenv/versions/1.9.3-p194/include
    localstatedir =<wbr> /home/deploy/.rbenv/versions/1.9.3-p194/var
    sharedstatedir =<wbr> /home/deploy/.rbenv/versions/1.9.3-p194/com
    sysconfdir =<wbr> /home/deploy/.rbenv/versions/1.9.3-p194/etc
    datadir =<wbr> /home/deploy/.rbenv/versions/1.9.3-p194/share
    datarootdir =<wbr> /home/deploy/.rbenv/versions/1.9.3-p194/share
    libexecdir =<wbr> /home/deploy/.rbenv/versions/1.9.3-p194/libexec
    sbindir =<wbr> /home/deploy/.rbenv/versions/1.9.3-p194/sbin
    bindir =<wbr> /home/deploy/.rbenv/versions/1.9.3-p194/bin
    exec_prefix =<wbr> /home/deploy/.rbenv/versions/1.9.3-p194
    PACKAGE_URL =<wbr> 
    PACKAGE_BUGREPORT =<wbr> 
    PACKAGE_STRING =<wbr> 
    PACKAGE_VERSION =<wbr> 
    PACKAGE_TARNAME =<wbr> 
    PACKAGE_NAME =<wbr> 
    PATH_SEPARATOR =<wbr> :<wbr>
    SHELL =<wbr> /bin/bash
    rubylibdir =<wbr> /home/deploy/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1
    archdir =<wbr> /home/deploy/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/x86_64-linux
    sitelibdir =<wbr> /home/deploy/.rbenv/versions/1.9.3-p194/lib/ruby/site_ruby/1.9.1
    sitearchdir =<wbr> /home/deploy/.rbenv/versions/1.9.3-p194/lib/ruby/site_ruby/1.9.1/x86_64-linux
    vendorlibdir =<wbr> /home/deploy/.rbenv/versions/1.9.3-p194/lib/ruby/vendor_ruby/1.9.1
    vendorarchdir =<wbr> /home/deploy/.rbenv/versions/1.9.3-p194/lib/ruby/vendor_ruby/1.9.1/x86_64-linux
    topdir =<wbr> /home/deploy/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/x86_64-linux
    </pre></dd>
    
    
    
                        <dt>Ruby load path ($LOAD_PATH)</dt>
                        <dd><pre>/home/deploy/.rbenv/versions/1.9.3-p194/lib/ruby/site_ruby/1.9.1
    /home/deploy/.rbenv/versions/1.9.3-p194/lib/ruby/site_ruby/1.9.1/x86_64-linux
    /home/deploy/.rbenv/versions/1.9.3-p194/lib/ruby/site_ruby
    /home/deploy/.rbenv/versions/1.9.3-p194/lib/ruby/vendor_ruby/1.9.1
    /home/deploy/.rbenv/versions/1.9.3-p194/lib/ruby/vendor_ruby/1.9.1/x86_64-linux
    /home/deploy/.rbenv/versions/1.9.3-p194/lib/ruby/vendor_ruby
    /home/deploy/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1
    /home/deploy/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/x86_64-linux
    </pre></dd>
    
    
                        <dt>Ruby loaded libraries ($LOADED_FEATURES)</dt>
                        <dd><pre>enumerator.so
    /home/deploy/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/x86_64-linux/enc/encdb.so
    /home/deploy/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/x86_64-linux/enc/trans/transdb.so
    /home/deploy/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/rubygems/defaults.rb
    /home/deploy/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/x86_64-linux/rbconfig.rb
    /home/deploy/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/rubygems/deprecate.rb
    /home/deploy/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/rubygems/exceptions.rb
    /home/deploy/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/rubygems/custom_require.rb
    /home/deploy/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/rubygems.rb
    /usr/lib/ruby/vendor_ruby/phusion_passenger.rb
    /home/deploy/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/x86_64-linux/etc.so
    /home/deploy/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/fileutils.rb
    /home/deploy/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/tmpdir.rb
    /usr/lib/ruby/vendor_ruby/phusion_passenger/utils/tmpio.rb
    /usr/lib/ruby/vendor_ruby/phusion_passenger/platform_info.rb
    /usr/lib/ruby/vendor_ruby/phusion_passenger/platform_info/operating_system.rb
    /home/deploy/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/rubygems/version.rb
    /home/deploy/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/rubygems/requirement.rb
    /home/deploy/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/rubygems/platform.rb
    /home/deploy/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/rubygems/specification.rb
    /home/deploy/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/rubygems/path_support.rb
    /usr/lib/ruby/vendor_ruby/phusion_passenger/platform_info/ruby.rb
    /usr/lib/ruby/vendor_ruby/phusion_passenger/platform_info/binary_compatibility.rb
    /home/deploy/.passenger/native_support/4.0.48/ruby-1.9.3-x86_64-linux/passenger_native_support.so
    /usr/lib/ruby/vendor_ruby/phusion_passenger/native_support.rb
    /home/deploy/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/x86_64-linux/socket.so
    /home/deploy/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/socket.rb
    /home/deploy/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/thread.rb
    /usr/lib/ruby/vendor_ruby/phusion_passenger/ruby_core_enhancements.rb
    /usr/lib/ruby/vendor_ruby/phusion_passenger/utils/tmpdir.rb
    /usr/lib/ruby/vendor_ruby/phusion_passenger/preloader_shared_helpers.rb
    /usr/lib/ruby/vendor_ruby/phusion_passenger/constants.rb
    /usr/lib/ruby/vendor_ruby/phusion_passenger/public_api.rb
    /usr/lib/ruby/vendor_ruby/phusion_passenger/debug_logging.rb
    /home/deploy/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/shellwords.rb
    /usr/lib/ruby/vendor_ruby/phusion_passenger/utils/shellwords.rb
    /usr/lib/ruby/vendor_ruby/phusion_passenger/loader_shared_helpers.rb
    /home/deploy/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/x86_64-linux/fcntl.so
    /usr/lib/ruby/vendor_ruby/phusion_passenger/message_channel.rb
    /usr/lib/ruby/vendor_ruby/phusion_passenger/utils.rb
    /usr/lib/ruby/vendor_ruby/phusion_passenger/message_client.rb
    /usr/lib/ruby/vendor_ruby/phusion_passenger/utils/native_support_utils.rb
    /usr/lib/ruby/vendor_ruby/phusion_passenger/utils/unseekable_socket.rb
    /usr/lib/ruby/vendor_ruby/phusion_passenger/request_handler/thread_handler.rb
    /usr/lib/ruby/vendor_ruby/phusion_passenger/request_handler.rb
    /home/deploy/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/x86_64-linux/stringio.so
    /usr/lib/ruby/vendor_ruby/phusion_passenger/utils/tee_input.rb
    /usr/lib/ruby/vendor_ruby/phusion_passenger/rack/thread_handler_extension.rb
    /usr/lib/ruby/vendor_ruby/phusion_passenger/union_station/connection.rb
    /usr/lib/ruby/vendor_ruby/phusion_passenger/union_station/transaction.rb
    /usr/lib/ruby/vendor_ruby/phusion_passenger/utils/lock.rb
    /usr/lib/ruby/vendor_ruby/phusion_passenger/union_station/core.rb
    </pre></dd>
    
                    </dl>
                </div>
            </div>
            <div id="site_footer">
                <!--
                   You are free to modify the footer as you see fit,
                   but we kindly ask of you to preserve to following
                   text. Thank you.
                -->
                <div class="container">
                    Powered by <a href="https://www.phusionpassenger.com/">Phusion Passenger</a>,
                    <tt>mod_rails</tt> / <tt>mod_rack</tt> for Apache and Nginx.
                </div>
            </div>
        </div>
    
    </body>
    </html>
    

    Here's my capistrano deploy.rb in case it helps (note, working on production server, but when I change the IP to the staging server it deploys but doesn't run rake tasks or whenever gem to set crontab):

    require "bundler/capistrano"
    set :whenever_command, "bundle exec whenever"
    require "whenever/capistrano"
    
    server "72.14.181.01", :web, :app, :db, primary: true
    
    set :application, "appname"
    set :user, "deploy"
    set :deploy_to, "/home/#{user}/#{application}"
    #set :deploy_via, :remote_cache
    set :use_sudo, false
    set :rails_env, "production"
    
    
    set :scm, "git"
    set :repository, "[email protected]:appguy/#{application}.git"
    set :branch, "master"
    
    
    default_run_options[:pty] = true
    ssh_options[:forward_agent] = true
    
    after "deploy", "deploy:cleanup" # keep only the last 5 releases
    after "deploy:update", "gps_listener:restart"
    
    namespace :deploy do
      task :start do ; end
      task :stop do ; end
      task :restart, :roles => :app, :except => { :no_release => true } do
        run "#{try_sudo} touch #{File.join(current_path,'tmp','restart.txt')}"
      end
      desc "reload the database with seed data"
      task :seed do
        run "cd #{current_path}; bundle exec rake db:seed RAILS_ENV=#{rails_env}"
      end
    end
    
    namespace :gps_listener do
      task :start do
        run "#{sudo} start app-gps"
      end
    
      task :stop do
        run "#{sudo} stop app-gps"
      end
    
      task :restart do
        run "#{sudo} stop app-gps && sleep 1 && #{sudo} start app-gps"
      end
    end
    
    task :after_update_code do
      run "ln -nfs #{deploy_to}/shared/config/database.yml #{release_path}/config/database.yml"
      run "cd #{current_path}; RAILS_ENV=#{rails_env} bundle exec rake gps:listen"
    end
    

    I'll admit, it's been a long time (1-2 years) since I've had to bootstrap a new server so recreating this legacy app with new versions of passenger/nginx is proving troublesome. I'm not sure if it's an issue with passenger itself or if it's a ruby issue.

    Here's my passenger config for nginx btw:

    /etc/nginx/nginx.conf

       passenger_root /usr/lib/ruby/vendor_ruby/phusion_passenger/locations.ini;
       passenger_ruby /home/deploy/.rbenv/shims/ruby;
    

    Here's my default virtual host for /etc/nginx/site-available/default

    server {
            listen 80 default_server;
            listen [::]:80 default_server ipv6only=on;
    
            server_name prod.hcems.com;
            passenger_enabled on;
            rails_env    production;
            root         /home/deploy/exigencad/current/public;
    
            # redirect server error pages to the static page /50x.html
            error_page   500 502 503 504  /50x.html;
            location = /50x.html {
                root   html;
            }
    }
    
  • Hongli
    Hongli over 9 years
    How come it wasn't seeing your rbenv environment variable? Does your bashrc call exit before reaching that line?
  • nulltek
    nulltek over 9 years
    Good question. I think .bashrc does exit before that line so moving that bit to the top seems to have fixed the problem with Passenger seeing the rbenv path. After some research, I've read others having to do the same thing since Passenger is spawned via Bash.