现在,如何在我的服务器上运行我的第一个ruby应用程序?(How do I run my first ruby app on my server now that its done?)

编程入门 行业动态 更新时间:2024-10-25 02:29:25
现在,如何在我的服务器上运行我的第一个ruby应用程序?(How do I run my first ruby app on my server now that its done?)

所以我已经成功完成了我的第一个ruby应用:)

当我在本地编程时,我必须在终端中单独使用以下所有命令来启动和运行它。 问题是当我关闭终端时它们都停止了,所以即使我在服务器上注销ssh,我也不知道如何保持它们打开。

首先,我在端口9292上通过机架(sinatra框架)运行应用程序,然后启动redis,然后为2个Resque作业队列创建一个单独的工作程序

rackup config.ru redis-server rake workers:start

我之所以没有使用“生产/开发”结构,只是因为我还没有真正了解它。 我只是想简单地设置它,然后我可以回去学习它是如何工作的。 所以我知道这不是专业应用程序的最佳方法,但是现在我正在寻找最简单的方法(但仍然没有采取快捷方式)。

我也相信我将使用乘客正式运行。 我不确定接下来的步骤是什么让它启动并运行所以我可以退出它只是保持活跃和工作。 我也不知道我是否必须单独运行命令,或者我是否可以将它们全部放在一个文件中,所以我只是运行passenger start ,那就结束了。

So I've successfully finished my first ruby app :)

When i programmed it locally, i have to use all the following commands below separately in terminal to get it up and running. The problem is when I close terminal they all stop, so I don't know how to keep them open even when i log out of ssh on my server.

First I get the app running via rack (sinatra framework) on port 9292, then start redis, and then create a single worker for 2 Resque job queues

rackup config.ru redis-server rake workers:start

I haven't been using "production/development" structures simply because I haven't really learned about that yet. I'm just trying to get it set up simply, then I can go back and learn how all that works. So i understand this isnt the best method for a professional app, but right now I'm looking for the easiest (but still without taking shortcuts).

I also believe I'm going to be using passenger to get it officially running. I'm not sure what the next steps are to get it up and running so i can log out and it just stays active and working. I also dont know if i have to run the commands separately or if I can put them all in one file somewhere so i just run passenger start and thats the end of it.

最满意答案

如果您要使用Passenger来托管您的应用程序,那么您将不会运行命令来启动服务器; 相反,应用程序将只是作为nginx或httpd一部分运行,它将通过系统的init(8)工具启动。

配置init(8)方式因系统而异,但SysV风格的init通常在/etc/rc*.d/*目录中有脚本来控制启动, 基于Upstart的系统在/etc/init/会有配置文件/etc/init/ ,依此类推。 那时候,你不是在寻找运行passenger应用程序的方法,而是寻找启动Apache httpd或nginx ,这是一个已经很好解决的问题。

If you're going to use Passenger to host your application then you won't be running commands to start the server; instead, the application will simply run as part of nginx or httpd, which will be started via the system's init(8) tool.

How init(8) is configured varies considerably from system to system, but SysV-style init will typically have scripts in /etc/rc*.d/* directories to control startup, Upstart-based systems will have config files in /etc/init/, and so on. At that point, you're not looking for ways to run passenger applications so much as a way to start Apache httpd or nginx, and that's an already well-solved problem.

更多推荐

本文发布于:2023-07-16 12:38:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1128550.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:第一个   应用程序   器上   如何在   ruby

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!