Apache/Passenger error: cannot load such file -- rails_extensions (LoadError)

441 views Asked by At

I receive the following error when attempting to run a rails application with Apache, Passenger, and rbenv. I'm able to run it just fine with rails s -b 0.0.0.0 -p 3000 -e production, but when running under Passenger I get the following error:

Error: The application encountered the following error: cannot load such file -- rails_extensions (LoadError)
    /home/deploy/reservations/config/environment.rb:4:in `require'
    /home/deploy/reservations/config/environment.rb:4:in `<top (required)>'
    config.ru:4:in `require'
    config.ru:4:in `block in <main>'
    /home/deploy/reservations/vendor/bundle/ruby/2.6.0/gems/rack-2.2.3/lib/rack/builder.rb:125:in `instance_eval'
    /home/deploy/reservations/vendor/bundle/ruby/2.6.0/gems/rack-2.2.3/lib/rack/builder.rb:125:in `initialize'
    config.ru:1:in `new'
    config.ru:1:in `<main>'
    /usr/share/passenger/helper-scripts/rack-preloader.rb:101:in `eval'
    /usr/share/passenger/helper-scripts/rack-preloader.rb:101:in `preload_app'
    /usr/share/passenger/helper-scripts/rack-preloader.rb:189:in `block in <module:App>'
    /usr/lib/ruby/vendor_ruby/phusion_passenger/loader_shared_helpers.rb:390:in `run_block_and_record_step_progress'
    /usr/share/passenger/helper-scripts/rack-preloader.rb:188:in `<module:App>'
    /usr/share/passenger/helper-scripts/rack-preloader.rb:30:in `<module:PhusionPassenger>'
    /usr/share/passenger/helper-scripts/rack-preloader.rb:29:in `<main>'

Here are my environment variables:

USER = deploy
SHLVL = 0
HOME = /home/deploy
WSGI_ENV = production
PYTHONUNBUFFERED = 1
PASSENGER_USE_FEEDBACK_FD = true
APACHE_RUN_DIR = /var/run/apache2
APPLICATION_HOST = 192.168.178.28
APACHE_PID_FILE = /var/run/apache2/apache2.pid
LOGNAME = deploy
JOURNAL_STREAM = 8:74225
SERVER_SOFTWARE = Apache/2.4.48 (Ubuntu) Phusion_Passenger/6.0.10
RACK_ENV = production
RBENV_SHELL = bash
PATH = /home/deploy/reservations/vendor/bundle/ruby/2.6.0/bin:/home/deploy/.rbenv/shims:/home/deploy/.rbenv/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin
INVOCATION_ID = f18dc46d76e34048a133e8525756b5d2
STORAGE_LOCATION = local
APACHE_LOCK_DIR = /var/lock/apache2
LANG = C
PASSENGER_SPAWN_WORK_DIR = /tmp/passenger.spawn.XXXXngFNha
RES_SMTP_AUTH = true
SHELL = /bin/bash
IN_PASSENGER = 1
NODE_PATH = /usr/share/passenger/node
APACHE_RUN_GROUP = www-data
APACHE_RUN_USER = www-data
APACHE_LOG_DIR = /var/log/apache2
RAILS_ENV = production
RAILS_HOST_NAME = 192.168.178.28
PWD = /home/deploy/reservations
RAILS_SERVE_STATIC_FILES = false
XDG_DATA_DIRS = /usr/local/share:/usr/share:/var/lib/snapd/desktop
PASSENGER_APP_ENV = production
NODE_ENV = production
BUNDLER_ORIG_BUNDLE_BIN_PATH = BUNDLER_ENVIRONMENT_PRESERVER_INTENTIONALLY_NIL
BUNDLER_ORIG_BUNDLE_GEMFILE = BUNDLER_ENVIRONMENT_PRESERVER_INTENTIONALLY_NIL
BUNDLER_ORIG_BUNDLER_ORIG_MANPATH = BUNDLER_ENVIRONMENT_PRESERVER_INTENTIONALLY_NIL
BUNDLER_ORIG_BUNDLER_VERSION = BUNDLER_ENVIRONMENT_PRESERVER_INTENTIONALLY_NIL
BUNDLER_ORIG_GEM_HOME = BUNDLER_ENVIRONMENT_PRESERVER_INTENTIONALLY_NIL
BUNDLER_ORIG_GEM_PATH = BUNDLER_ENVIRONMENT_PRESERVER_INTENTIONALLY_NIL
BUNDLER_ORIG_MANPATH = BUNDLER_ENVIRONMENT_PRESERVER_INTENTIONALLY_NIL
BUNDLER_ORIG_PATH = /home/deploy/.rbenv/shims:/home/deploy/.rbenv/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin
BUNDLER_ORIG_RB_USER_INSTALL = BUNDLER_ENVIRONMENT_PRESERVER_INTENTIONALLY_NIL
BUNDLER_ORIG_RUBYLIB = BUNDLER_ENVIRONMENT_PRESERVER_INTENTIONALLY_NIL
BUNDLER_ORIG_RUBYOPT = BUNDLER_ENVIRONMENT_PRESERVER_INTENTIONALLY_NIL
GEM_PATH = 
GEM_HOME = /home/deploy/reservations/vendor/bundle/ruby/2.6.0
BUNDLE_BIN_PATH = /home/deploy/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/bundler-1.17.3/exe/bundle
BUNDLE_GEMFILE = /home/deploy/reservations/Gemfile
BUNDLER_VERSION = 1.17.3
RUBYOPT = -rbundler/setup
RUBYLIB = /home/deploy/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/bundler-1.17.3/lib
MANPATH = /home/deploy/reservations/vendor/bundle/ruby/2.6.0/gems/unicorn-5.1.0/man

and Apache config vhost:

<VirtualHost *:80>
        # The ServerName directive sets the request scheme, hostname and port that
        # the server uses to identify itself. This is used when creating
        # redirection URLs. In the context of virtual hosts, the ServerName
        # specifies what hostname must appear in the request's Host: header to
        # match this virtual host. For the default virtual host (this file) this
        # value is not decisive as it is used as a last resort host regardless.
        # However, you must set it for any further virtual host explicitly.
        ServerName 192.168.178.28

        ServerAdmin webmaster@localhost
        DocumentRoot /home/deploy/reservations/public

        SetEnv STORAGE_LOCATION local
        SetEnv RAILS_HOST_NAME 192.168.178.28
        SetEnv APPLICATION_HOST 192.168.178.28
        SetEnv RAILS_SERVE_STATIC_FILES false
        SetEnv RES_SMTP_AUTH true

        PassengerDisableAnonymousTelemetry on
        PassengerRuby /home/deploy/.rbenv/versions/2.6.5/bin/ruby
        PassengerAppRoot /home/deploy/reservations
        # Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
        # error, crit, alert, emerg.
        # It is also possible to configure the loglevel for particular
        # modules, e.g.
        #LogLevel info ssl:warn

        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined

        # For most configuration files from conf-available/, which are
        # enabled or disabled at a global level, it is possible to
        # include a line for only one particular virtual host. For example the
        # following line enables the CGI configuration for this host only
        # after it has been globally disabled with "a2disconf".
        #Include conf-available/serve-cgi-bin.conf

        RailsEnv production
        PassengerFriendlyErrorPages on

    <Directory /home/deploy/reservations/public>
      Allow from all
      Options -MultiViews
      # Uncomment this if you're on Apache > 2.4:
      Require all granted
    </Directory>
</VirtualHost>

I really appreciate any tips for finding what the problem could be! Thanks!

0

There are 0 answers