如何将Rails应用程序部署到Dreamhost?

时间:2022-11-06 20:38:20

I'm kind of lost, I try to deploy my application on a shared dreamhost server. Now everything works fine locally. It's my first try at Rails, and I'm not really a programmer or sysadmin, just hacking something together.

我有点迷茫,我尝试在共享的dreamhost服务器上部署我的应用程序。现在一切都在当地很好。这是我在Rails上的第一次尝试,我不是一个程序员或系统管理员,只是一起黑客攻击。

On Dreamhost, if I start webrick, it works fine on port 3000, but webricks gets killed pretty quickly, I guess that makes sense.

在Dreamhost上,如果我开始webrick,它在端口3000上工作正常,但webricks会很快被杀死,我想这是有道理的。

So what do I have to do to make it run?

那么我需要做些什么来让它运行?

I enabled fastcgi support and mod_rails.

我启用了fastcgi支持和mod_rails。

Now, how do I get the app constantly running?

现在,我如何让应用程序持续运行?

I keep reading about having to do things to .htaccess and to dispatch.fcgi.

我一直在读关于.htaccess和dispatch.fcgi的事情。

But I can't find any dispatch file in my rails app (2.3.2).

但我在rails应用程序(2.3.2)中找不到任何调度文件。

Do I have to create that one manually? Doesn't really feeld very rails-like to me. I didn't really manage to find out what this dispatch file does, and why it's needed.

我必须手动创建那个吗?对我来说真的不像铁轨那样。我没有真正找到这个调度文件的作用,以及为什么需要它。

Any help would be greatly appreciated.

任何帮助将不胜感激。

I looked at the DH Wiki, but couldn't figure it out (http://wiki.dreamhost.com/Rails)

我查看了DH Wiki,但无法弄明白(http://wiki.dreamhost.com/Rails)

Additions:

I enabled mod_rails and pointed to the public directory (I had already done that). I keep getting an error: screencast.com/t/KamqVawk

我启用了mod_rails并指向公共目录(我已经这样做了)。我一直收到一个错误:screencast.com/t/KamqVawk

Hm, server logs look like there is actually no request, so this might be a problem on dreamhosts end. It's strange I see that the access.log show a new change date, when I try to access the page, but there is no request noted, error.log is empty too.

嗯,服务器日志看起来实际上没有请求,所以这可能是dreamhosts端的问题。很奇怪我看到access.log显示一个新的更改日期,当我尝试访问该页面时,但没有注明请求,error.log也是空的。

如何将Rails应用程序部署到Dreamhost?

Dreamhost Support Answer:

Dreamhost支持答案:

The server was up to date, so that wasn't the problem. They proposed freezing the Gems, which I did (see: http://wiki.dreamhost.com/Freezing_Gems) But it didn't help. I guess I'm giving up, and looking into hosting which is specialized for rails.

服务器是最新的,所以这不是问题。他们建议冻结宝石,我做了(见:http://wiki.dreamhost.com/Freezing_Gems)但它没有帮助。我想我放弃了,并寻找专门用于rails的托管。

Thx for all your help!

感谢你的帮助!

Changed to hostingrails.com

改为hostingrails.com

I got the app working on hostingrails.com, passenger on hostingrails.com showed me errors, which weren't shown by dreamhost or mongrel. By correcting these errors, I got the app working.

我的应用程序在hostingrails.com上工作,hostingrails.com上的乘客向我显示了错误,这些错误未被dreamhost或mongrel显示。通过纠正这些错误,我得到了应用程序的工作。

1 个解决方案

#1


Dreamhost won't let you use webrick if you're using shared hosting. You can either use FastCGI or Passenger to host Rails on shared DH (mongrel is an option if you upgrade to DreamhostPS, but that's obviously more expensive).

如果您使用共享主机,Dreamhost将不允许您使用webrick。您可以使用FastCGI或Passenger在共享DH上托管Rails(如果您升级到DreamhostPS,则可以选择mongrel,但这显然更昂贵)。

For FastCGI, you will need a dispatch.fcgi file (older versions of Rails would generate one when you created a new Rails app, but that stopped around 2.2 if I remember correctly) as well as code in your .htaccess to send requests to the dispatcher. See the Dreamhost Ruby on Rails wiki page for details about setting up FastCGI.

对于FastCGI,您将需要一个dispatch.fcgi文件(旧版本的Rails会在您创建新的Rails应用程序时生成一个,但如果我没记错的话会在2.2左右停止)以及.htaccess中的代码将请求发送到调度员。有关设置FastCGI的详细信息,请参阅Dreamhost Ruby on Rails维基页面。

The more preferable option is to set up your application to run on Phusion Passenger (aka mod_rails). It should be pretty simple through your Dreamhost panel, you just need to enable the domain to use mod_rails, and then set the directory for the domain to the public directory of your application. See the Passenger wiki page for more details.

更优选的选项是将应用程序设置为在Phusion Passenger(aka mod_rails)上运行。通过Dreamhost面板应该非常简单,只需要让域使用mod_rails,然后将域的目录设置为应用程序的公共目录。有关详细信息,请参阅Passenger wiki页面。

#1


Dreamhost won't let you use webrick if you're using shared hosting. You can either use FastCGI or Passenger to host Rails on shared DH (mongrel is an option if you upgrade to DreamhostPS, but that's obviously more expensive).

如果您使用共享主机,Dreamhost将不允许您使用webrick。您可以使用FastCGI或Passenger在共享DH上托管Rails(如果您升级到DreamhostPS,则可以选择mongrel,但这显然更昂贵)。

For FastCGI, you will need a dispatch.fcgi file (older versions of Rails would generate one when you created a new Rails app, but that stopped around 2.2 if I remember correctly) as well as code in your .htaccess to send requests to the dispatcher. See the Dreamhost Ruby on Rails wiki page for details about setting up FastCGI.

对于FastCGI,您将需要一个dispatch.fcgi文件(旧版本的Rails会在您创建新的Rails应用程序时生成一个,但如果我没记错的话会在2.2左右停止)以及.htaccess中的代码将请求发送到调度员。有关设置FastCGI的详细信息,请参阅Dreamhost Ruby on Rails维基页面。

The more preferable option is to set up your application to run on Phusion Passenger (aka mod_rails). It should be pretty simple through your Dreamhost panel, you just need to enable the domain to use mod_rails, and then set the directory for the domain to the public directory of your application. See the Passenger wiki page for more details.

更优选的选项是将应用程序设置为在Phusion Passenger(aka mod_rails)上运行。通过Dreamhost面板应该非常简单,只需要让域使用mod_rails,然后将域的目录设置为应用程序的公共目录。有关详细信息,请参阅Passenger wiki页面。