如何在Windows Server上为Mongrel/rails安装此service_wrapper? [英] How do I install this service_wrapper for mongrel/rails on my windows server?

查看:82
本文介绍了如何在Windows Server上为Mongrel/rails安装此service_wrapper?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

安装Windows Server 2008上编写的Rails 3应用程序给我带来了不愉快的任务(绝对不是我的选择-被答应为linux服务器,但IT部门在最后一刻取消了建议,所以请不要建议改变环境作为解决方案).

我按照此博客文章上的说明进行了一些修改( ),现在经过很多挫折之后,我的应用实际上已经在Windows/IIS(代理杂种)下启动并运行.剩下的唯一事情就是让杂种作为服务运行.

不幸的是,mongrel gem尚未针对Rails 3保持最新,并且尽管我可以在命令行下使应用程序在mongrel下运行,但我无法使用mongrel_service来使该应用程序作为服务运行.

此问题的解决方案似乎是使用github上的 service_wrapper 项目. 上一个问题.该项目尚未完成,但显然可以正常运行,但是没有文档/二进制文件.我看了一下源代码,并不太了解它是什么/它是如何工作的,因此想知道是否有人可以向我指出正确的方向(或者甚至更好地指导我如何进行安装)./p>

那么近,但仍然很远.....

解决方案

好的,我已经解决了这个问题(在luislavena自己​​的帮助下-谢谢).

https://github.com/luislavena/service_wrapper下载service_wrapper-0.1.0-win32.zip/downloads 并从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

然后您就可以回家了!

I have been given the unpleasant task of installing a Rails 3 app I have written on Windows Server 2008 (definitely not my choice - was promised a linux server but I.T. pulled the rug out at the last minute so please don't suggest a change in environment as a solution).

I followed the instructions on this blog post (with a few minor modifications) and now actually have my app up and running under Windows/IIS (proxying mongrel) after a great deal of frustration. The only thing remaining is to get mongrel running as a service.

Unfortunately the mongrel gem has not been kept up-to-date for Rails 3 and while I can get the app running under mongrel at the command line I am unable to use mongrel_service to get the app running as a service.

The solution to this appears to be to use the service_wrapper project on github which has been mentioned in this previous question. The project is not yet complete but apparently functional but comes without documentation/binaries. I have looked through the source-code and don't really understand what is it/how it works so was wondering if someone can point me in the right direction (or, even better, walk me through how) to get this installed.

So close, yet still so far.....

解决方案

Alright I have this worked out (with a little help from luislavena himself - thanks).

Download service_wrapper-0.1.0-win32.zip from https://github.com/luislavena/service_wrapper/downloads and extract service_wrapper.exe from bin/. I extracted it to C:\service_wrapper.

Next set up a configuration file. I used the hello example and modified it for my app then placed it in the C:\service_wrapper directory.

; 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

Now just create the service with

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

(watch for the spaces after binPath= and start=. It won't work without them)

Then start it with

net start railsapp

And you're home and hosed!

这篇关于如何在Windows Server上为Mongrel/rails安装此service_wrapper?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆