当我启动rails应用程序时,如何启动ruby服务器脚本?

时间:2022-03-23 23:37:38

I'd like for a ruby server script that lives in my rails app root folder to accept connections from clients (the clients are not browsers--not that this really matters i guess) and update the db of my rails app while my rails app is running. Therefore, I'd like for it to be told somehow to start running whenever my web server starts serving up my rails app and stop running whenever my web server stops serving my rails app. How can I do this? Is this as simple as putting the name/path of my ruby server script somewhere?

我想要一个ruby服务器脚本,它位于我的rails应用程序根文件夹中以接受来自客户端的连接(客户端不是浏览器 - 这不是我认为这真的很重要)并且在我的rails应用程序时更新我的​​rails应用程序的数据库在跑。因此,我希望无论何时我的Web服务器开始提供我的rails应用程序并且每当我的Web服务器停止提供我的rails应用程序时停止运行,我都会被告知。我怎样才能做到这一点?这就像将ruby服务器脚本的名称/路径放在某处一样简单吗?

1 个解决方案

#1


1  

You should look into Foreman, a gem specifically for launching multiple processes in your server environment.

您应该查看Foreman,一个专门用于在服务器环境中启动多个进程的gem。

#1


1  

You should look into Foreman, a gem specifically for launching multiple processes in your server environment.

您应该查看Foreman,一个专门用于在服务器环境中启动多个进程的gem。