ChiliProject is not maintained anymore. Please be advised that there will be no more updates.

We do not recommend that you setup new ChiliProject instances and we urge all existing users to migrate their data to a maintained system, e.g. Redmine. We will provide a migration script later. In the meantime, you can use the instructions by Christian Daehn.

Nginx config with Passenger

Added by Nicht Sicher at 2013-01-10 11:25 pm

Hello to all,

i try to install the current-chili-project on my new ubuntu-12.04 server with nginx and passenger.

i follow the upgrade-howto on https://www.chiliproject.org/projects/chiliproject/wiki/Upgrade and test with webrick von http://0.0.0.0:3000 works fine and i can see my old data, fantastic.

after that i create the nginx configuration.

in my nginx.conf i add for the passenger things in the http-part:

# passenger
passenger_root /usr/local/lib/ruby/gems/1.9.1/gems/passenger-3.0.18;
passenger_ruby /usr/bin/ruby;
passenger_max_pool_size 10;
passenger_buffers 8 16k;
passenger_buffer_size 32k;

my vhost look like that:

server {
       listen 192.168.1.71:80;
       server_name chili.intra.net;
       rewrite ^ https://$server_name$request_uri? permanent;
}

server {
       listen 192.168.1.71:443 ssl;
       server_name chili.intra.net;

       ssl on;
       ssl_certificate /etc/ssl/erazer.crt;
       ssl_certificate_key /etc/ssl/erazer.key;

       access_log  /var/log/nginx/chili_access.log;
       error_log   /var/log/nginx/chili_error.log;

       include /etc/nginx/proxy.include;
       root /var/www/chiliproject/public;
       proxy_redirect off;

       passenger_use_global_queue on;
       passenger_enabled on;

       # Send sensitive stuff via https
       rewrite ^/login(.*) https://chili.intra.net$request_uri permanent;
       rewrite ^/my/account(.*) https://chili.intra.net$request_uri permanent;
       rewrite ^/my/password(.*) https://chili.intra.net$request_uri permanent;
       rewrite ^/admin(.*) https://chili.intra.net$request_uri permanent;

       location = /favicon.ico {
                log_not_found off;
                access_log off;
                expires max;
       }
       location = /robots.txt {
                allow all;
                log_not_found off;
                access_log off;
       }

       # Deny all attempts to access hidden files such  as .htaccess, .htpasswd, .DS_Store (Mac).
       location ~ /\. {
                deny all;
                access_log off;
                log_not_found off;
       }

}

restart the nginx service and than i look to my chili installation on https://chili.intra.net -> here my current problem, the passenger says:

Error message:
    no such file to load -- bundler
Exception class:
    LoadError
Application root:
    /var/www/chiliproject 

Backtrace:
    #     File     Line     Location
    0     /usr/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb     36     in `gem_original_require'
    1     /usr/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb     36     in `require'
    2     /usr/local/lib/ruby/gems/1.9.1/gems/passenger-3.0.18/lib/phusion_passenger/utils.rb     325     in `prepare_app_process'
    3     /usr/local/lib/ruby/gems/1.9.1/gems/passenger-3.0.18/lib/phusion_passenger/classic_rails/application_spawner.rb     176     in `initialize_server'
    4     /usr/local/lib/ruby/gems/1.9.1/gems/passenger-3.0.18/lib/phusion_passenger/utils.rb     563     in `report_app_init_status'
    5     /usr/local/lib/ruby/gems/1.9.1/gems/passenger-3.0.18/lib/phusion_passenger/classic_rails/application_spawner.rb     174     in `initialize_server'

so i start to google the error and found same stuff...

1) i goto my chiliproject path to /var/www/chiliproject
2) update gem with: gem update
3) bundle install --without=test development sqlite postgres mysql rmagick
4) create .gemrc in my testuser-home include following data:
:gempath:
 - /usr/local/lib/ruby/gems/1.9.1

5) check gem with: gem env
RubyGems Environment:
  - RUBYGEMS VERSION: 1.8.23
  - RUBY VERSION: 1.9.3 (2012-04-20 patchlevel 194) [x86_64-linux]
  - INSTALLATION DIRECTORY: /usr/local/lib/ruby/gems/1.9.1
  - RUBY EXECUTABLE: /usr/local/bin/ruby
  - EXECUTABLE DIRECTORY: /usr/local/bin
  - RUBYGEMS PLATFORMS:
    - ruby
    - x86_64-linux
  - GEM PATHS:
     - /usr/local/lib/ruby/gems/1.9.1
     - /home/testuser/.gem/ruby/1.9.1
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :benchmark => false
     - :backtrace => false
     - :bulk_threshold => 1000
     - :gempath => ["/usr/local/lib/ruby/gems/1.9.1"]
  - REMOTE SOURCES:
     - http://rubygems.org/

6.) which ruby
/usr/local/bin/ruby

7.) which bundle
/usr/local/bin/bundle
  1. /usr/local/bin/bundle is a link
    lrwxrwxrwx 1 root root 60 Jan 12 01:12 /usr/local/bin/bundle -> /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.2.3/bin/bundle

8.) which gem

/usr/local/bin/gem

9.) which rake

/usr/local/bin/rake

10) create "additional_environment.rb" in chili/config

ENV['GEM_HOME'] = '/home/testuser/.gemrc'
ENV['GEM_PATH'] = '$GEM_HOME:/usr/local/bin/gem'

but the passenger say all the time "no such file to load -- bundler", so after more than 10 hours to try and install i think about to delete and forget this project but i want to understand whats happend. so please, if anybody have an idea, let me know.

thanks


Replies (2)

RE: Nginx config with Passenger - Added by Nicht Sicher at 2013-01-12 03:22 pm

knobody an idea? i can't be the first person with that error...

RE: Nginx config with Passenger - Added by Justin Geibel at 2013-01-12 08:51 pm

The passenger_root and passenger_ruby options seem to point to the appropriate places given your what you've noted about your environment.

I did think the following section was a little strange, as it is defined within the ssl server block so the connection should already be under https. (And you're already redirecting all http traffic to https in the other server block.)

       # Send sensitive stuff via https
       rewrite ^/login(.*) https://chili.intra.net$request_uri permanent;
       rewrite ^/my/account(.*) https://chili.intra.net$request_uri permanent;
       rewrite ^/my/password(.*) https://chili.intra.net$request_uri permanent;
       rewrite ^/admin(.*) https://chili.intra.net$request_uri permanent;

Also, passenger should include a listing of all its environment variables on the error page. You'll want to double check any ruby or gem related variables to make sure they match what you expect. In particular, make sure the bunder gem can be found somewhere in your GEM_PATH. (If the environment variables aren't displayed then you may need to check the passenger documentation or access the server from the localhost as 127.0.0.1)

I got confused at your step 4. I'm not sure why you would need to manually set up the .gemrc file. Just to clarify, when you mention the testuser account, is that the same account you use at the command prompt? Or are you trying to run the application under a different user account from your normal login?

Finally, I don't think it should be necessary to manually set the environment variables in a config/additional_environment.rb file. You may want to remove that file and then recheck the variables on the passenger error page.

Finally, you could access your application under the rails console. If it loads fine there, then inspect the output of pp env and see if you note any differences against the environment that passenger is seeing.

(1-2/2)