ruby-on-rails-3 - 如何在我的 Windows 服务器上为 mongrel/rails 安装这个 service_wrapper?

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

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

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

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

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

如此接近,却又如此遥远.....

最佳答案

好的,我已经解决了(在 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

然后你就回家了!

关于ruby-on-rails-3 - 如何在我的 Windows 服务器上为 mongrel/rails 安装这个 service_wrapper?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7630512/

相关文章:

c# - 可以动态接受控制台命令的 Windows 服务应用程序

iis - 在IIS 7.0和win2k8中设置日期格式有多少个不同的地方

iis-7 - godaddy 证书无法与 filezilla 一起使用

ruby-on-rails-3 - JRuby意外的:

ruby-on-rails - 如何在rails3.1中使用ajax?

ruby-on-rails-3 - 如何在 Rails 3 中将网站图标添加到 ActiveAdmin

mysql - Heroku 安装亚马逊 RDS : mysql or mysql2?

vb6 - 不间断的Windows进程

windows-services - Mongodb、分片和多窗口服务

.net - Windows 服务在从 3.5 迁移的 Windows Server 2008、x64、.NET 4 上引发 System.BadImageFormatException