我的任务是构建一个简单的应用程序。我对Sinatra,Unicorn或Mongo没有任何经验。我在努力从哪里开始。我在Rails方面有丰富的经验,我一直试图用Rails的术语来思考问题,但这没有帮助。我阅读的所有内容似乎都建议将Unicorn与NGINX结合使用。 boot.rb的作用是什么?这是config / boot.rb现在的样子:
require 'sinatra'
require 'mongo'
require 'mongoid'
require './app'
这是config / unicorn.rb:
worker_processes Integer(ENV["WEB_CONCURRENCY"] ||3)
timeout 15
preload_app true
before_fork do |server, worker|
Signal.trap 'TERM' do
puts 'Unicorn master intercepting TERM and sending myself QUIT instead'
Process.kill 'QUIT', Process.pid
end
end
after_fork do |server, worker|
Singal.trap 'TERM' do
puts 'Unicorn worker intercepting TERM and doing nothing. Wait for master to send QUIT'
end
end
development:
clients:
default:
database: db-name
hosts:
- localhost:27017
这是我为procfile创建的:
web:捆绑exec unicorn -p $ PORT -c ./config/unicorn.rb
有什么想法吗?