0

没有在 AWS OpsWorks 中部署 Rails 应用程序。完全困惑如何做到这一点!谁能告诉我部署一个 RoR 应用程序需要多少个实例?

我已经创建了“Rails App Server”实例,它看起来不错。在这里,我使用 nginx 和 Unicorn 作为 Rails Stack。在此处输入图像描述

之后,我从 git repo 添加了一个应用程序。然后部署该应用程序。并显示它已成功部署的日志。

但在公共 IP 中它正在显示404 Not Found Error - nginx

任何帮助都是不言而喻的。

4

2 回答 2

2

I had this issue, and it turned out that the default virtual host /etc/nginx/sites-enabled/000-default symbolic link was not getting removed during deployment.

The 404 was actually nginx looking for a public root of whatever was in the default virtual host, as seen in /var/logs/nginx/error.log

2015/12/23 21:46:05 [error] 3839#0: *15 "/var/www/nginx-default/index.html" is not found (2: No such file or directory), client: 127.0.0.1, server: rails-app1, request: "GET / HTTP/1.1", host: "localhost"

Worse, it comes back after every OpsWorks deployment. Removing that link fixed the problem for me.

To make the fix sustainable and automated, I added a custom recipe to the Deploy lifecycle event for the Rails App Server layer, called custom-cookbook::delete-default-site. The recipe looks like this:

file '/etc/nginx/sites-enabled/000-default' do
    action :delete
end

service 'nginx' do
    action :reload
end
于 2015-12-23T22:46:24.687 回答
0

检查独角兽及其日志文件的进程列表。如果 unicorn 主进程未启动,部署不会因某种原因失败。

于 2014-01-29T03:04:29.817 回答