vendredi 20 mai 2016

Not able to set rails environment variable in nginx passenger

I am not able to set rails env variable to production from nginx passenger config file its by default setting to development.

passenger version - 5.0.27

nginx version - 1.8.1

nginx conf file,

server {
  listen 80;
  server_name "test.com";
  passenger_enabled on;
  passenger_env_app production;
  access_log /root/NTP/log/access_log;
  error_log /root/NTP/log/error_log;
  root /root/NTP/public;
  passenger_ruby /usr/local/rvm/gems/ruby-2.0.0-p648/wrappers/ruby;
}

i get the following error,

App 26438 stderr:    /usr/lib/ruby/vendor_ruby/phusion_passenger/platform_info.rb:363: warning:   Insecure world writable dir /root/NTP/. in PATH, mode 040777
App 26438 stderr:  [passenger_native_support.so] trying to compile for the   current user (nobody) and Ruby interpreter...
App 26438 stderr:      (set PASSENGER_COMPILE_NATIVE_SUPPORT_BINARY=0 to disable)
App 26438 stderr:      Warning: compilation didn't succeed. To learn why, read this file:
App 26438 stderr:      /tmp/passenger_native_support-1o7awri.log
App 26438 stderr:  [passenger_native_support.so] finding downloads for the current Ruby interpreter...
App 26438 stderr:      (set PASSENGER_DOWNLOAD_NATIVE_SUPPORT_BINARY=0 to disable)
App 26438 stderr:      # tar xzf rubyext-ruby-2.0.0-x86_64-linux.tar.gz
App 26438 stderr:      # rm -f rubyext-ruby-2.0.0-x86_64-linux.tar.gz
App 26438 stderr:      Checking whether downloaded binary is usable...
App 26438 stderr:      # /root/.rvm/gems/ruby-2.0.0-p648/wrappers/ruby -I. test.rb
App 26438 stderr:      Binary is usable.
App 26438 stderr:      # current user is: nobody
App 26438 stderr:      # mkdir -p /nonexistent/.passenger/native_support/5.0.27/ruby-2.0.0-x86_64-linux
App 26438 stderr:      Encountered permission error, but no more directories  to try. Giving up.
App 26438 stderr:      -------------------------------
App 26438 stderr:  [passenger_native_support.so] will not be used (can't compile or download) 
App 26438 stderr:   --> Passenger will still operate normally.
App 26438 stderr: Rails Error: Unable to access log file. Please ensure that /root/NTP/log/development.log exists and is chmod 0666. The log level has been   raised to WARN and the output directed to STDERR until the problem is fixed.
App 26438 stdout: => AWS Deploy loaded!
App 26438 stdout: => Initializing CONFIG (initializers/config.rb)
App 26438 stdout: => Initializing CONSTANTS (initializers/constants.rb)
App 26438 stderr: /root/.rvm/gems/ruby-2.0.0-p648/gems/bundler-1.11.2/lib/bundler/shared_helpers.rb:78: warning: Insecure world writable dir /root/NTP/. in PATH, mode 040777
App 26438 stdout: 
[ 2016-05-20 15:30:03.3085 26405/7f1e90403700  age/Cor/App/Implementation.cpp:304 ]: Could not spawn process for application  /root/NTP: An error occurred while starting up the preloader.
  Error ID: 03accacd

And on the web page i get below error,

Web application could not be started

Error ID
    03accacd
Application root
    /root/NTP
Environment (value of RAILS_ENV, RACK_ENV, WSGI_ENV, NODE_ENV and     PASSENGER_APP_ENV)
    development
Ruby interpreter command

    /root/.rvm/gems/ruby-2.0.0-p648/wrappers/ruby

User and groups

    uid=65534(nobody) gid=65534(nogroup) groups=65534(nogroup)

Environment variables

GEM_HOME = /root/.rvm/gems/ruby-2.0.0-p648
SHELL = /usr/sbin/nologin
IRBRC = /usr/local/rvm/rubies/ruby-2.0.0-p648/.irbrc
PYTHONUNBUFFERED = 1
PASSENGER_DEBUG_DIR = /tmp/passenger.spawn-debug.XXXXz3l0Qq
MY_RUBY_HOME = /usr/local/rvm/rubies/ruby-2.0.0-p648
USER = nobody
IN_PASSENGER = 1
RACK_ENV = development
PASSENGER_USE_FEEDBACK_FD = true
PATH = /root/.rvm/gems/ruby-2.0.0-p648/bin:/root/.rvm/gems/ruby-2.0.0-p648@global/bin:/usr/local/rvm/rubies/ruby-2.0.0-p648/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin:.
WSGI_ENV = development
PWD = /root/NTP
NODE_PATH = /usr/share/passenger/node
NODE_ENV = development
SHLVL = 0
HOME = /nonexistent
RAILS_ENV = development
LOGNAME = nobody
SERVER_SOFTWARE = nginx/1.8.1 Phusion_Passenger/5.0.27
GEM_PATH = /root/.rvm/gems/ruby-2.0.0-p648:/root/.rvm/gems/ruby-2.0.0- p648@global
PASSENGER_APP_ENV = development

Aucun commentaire:

Enregistrer un commentaire