OS X:使用plist启动Passenger

时间:2014-01-25 00:15:56

标签: ruby-on-rails macos ruby-on-rails-4 plist passenger

我正在尝试让Passenger在OS X 10.9.1上启动。我找到了这篇文章: http://blog.wilcoxd.com/2011/04/27/setting-up-passenger-standalone-rvm-and-launchd-on-os-x/

将它更新到我的路径,它可以从命令行以root身份运行。但是,当我尝试在.plist文件上执行此操作时,我得到: /Users/rossr/.rvm/gems/ruby-2.0.0-p353@server/gems/passenger-4.0.36/lib/phusion_passenger/standalone/command.rb:106:in“join”:没有隐含的nil转换到String(TypeError)

查看.rb文件中的行我看到了:

global_config_file = File.join(ENV['HOME'], USER_NAMESPACE_DIRNAME, "standalone", "config")

我猜它可能是主页或命名空间为null。我可以在plist中设置一些东西,还是作为一个环境变量来阻止它?

或者是否有其他方法可以让Passenger Standalone在启动时启动。不要记住你,开机。谢谢!

编辑1/25/14:Hongli是对的...需要设置Home变量。找到此链接: https://apple.stackexchange.com/questions/113201/dynamically-setting-home-environment-variable-in-a-launchd-script 设置home变量,它立即启动。这是我的.plist,所以如果有人发现这个问题,他们可以有一站式服务:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>KeepAlive</key>
        <true/>
    <key>Label</key>
        <string>com.company.onsite</string>
    <key>EnvironmentVariables</key>
    <dict>
        <key>HOME</key>
        <string>/Users/rossr/</string>
    </dict>
<key>ProgramArguments</key>
    <array>
        <string>/Users/rossr/.rvm/bin/onsite_ruby</string>
        <string>/Users/rossr/.rvm/gems/ruby-2.0.0-p353@onsiteserver/bin/passenger</string>
        <string>start</string>
        <string>/opt/local/server/onsite/</string>
        <string>-e</string>
        <string>production</string>
        <string>-p</string>
        <string>80</string>
    </array>
<key>RunAtLoad</key>
    <true/>
<key>StandardErrorPath</key>
    <string>/var/log/passengererror.log</string>
<key>StandardOutPath</key>
    <string>/var/log/passengeraccess.log</string>
<key>WorkingDirectory</key>
    <string>/opt/local/server/onsite/</string>
</dict>
</plist>

谢谢!

0 个答案:

没有答案