将瘦 Web 服务器作为 Windows 服务运行

发布于 2024-10-06 04:24:47 字数 310 浏览 0 评论 0原文

我正在尝试在生产 Redmine 应用程序中部署。我听说 Thin 是最快的 ruby​​ on Rails Web 服务器,所以我安装了它。现在我有一个非常简单的问题:每次通过 cmd 重新启动机器时我都必须启动它,因为没有预构建的 Windows 服务或类似的东西允许我自动启动它。我该如何解决这个问题?我看到有一个 bat 文件,所以我尝试创建一个像这样的 C# Windows 服务,它可以正确启动,但如果我停止它,服务就会停止,但网络服务器仍然处于活动状态,并且永远不会关闭。停止精简的唯一方法是重新启动机器。也许我错了,有人可以发布一个示例,说明我应该如何作为 Windows 服务运行瘦身吗?

i'm trying to deploy in production Redmine application. I heard that thin is the fastest ruby on rails webserver so I installed it. Now I have a really simple problem: i must start it every time i reboot the machine via cmd because there isn't a prebuilt windows service or something similar that allow me to autostart it. How could i fix the problem? I saw that there is a bat file, so i tried to make a C# windows service like this and it starts correctly but if I stop it the service stops but the webserver is still active and it will never shutdown. The only way to stop thin is to reboot the machine. Maybe I'm wrong, could someone post an example of how should i run thin as a windows service?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

小糖芽 2024-10-13 04:24:47

我不久前写过关于此的一篇博文,但其中大部分内容应该仍然适用。希望有帮助。

但说实话,我总是使用 mongrel-service gem 部署在 Windows 上,并在前面配置一个 apache 以在 3 个 mongrel 之间进行负载平衡。容易多了。
对我来说还有一个很大的优势是,如果 thin-service 出现问题,它不会自动重新启动,而 mongrel-service 会保护你的 mongrel 进程,并且如果它由于某种原因出现故障,它将再次重新启动。对我来说,这是我不能错过的事情。

i've written a blogpost about this a while ago, but most of it should still be applicable. Hope it helps.

But to be honest, i always deploy on windows using the mongrel-service gem, and configure an apache in front to load-balance between 3 mongrels. Much easier.
Also the big advantage for me was that if something went wrong with thin-service, it didn't restart automatically, while the mongrel-service guards your mongrel process, and if it for whatever reason goes down, it will restart it again. For me that was something i could not miss.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文