The problem with the mongoid in the environment of rails

I have a rails 3.2.17 application deployed in an intermediate environment with a unicorn 4.6.3 controlled by bluepill 0.0.66 using mongid 3.1.5

When deployed in an intermediate environment, all operations are found including active_record, except for mongoid requests with the result with the following error:

Error during failsafe response: 
Problem:
  No configuration could be found for a session named 'default'.
Summary:
  When attempting to create the new session, Mongoid could not find a session configuration for the name: 'default'. This is necessary in order to know the host, port, and options needed to connect.
Resolution:
  Double check your mongoid.yml to make sure under the sessions key that a configuration exists for 'default'. If you have set the configuration programatically, ensure that 'default' exists in the configuration hash.

mongoid.yml file on the deployed station

staging:
  sessions:
    default:
      database: mydb
      username: user
      password: password
      hosts:
        - localhost:27017
      options:
  options:

file myapp.pill on the deployed station

Bluepill.application('myapp', log_file: '/var/log/bluepill/myapp.log') do |app|
    app.process('myapp-app') do |process|
        process.pid_file = '/home/user/myapp/current/tmp/pids/unicorn.pid'
        process.working_dir = '/home/user/myapp/current'
        process.start_command = '/home/user/.gem/ruby/1.9.1/bin/bundle exec unicorn -c config/unicorn.rb -D -E staging'
        process.stop_command = 'kill -QUIT {{PID}}'
        process.restart_command = 'kill -USR2 {{PID}}'
        process.uid = 'user'
        process.gid = 'user'
        process.start_grace_time 30.seconds
        process.stop_grace_time 30.seconds
        process.restart_grace_time 60.seconds
        process.monitor_children do |child_process|
            child_process.stop_command 'kill -QUIT {{PID}}'
            child_process.checks(:mem_usage,
                :every => 30.seconds,
                :below => 1024.megabytes,
                :times => [3,4]
            )
            child_process.checks(:cpu_usage,
                :every => 30.seconds,
                :below => 90,
                :times => [3,4]
            )
        end
    end
end

I suspect that the mangoid does not receive RAILS_ENV, but I'm not sure, I am checking the indentation in mongoid.yml. There must be another reason why I do not recognize.

+4
source share
1

/config/application.rb

require 'mongoid'

Mongoid.load!(File.expand_path('mongoid.yml', './config'))

.

+13

Source: https://habr.com/ru/post/1545713/


All Articles