【问题标题】:How do I install this service_wrapper for mongrel/rails on my windows server?如何在我的 Windows 服务器上为 mongrel/rails 安装这个 service_wrapper?
【发布时间】:2011-11-29 15:20:19
【问题描述】:

安装我在 Windows Server 2008 上编写的 Rails 3 应用程序的任务令人不快改变环境作为解决方案)。

我按照this blog post 上的说明进行操作(稍作修改),经过一番挫折后,我的应用程序实际上已在 Windows/IIS(代理杂种)下启动并运行。剩下的唯一事情就是让 mongrel 作为服务运行。

不幸的是,mongrel gem 没有在 Rails 3 中保持最新,虽然我可以在命令行中让应用程序在 mongrel 下运行,但我无法使用 mongrel_service 让应用程序作为服务运行。

解决方案似乎是使用this previous question 中提到的github 上的service_wrapper 项目。该项目尚未完成,但显然可以正常运行,但没有文档/二进制文件。我已经查看了源代码,但并不真正了解它是什么/它是如何工作的,所以想知道是否有人可以指出我正确的方向(或者,更好的是,指导我如何安装它。

那么近,却又那么远.....

【问题讨论】:

    标签: ruby-on-rails-3 windows-services windows-server-2008 mongrel


    【解决方案1】:

    好的,我已经解决了(在 luislavena 本人的帮助下 - 谢谢)。

    https://github.com/luislavena/service_wrapper/downloads 下载 service_wrapper-0.1.0-win32.zip 并从 bin/ 中提取 service_wrapper.exe。我把它解压到 C:\service_wrapper。

    接下来设置一个配置文件。我使用了 hello 示例并针对我的应用对其进行了修改,然后将其放在 C:\service_wrapper 目录中。

    ; Service section, it will be the only section read by service_wrapper
    [service]
    
    ; Provide full path to executable to avoid issues when executable path was not
    ; added to system PATH.
    executable = C:\Ruby192\bin\ruby.exe
    
    ; Provide there the arguments you will pass to executable from the command line
    arguments = C:\railsapp\script\rails s -e production
    
    ; Which directory will be used when invoking executable.
    ; Provide a full path to the directory (not to a file)
    directory = C:\railsapp
    
    ; Optionally specify a logfile where both STDOUT and STDERR of executable will
    ; be redirected.
    ; Please note that full path is also required.
    logfile = C:\railsapp\log\service_wrapper.log
    

    现在只需创建服务

    sc create railsapp binPath= "C:\service_wrapper\service_wrapper.exe C:\service_wrapper\service_wrapper.conf" start= auto
    

    (注意 binPath= 和 start= 之后的空格。没有它们将无法工作)

    然后开始

    net start railsapp
    

    然后你就回家了!

    【讨论】:

      【解决方案2】:

      我应该为这篇文章做出贡献。对于使用 bundle exec 的配置,请使用以下命令: 请注意,我正在设置 ruby​​CAS!这是一个很棒的 OpenCAS 身份验证机制!!!

      ; Service section, it will be the only section read by service_wrapper
      [service]
      
      ; Provide full path to executable to avoid issues when executable path was not
      ; added to system PATH.
      executable = C:\Ruby\bin\ruby.exe
      
      ; Provide there the arguments you will pass to executable from the command line
      arguments = D:\rubycas-server bundle exec rackup -s mongrel -p 11011
      
      ; Which directory will be used when invoking executable.
      ; Provide a full path to the directory (not to a file)
      directory = D:\rubycas-server
      
      ; Optionally specify a logfile where both STDOUT and STDERR of executable will
      ; be redirected.
      ; Please note that full path is also required.
      logfile = D:\rubycas-server\log\service_wrapper.log
      

      【讨论】:

        猜你喜欢
        • 2011-01-31
        • 2012-07-27
        • 2010-11-16
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2010-11-12
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多