使用 MacOSX 将 Rails 应用程序推送到 AWS Elastic Beanstalk

Posted

技术标签:

【中文标题】使用 MacOSX 将 Rails 应用程序推送到 AWS Elastic Beanstalk【英文标题】:Pushing Rails app to AWS Elastic Beanstalk with MacOSX 【发布时间】:2014-11-23 20:50:21 【问题描述】:

我目前正在阅读 Amazon 将 Rails 应用程序推送到新 EB 实例的说明:http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/create_deploy_Ruby_rails.html

每次我尝试,我都会进入第 14 步并得到展示

更新本地 Git 配置失败。按照“http://docs.amazonwebservices.com/elasticbeanstalk/latest/dg/command-reference-get-started.html”中的说明设置您的 Git 存储库,然后重试。

我也尝试过“git aws.push”,但它不适合它。

我可能有权限问题或我的路径之一是错误的?

调试此问题的最佳方法是什么?

谢谢

附加信息 这是我执行 git aws.push 时的输出

$ git aws.push git: 'aws.push' 不是 git 命令。请参阅“git --help”。

.elasticbeanstalk 目录也是空的,除了一个配置文件

eb init 返回:

> $ eb init
To get your AWS Access Key ID and Secret Access Key, 
  visit "https://aws-portal.amazon.com/gp/aws/securityCredentials".
Enter your AWS Access Key ID (current value is "*****"): 
Enter your AWS Secret Access Key (current value is "*****"): 
Select an AWS Elastic Beanstalk service region (current value is "US East (Virginia)").
Available service regions are:
1) US East (Virginia)
2) US West (Oregon)
3) US West (North California)
4) EU West (Ireland)
5) Asia Pacific (Singapore)
6) Asia Pacific (Tokyo)
7) Asia Pacific (Sydney)
8) South America (Sao Paulo)
Select (1 to 8): 
Enter an AWS Elastic Beanstalk application name (current value is "fooapp3"): 
Enter an AWS Elastic Beanstalk environment name (current value is "fooapp3-env"): 
Select an environment tier (current value is "WebServer::Standard::1.0").
Available environment tiers are:
1) WebServer::Standard::1.0
2) Worker::SQS/HTTP::1.0
Select (1 to 2): 
Select a solution stack (current value is "32bit Amazon Linux 2014.03 v1.0.7 running Ruby 1.9.3").


Available solution stacks are:
1) 64bit Amazon Linux 2014.03 v1.0.7 running php 5.5
2) 32bit Amazon Linux 2014.03 v1.0.7 running PHP 5.5
3) 64bit Amazon Linux 2014.03 v1.0.7 running PHP 5.4
4) 32bit Amazon Linux 2014.03 v1.0.7 running PHP 5.4
5) 64bit Amazon Linux 2014.03 v1.0.6 running PHP 5.5
6) 64bit Amazon Linux 2014.03 v1.0.6 running PHP 5.4
7) 32bit Amazon Linux running PHP 5.3
8) 64bit Amazon Linux running PHP 5.3
9) 64bit Amazon Linux 2014.03 v1.0.7 running Node.js
10) 32bit Amazon Linux 2014.03 v1.0.7 running Node.js
11) 64bit Amazon Linux 2014.03 v1.0.6 running Node.js
12) 64bit Windows Server 2008 R2 running IIS 7.5
13) 64bit Windows Server 2012 running IIS 8
14) 64bit Windows Server 2012 R2 running IIS 8.5
15) 64bit Windows Server Core 2012 R2 running IIS 8.5
16) 64bit Amazon Linux 2014.03 v1.0.7 running Tomcat 7 Java 7
17) 32bit Amazon Linux 2014.03 v1.0.7 running Tomcat 7 Java 7
18) 64bit Amazon Linux 2014.03 v1.0.7 running Tomcat 7 Java 6
19) 32bit Amazon Linux 2014.03 v1.0.7 running Tomcat 7 Java 6
20) 64bit Amazon Linux 2014.03 v1.0.6 running Tomcat 7 Java 7
21) 64bit Amazon Linux 2014.03 v1.0.6 running Tomcat 7 Java 6
22) 32bit Amazon Linux running Tomcat 7
23) 64bit Amazon Linux running Tomcat 7
24) 32bit Amazon Linux running Tomcat 6
25) 64bit Amazon Linux running Tomcat 6
26) 64bit Amazon Linux 2014.03 v1.0.7 running Python 2.7
27) 32bit Amazon Linux 2014.03 v1.0.7 running Python 2.7
28) 64bit Amazon Linux 2014.03 v1.0.7 running Python
29) 32bit Amazon Linux 2014.03 v1.0.7 running Python
30) 64bit Amazon Linux 2014.03 v1.0.6 running Python 2.7
31) 64bit Amazon Linux 2014.03 v1.0.6 running Python
32) 32bit Amazon Linux running Python
33) 64bit Amazon Linux running Python
34) 64bit Amazon Linux 2014.03 v1.0.7 running Ruby 2.1 (Puma)
35) 64bit Amazon Linux 2014.03 v1.0.7 running Ruby 2.1 (Passenger Standalone)
36) 64bit Amazon Linux 2014.03 v1.0.7 running Ruby 2.0 (Puma)
37) 64bit Amazon Linux 2014.03 v1.0.7 running Ruby 2.0 (Passenger Standalone)
38) 64bit Amazon Linux 2014.03 v1.0.7 running Ruby 1.9.3
39) 32bit Amazon Linux 2014.03 v1.0.7 running Ruby 1.9.3
40) 64bit Amazon Linux 2014.03 v1.0.6 running Ruby 2.1 (Puma)
41) 64bit Amazon Linux 2014.03 v1.0.6 running Ruby 2.1 (Passenger Standalone)
42) 64bit Amazon Linux 2014.03 v1.0.6 running Ruby 2.0 (Puma)
43) 64bit Amazon Linux 2014.03 v1.0.6 running Ruby 2.0 (Passenger Standalone)
44) 64bit Amazon Linux 2014.03 v1.0.6 running Ruby 1.9.3
45) 64bit Amazon Linux 2014.03 v1.0.7 running Docker 1.0.0
46) 64bit Amazon Linux 2014.03 v1.0.6 running Docker 1.0.0
Select (1 to 46): 




Select an environment type (current value is "SingleInstance").
Available environment types are:
1) LoadBalanced
2) SingleInstance
Select (1 to 2): Create an RDS DB Instance? [y/n] (current value is "Yes"): Create an RDS BD Instance from (current value is "[No snapshot]"):



1) [No snapshot]
2) [Other snapshot]
Select (1 to 2): Enter an RDS DB master password (current value is "******"): 
If you terminate your environment, your RDS DB Instance will be deleted and you will lose your data.
Create snapshot? [y/n] (current value is "No"): 
Attach an instance profile (current value is "aws-elasticbeanstalk-ec2-role"):


1) [Create a default instance profile]
2) aws-elasticbeanstalk-ec2-role
3) admin_role
4) [Other instance profile]
Select (1 to 4): Failed to update local Git configuration. Follow the instructions at "http://docs.amazonwebservices.com/elasticbeanstalk/latest/dg/command-reference-get-started.html" to set up your Git repository, and then try again.

【问题讨论】:

您可以添加尝试git aws.push时的输出吗? 嗨乔希 - 刚刚添加。 看起来您可能还没有运行 eb init 并设置您的应用程序? 实际上“更新本地 Git 配置失败。按照 in...”消息是运行 eb init 结束时返回的内容(在创建应用程序并初始化 git 之后)... 不幸的是,数据太少,无法调试。 eb init 的完整日志是什么?您的.elasticbeanstalk 目录中有任何内容吗? 【参考方案1】:

在discussion 之后,我们能够确定问题与 OS X 对可执行文件设置了下载隔离区有关。

要确认这是问题所在,请运行 ls -al AWS-ElasticBeanstalk-CLI-2.6.3/AWSDevTools/Linux/。如果您在以下权限旁边看到@

-rwxrwxrwx@ 1 user staff 2134 22 Apr 00:17 AWSDevTools-RepositorySetup.sh 
drwxr-xr-x 7 user staff 238 25 Sep 14:51 scripts

那么您的可执行文件将被隔离。

失败是因为eb init尝试执行时,执行失败。有关该问题的更多信息已记录在 here。

修复是运行:

$ xattr -rd com.apple.quarantine AWS-ElasticBeanstalk-CLI-2.6.3/AWSDevTools/Linux/

验证它不再被ls -al 隔离,然后继续eb init 以完成设置。

【讨论】:

再次感谢您对 Josh 的帮助。这让我发疯了。

以上是关于使用 MacOSX 将 Rails 应用程序推送到 AWS Elastic Beanstalk的主要内容,如果未能解决你的问题,请参考以下文章

将 Rails 应用程序推送到 Heroku 时缺少“sqlite3.h”

将 Rails 应用程序推送到 Heroku 时出现啥错误

应该如何使用 Amazon Web 服务及其弹性 beantalk 将机密文件推送到 EC2 Ruby on Rails 应用程序?

安装sqlite3时发生将rails应用程序推送到Heroku错误,并且Bundler无法继续[重复]

将带有 SQLite3 的 Rails 推送到 Heroku 失败 [重复]

推送到Heroku时Ruby on Rails错误