2014-01-13 23 views
0

如果我運行rails s,它使用獨角獸,這很棒。但是,我如何運行Unicorn並使用我的配置文件?在Rails 4應用程序中使用Unicorn本地配置文件?

現在我必須這樣做:bundle exec unicorn -p 3000 -c ./config/unicorn.rb

但是,如果有一些短火起來的服務器(即rails s。)的方式,這會是有用的。

+1

會添加Procfile和運行'領班start'工作添加到您的Gemfile

  • 運行bundle
  • 啓動軌道麒麟服務器?或者你是否真的想只用'rails s'打字? –

  • +0

    沒有被接受的答案 - 沒有很好的答案,只有不好的答案...似乎對你很重要。 –

    回答

    0

    最簡單的解決方案是在項目的根目錄下創建一個shell腳本。

    start_unicorn

    #!/bin/bash 
    bundle exec unicorn -p 3000 -c ./config/unicorn.rb 
    

    確保它是可執行 chmod +x start_unicorn

    然後./start_unicorn

    田田!

    據我所知,你試圖解決的問題是不必每次都輸入那個東西。

    -1

    要包括config/unicorn.rb文件,你可以使用rack-handlersgem

    而不需要config/unicorn.rb的,你可以使用unicorn-railsgem

    1. 只需將想要的寶石與
      rails s unicorn
    +0

    這不會拉我提到的配置文件。 – Shpigford

    +0

    好的 - 我忽略了這一要求,並相應地更新了我的答案 –

    相關問題