在 EC2 上部署 Rails 应用程序 [英] Deploy Rails Application on EC2

查看:34
本文介绍了在 EC2 上部署 Rails 应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在过去的一周里,我一直在玩橡胶宝石,但似乎无法让它发挥作用.我决定手动设置我的 EC2 实例会更容易.问题是我不知道怎么做.谷歌对新手也没有太大帮助.有什么建议?它真的很感激.

For the past week, I've been playing with the Rubber gem and can't seem to get it to work. I've decided it would be easier just to manually set up my EC2 instance. The problem is that I don't know how. Google hasn't been much help for a newb either. Any suggestions? It really is appreciated.

推荐答案

好的.

  1. 创建一个 AWS 账户.

  1. Create a AWS account.

决定你想进入哪个地区.这个决定涉及很多因素,但以后再担心,只做一个像俄勒冈州或东部这样便宜的地区.

Decided what region you want to be in. Lots of things go into this decision, but worry about it later and just do a cheap one like Oregon or East.

确保您位于左上角的正确区域.

Make sure you are in the correct region at the top left.

然后点击启动服务器.

此时您必须选择一个 AMI.AMI 基本上是您启动服务器时要使用的模板.亚马逊给了你一些,但社区部分有很多.我是一个 CentOS 人,所以我通常搜索 CentOS AMI.RightScale 制作了一些好的,因此您可以搜索其中之一.确保根据所需服务器的大小选择 i386 或 x64.有两种不同类型的 AMI,EBS 支持和 S3 支持.你真的应该坚持使用 EBS,因为你有更多的自由,但有理由同时使用这超出了这个答案的范围.寻找 EBS,你可能会很好.EBS 是块存储.基本上它是您的实例的可连接硬盘.由于云中的一切都是虚拟的",并且在物理意义上没有考虑任何东西,因此您也必须这样思考.因此,如果您想要更多存储空间,您可以稍后附加一些 EBS 卷.不过有一件事,当您关闭 S3 支持的实例时,它们就会再见.如果您设置了终止标志时的删除,EBS 的也将如此,但对于 EBS 的,您可以停止"它们以及终止"它们.

At this point you have to pick a AMI. An AMI is basically the template you want to use when you boot your server. Amazon gives you some, but there are a ton in the community section. I am a CentOS guy so I usually search for a CentOS AMI. RightScale makes some good ones so you can search for one of those. Make sure you pick i386 or x64 depending on the size of server you want. There are two distinct types of AMI's, EBS backed and S3 backed. Really you should stick with EBS because you have some more freedoms, but there are reasons to use both that are beyond the scope of this answer. Look for EBS and you probably will be good. EBS is the block storage. Basically it is attachable harddrives for your instances. Since everything in the cloud is "virtual" and nothing is thought of in a physical sense, you have to think that way too. So if you want more storage, you can attach some EBS volumes later. One thing though, S3 backed instances go bye bye when you shut them down. The EBS ones will too if you have the delete on termination flag set, but with EBS ones you can "Stop" them as well as "Terminate" them.

选择大小和可用区.如果您要设置某种冗余,该区域很重要.就像我使用 MySQL 设置主从一样,我会将主从放在一个区域中,将从放在另一个区域,以防亚马逊遇到与一个区域隔离的问题.但对于这个通用目的,不用担心.

Select the size and availability zone. The zone is important if you are going to be setting up some kind of redundancy. Like if I have a master slave setup with MySQL I would put the master in one zone and the slave in another in case Amazon was having troubles that were isolated to one zone. But for this general purpose, don't worry about it.

高级实例选项.把这一切放在一边,很可能没事.您可以稍后设置此处的一些小东西,例如终止保护.

Advanced Instance Options. Just leave all this alone most likely it is fine. Some of the small things here you can set later like termination protection.

命名.随便.

制作 SSH 密钥.直接向前.登录 Amazon 服务器的唯一方法是使用您分配的 SSH 密钥.没有用户名或密码.

Make a SSH key. Striaght forward. The only way to login to an Amazon server will be with the SSH key you assign it. There are no user names or passwords.

安全组.这是您可能会被绊倒的地方,以及#5.但是您应该首先创建一个通用的安全组调用 foo 或其他任何内容,然后添加您想要在其上打开的端口.所以如果你想通过 ssh 进入它,我假设你这样做,然后打开 22.如果你想将它用于网络,然后打开 80 和 8080 或其他.不过要小心.我通常稍后将我的 SSH 端口更改为随机的.而不是把 0.0.0.0/0 放在上面,我把我的个人 ip 放在上面.但是,如果您不太在意,只需输入 0.0.0.0/0 并向全世界开放那个坏男孩.

Security Groups. This is where you could get tripped up, well here and #5. But you should start off with creating a general security group call foo or whatever then adding the ports you want open on it. So if you want to ssh into it, which I assume you do, then open 22. If you want to use it for web then open 80 and 8080 or whatever. But be careful. I usually change my SSH port later to something random. And instead of putting 0.0.0.0/0 on it, I put my personal ip. But if you don't care that much just put 0.0.0.0/0 and open that bad boy to the world.

然后它就会启动.只要一切都按预期进行.

Then it will boot. As long as it all went as it was supposed to.

现在您可以登录了.只需 ssh -i thekey.pem thenwholehostname

Now you can login. Just ssh -i thekey.pem thenwholehostname

希望有所帮助.

您可以使用整个免费套餐.http://aws.amazon.com/free/

There is this whole free tier you can use. http://aws.amazon.com/free/

检查一下.我会在你玩的时候用它.

Check that out. I would use that while you play with it.

我凭记忆做了所有这些,所以我本来可以离开的.;)

I did all that from memory so I could have been off. ;)

这篇关于在 EC2 上部署 Rails 应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆