Search code examples
apacheruby-on-rails-4production

Rails 4 Apache2 phusion app in production mode


I dont know if my app is in production or development mode, when I put rake about in console it say "Environment production" but the app write in log/development.log and the app put errors trace in the browser or if you put a bad route, the app put all routes in the browser like a development mode.

bundle exec rake about

About your application's environment

Rails version 4.2.4

Ruby version 2.1.2-p95 (x86_64-linux-gnu)

RubyGems version 2.2.2

Rack version 1.6.4

JavaScript Runtime therubyracer (V8)

Middleware Rack::Sendfile, Rack::Lock, , Rack::Runtime, Rack::MethodOverride, ActionDispatch::RequestId, RequestStore::Middleware, Rails::Rack::Logger, ActionDispatch::ShowExceptions, ActionDispatch::DebugExceptions, ActionDispatch::RemoteIp, ActionDispatch::Callbacks, ActiveRecord::ConnectionAdapters::ConnectionManagement, ActiveRecord::QueryCache, ActionDispatch::Cookies, ActionDispatch::Session::CookieStore, ActionDispatch::Flash, ActionDispatch::ParamsParser, Rack::Head, Rack::ConditionalGet, Rack::ETag, Warden::Manager

Application root /var/www/clients/client3/web37

Environment production

Database adapter mysql2

Database schema version 20160205114313


Solution

  • I think you have to check following setting in your application:

    when we deploy Rails application with Passenger + Apache then Passenger by default set it's RailsEnv to production(RailsEnv production). you need to check in you apache conf file rails enviromnet is set at production or not. like:

    #web_app vhost setting
    <VirtualHost *:80>
      ServerName example.com 
     DocumentRoot  /var/www/apps/web_app/public   
     RailsEnv production
    <Directory /var/www/apps/web_app/public>    
         AllowOverride all        
         Allow from all
         Options -MultiViews   
         Options FollowSymLinks
    </Directory>
    </VirtualHost>
    

    set chmod 755 on the root of Rails application, made sure the production.log existed and that it had at least chmod 0666 privileges.