3

我得到了安装一个Rails 3应用程序的不愉快任务,我在Windows Server 2008上编写了这个应用程序(绝对不是我的选择 - 曾承诺过一个Linux服务器,但IT在最后一分钟将地毯拉出来,所以请不要建议作为解决方案改变环境)。如何在我的Windows服务器上安装mongrel/rails的service_wrapper?

我按照this blog post(有一些小的修改)的说明,现在实际上让我的应用程序在Windows/IIS(proxying mongrel)下运行并经受了很多挫折。剩下的唯一东西就是让杂种作为服务运行。

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

解决方案似乎是使用this previous question中提到的github上的service_wrapper项目。该项目尚未完成,但显然功能,但没有文件/二进制文件。我已经浏览了源代码,并且不知道它是什么/它是如何工作的,所以想知道是否有人能够指引我朝着正确的方向(或者,甚至更好地指导我如何)来安装它。

如此接近,但仍到目前为止.....

回答

8

好吧,我有这个工作了(从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后空间=开始=,不会没有他们的工作)

然后用

启动它的服务
net start railsapp 

而你回家了!

1

我应该为这篇文章做出贡献。对于使用bundle exec的配置,请使用以下命令: 请注意,我正在设置rubyCAS!这是一个很棒的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 
相关问题