您需要将config/mongo.rb
文件更改为如下:
log_level = Logger.const_get Errbit::Config.log_level.upcase
Mongoid.logger.level = log_level
Mongo::Logger.level = log_level
Mongoid.configure do |config|
uri = if Errbit::Config.mongo_url == 'mongodb://localhost'
"mongodb://localhost/errbit_#{Rails.env}"
else
Errbit::Config.mongo_url
end
config.load_configuration(
clients: {
default: {
uri: uri,
options: { ssl_ca_cert: Rails.root.join('rds-combined-ca-bundle.pem') }
}
},
options: {
use_activesupport_time_zone: true
}
)
end
您可以注意到这与当前的完全相同,除了我添加了:
options: { ssl_ca_cert: Rails.root.join('rds-combined-ca-bundle.pem') }
这样做后它确实对我有用 :) 当然,您需要rds-combined-ca-bundle.pem
文件存在于 Rails 根文件夹中。
wget https://s3.amazonaws.com/rds-downloads/rds-combined-ca-bundle.pem
是的,我必须使用以下代码创建一个 docker 映像:
FROM errbit/errbit:latest
LABEL maintainer="Tarek N. Elsamni <tarek.samni+stackoverflow@gmail.com>"
WORKDIR /app
RUN wget https://s3.amazonaws.com/rds-downloads/rds-combined-ca-bundle.pem
COPY ["mongo.rb", "/app/config/"]