Ruby 开发环境(OS X 与 Ubuntu)
我是一名使用 RoR-CoffeeScript-Sass-Passenger-Apache 的开发人员。我们使用 EC2 进行部署,并使用 Macbook Airs 进行开发。虽然 Rails 社区对 Mac 非常友好,但由于开发与生产的整个部署堆栈存在差异,我使用的是 virtualbox+ubuntu,而我的同行则在 OS X 本机上进行开发。
使用 OS X Native 会增加更多问题,因为我们在堆栈中有更多依赖项(Solr、Beanstalk、Mongodb 等在 Ubuntu 中运行良好),
我正在寻找有关使用 Mac 和 Amazon EC2 的 Rails 开发人员如何拥有他们的开发和部署的建议产品环境设置。
还希望获得有关使用 vagrant 来分发此用例的开发环境的反馈。
I'm a developer who uses RoR-CoffeeScript-Sass-Passenger-Apache. We use EC2 for our deployment and we have Macbook Airs for development. While the rails community is very much Mac-friendly, because of the whole deployment stack difference in dev vs. prod, I'm using a virtualbox+ubuntu while my peers are developing on OS X native.
Having on OS X Native adds more problem as we have more dependencies in the stack (Solr, Beanstalk, Mongodb and more which works well in Ubuntu)
I'm looking for suggestions on how Rails developers using Mac and Amazon EC2 can have their dev and prod environment setup.
Would also like feedback on use of vagrant for distribution of development environments for this use case.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
常见的做法是将堆栈复制为“临时”环境。使用 EC2,您只需创建现有计算机的 AMI 并复制它们,仅在测试部署时打开它们,并运行测试以确保一切正常运行,然后再将其部署到生产中。或者通常您可能希望将其永久保留,以便开发人员可以根据需要快速部署更新或补丁进行测试。
这样做可以确保您在推出之前拥有生产系统的精确副本进行测试,从而消除与潜入生产的部署相关的任何(灾难性)问题。
A common practice would be to replicate your stack as a "staging" environment. With EC2, you can just create AMI's of your existing machines and duplicate them, turning them on only to test deploys, and run your tests to make sure everything is running properly before deploying it to production. Or often you may wish to leave it on permanently so developers can quickly deploy updates or patches to test as need be.
Doing it this way ensures that you have an exact replica of your production system to test before rolling out, thereby eliminating any (catastrophic) issues pertaining to the deploy sneaking out into production.
我们的团队在 Mac 上进行开发并部署到 EC2 上的 Ubuntu 已经三年了,目前几乎没有出现任何问题。有几件事有助于使这一过程顺利进行:
我们可以在 Mac 上运行整个应用程序堆栈**。在 macports、homebrew 和必要时从源代码构建之间,我们已经成功地将我们在产品中运行的每一项技术都应用于我们的开发盒上。这些部分的配置和组合方式在本地是不同的(例如,在产品中,我们自动发现我们的 memcached 实例,而在本地它是硬编码的),但每个集成都可以在进入产品之前先在 Mac 上进行测试。
我们的持续构建系统与我们的产品盒具有相同的设置。这意味着,如果您签入某些依赖于某些本地魔法的代码,它会很快被发现。
我们运行一个soak(有些人称之为staging或integ)堆栈,其配置与生产相同。这有时会导致一些开发开销,但有很多好处,因此非常值得。所有代码在推送到生产环境之前都会经过此堆栈。
这种设置效果很好,随着时间的推移,我们允许设置的更多部分逐渐分离。我们曾经在本地运行乘客(就像我们在产品中所做的那样),但现在使用 Pow。在升级堆栈的其余部分之前,我们会定期试验正在开发的新 ruby 版本一段时间。
我必须使用虚拟化环境来开发其他项目(VirtualBox 中的 OSX + CentOS),并且确实发现它比全原生更痛苦。其一,感觉就像管理两台机器而不是一台。一切都感觉很sloooooowww。
如果堆栈中的某个部分在 Mac 上运行起来很痛苦,我肯定更愿意接受 a) 花时间让它在本地工作或 b) 抽象出该部分,而不是支付以下费用:处理虚拟环境。
** 我在此讨论中仅包括 Rails 应用程序和直接依赖项。例如,我们使用 puppet 来配置我们的 EC2 队列,但不要在我们的开发盒上运行它。
Our team has been been developing on Macs and deploying to Ubuntu on EC2 for three years now with very few issues. Several things have helped make this a smooth process:
We can run the entire app stack** on a Mac. Between macports, homebrew, and building from source when necessary, we have managed to get every piece of technology that we run in prod working on our dev boxes. The way the pieces are configured and fit together is different locally (in prod, for example, we auto-discover our memcached instance, whereas locally it's hard coded) but every integration can be tested on Macs first before going to prod.
Our continuous build system is on the same setup as our prod boxes. This means if you check in some code that depends on some piece of local magic it's discovered quickly.
We run a soak (some people call this staging or integ) stack that is configured identically to production. This sometimes causes some development overhead but has so many benefits that it's well worth it. All code goes through this stack before being pushed to prod.
This setup has worked well enough that over time we've allowed more parts of the setup to drift apart. We used to run passenger locally (like we do in prod) but now use Pow. We regularly experiment with new ruby versions in development for some time before upgrading the rest of the stack.
I've had to develop using a virtualized environment for other projects (OSX + CentOS in VirtualBox) and definitely found it more painful that all-native. For one, it felt like managing two machines instead of one. Everything also felt sloooooowww.
If there's a piece of the stack that is painful to run on the Mac, I would definitely prefer to take the hit of either a) spending the time of getting it working locally or b) abstracting that piece away, rather than pay the tax of dealing with a virtual environment.
** I'm only including the Rails app and direct dependencies in this discussion. For example, we use puppet to configure our EC2 fleet, but don't run it on our dev boxes.