mon*_*lls 4 deployment ruby-on-rails mongodb unicorn mongoid
我有rails app 3.2.17,部署在登台环境中,独角兽4.6.3由bluepill 0.0.66使用mongid 3.1.5监控
当我为staging环境进行部署时,所有工作都会找到包括active_record在内的mongoid查询,其结果包含以下错误:
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.
Run Code Online (Sandbox Code Playgroud)
部署站中的mongoid.yml文件
staging:
sessions:
default:
database: mydb
username: user
password: password
hosts:
- localhost:27017
options:
options:
Run Code Online (Sandbox Code Playgroud)
部署站中的myapp.pill文件
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
Run Code Online (Sandbox Code Playgroud)
我怀疑mongoid没有收到RAILS_ENV,但我不确定,我检查mongoid.yml中的缩进.还有其他原因,我不知道.
mon*_*lls 15
在/config/application.rb类型中
require 'mongoid'
Mongoid.load!(File.expand_path('mongoid.yml', './config'))
Run Code Online (Sandbox Code Playgroud)
它可以通过初始化器来完成.
| 归档时间: |
|
| 查看次数: |
3959 次 |
| 最近记录: |