简体   繁体   English

将 Rails 部署到 Elastic Beanstalk、nodejs?

[英]Deploying Rails to Elastic Beanstalk, nodejs?

I want to host my app on a VPC EC2 instance with AWS, and this line in the documentation has me somewhat confused:我想使用 AWS 在 VPC EC2 实例上托管我的应用程序,文档中的这一行让我有些困惑:

Install nodejs to allow the Rails server to run locally:安装 nodejs 以允许 Rails 服务器在本地运行:

$ sudo apt-get install nodejs

I was just wondering why I need nodejs at all, let alone to allow the rails server to run locally since i thought that this was already handled by WEBrick.我只是想知道为什么我根本需要 nodejs,更不用说允许 rails 服务器在本地运行了,因为我认为这已经由 WEBrick 处理了。

Heres a link to the documentation in question:这是相关文档的链接:

http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/create_deploy_Ruby_rails.html http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/create_deploy_Ruby_rails.html

Rails uses a Javascript runtime for certain tasks (generating scaffolds and compiling templates among others). Rails 使用 Javascript 运行时执行某些任务(生成脚手架和编译模板等)。 You do not need to use nodejs, you can add other runtimes as gems in your Gemfile, eg therubyracer , therubyrhino .您不需要使用 nodejs,您可以在 Gemfile 中添加其他运行时作为 gems,例如therubyracertherubyrhino (YMMV on EC2, if it suggests using nodejs, I would install it unless you have a good reason not to) (EC2 上的 YMMV,如果它建议使用 nodejs,我会安装它,除非你有充分的理由不这样做)

The title of the question is unclear.问题的标题不清楚。 Elasticbeanstalk uses EC2 instances but you should never ssh directly into an EC2 server to make changes. Elasticbeanstalk使用EC2 实例,但您不应直接通过 ssh 连接到 EC2 服务器进行更改。

Elasticbeanstalk will destroy and create EC2 instances to scale with the web traffic coming to the application. Elasticbeanstalk 将销毁并创建 EC2 实例,以随着进入应用程序的 Web 流量进行扩展。 Making changes to one particular instance will not guarantee it will make the changes for all of the EC2 instances belonging to one Elasticbeanstalk application.对一个特定实例进行更改并不能保证它会对属于一个 Elasticbeanstalk 应用程序的所有 EC2 实例进行更改。

Also that particular instance can be destroyed when deploying, or rebuilding or when the app scales back down.此外,该特定实例可以在部署、重建或应用程序缩减时销毁。

If you're using the Ruby platform on Elasticbeanstalk you'll need to use their builtin in EB extensions to either run a command to install node or use the yum package manager to install it.如果您在 Elasticbeanstalk 上使用 Ruby 平台,则需要使用它们在 EB 扩展中的内置命令来运行命令来安装节点或使用 yum 包管理器来安装它。

Here's documentation that describes the yum method:这是描述 yum 方法的文档:

https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/customize-containers-ec2.html#linux-packages https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/customize-containers-ec2.html#linux-packages

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM