将 CouchDB 作为 Rails 应用程序的一部分进行分发?
我正在开发一个 Rails 项目,架构师要求我研究将 CouchDB 捆绑到应用程序中,以便 Capistrano 可以跨多个平台部署它并由 Rake 进行管理。
我的期望是我可以在各种环境中设置 Erlang VM,然后使用 Capistrano 分发 CouchDB 应用程序。但是,我找不到任何在没有 Erlang 运行时的情况下下载 CouchDB 的选项。不过,我可以看到一个从源代码构建 CouchDB 的选项,我认为该选项与平台相关。
我是 Erlang 和 CouchBD 的新手,我错过了什么吗?有没有办法将 CouchDB 捆绑到 Rails 应用程序中并跨多个平台分发?
I am working on a Rails project and the Architect has asked me to investigate bundling CouchDB into to application so that it can be deployed by Capistrano across multiple platforms and managed by Rake.
My expectation was that I could set up the Erlang VM on the various environments and then distribute the CouchDB application with Capistrano. However I can't find any option to download CouchDB without the Erlang runtime. I can, however see an option to build CouchDB from source which I assume is platform dependent.
I am new to Erlang and CouchBD, am I missing something? Is there a way to bundle CouchDB into a Rails app and distribute it across multiple platforms?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
查看一些用于配置 Rails 服务的工具(例如 passenger_stack)。 Passenger Stack 将为您的 Rails 应用程序下载、制作和安装辅助服务……您可能可以调整或用作安装 Erlang 和 CouchDB 的基础。
对此也有很多替代方案。 Deprec 包含使用 Capistrano 进行配置的方法。但基本思想是相同的。
Have a look at some of the tools for provisioning Rails services (such as passenger_stack). Passenger Stack will download, make and install the ancillary services for your Rails app ... might be something you can adapt or use as a base to install Erlang and CouchDB.
There are a bunch of alternatives to this as well. Deprec contains recipes for provisioning with Capistrano. Essential idea is the same though.
我认为你不会找到灵丹妙药。分发 Erlang 与分发 Ruby 类似;然而,Ruby 的优点是包含在许多默认操作系统安装中。
我知道 ejabberd 为许多发行版预先构建了二进制文件。你可以调查一下他们是如何做到的。
正确的解决方案可能取决于您的目标有多少个“多个平台”。如果是“Ubuntu 8.04 加 Ubuntu 10.04”,则与几个 Linux 发行版、加上 OSX、加上 FreeBSD 不同。通常只有开源项目支持这么多平台,理想情况下您可以从社区获取补丁。对于内部项目,我看到团队在 Linux 构建上进行标准化,并在 Mac/Windows 上使用虚拟化。
但回到你的问题:
从源代码构建是一个合理的选择。您可以在部署时进行构建,或者为所有平台进行预构建,然后部署二进制文件。 Erlang 和 CouchDB 都使用 Autoconf,这意味着您可以将它们
--prefix
到专用位置(或多或少独立应用程序)。这将需要一些尝试和错误,但您的构建脚本可以进行gcc
、make
、autoconf
,以及您需要的一切。 Ubuntu 上的apt-get
、RHEL、Macports 上的yum
,无论您需要什么,都可以在您的开发和部署系统上获得通用平台configure --prefix=/opt/my_software
将其全部保存在一个位置。 (您可以使用rm -rf
完全卸载。)这是一个中等级别的挑战——主要是反复试验。如果可能,请在构建框架内工作,例如 Rake 或 Toby 的建议
passenger_stack
。祝你好运!I think you will not find a silver bullet. Distributing Erlang is similar to distributing Ruby; however Ruby has the advantage of being included in many default OS installs.
I know ejabberd has pre-built binaries for many distros. You might investigate how they do it.
The correct solution probably depends on how many "multiple platforms" you are targeting. If it's "Ubuntu 8.04 plus Ubuntu 10.04" that is different from several Linux distros, plus OSX, plus FreeBSD. Typically only open source projects support those many platforms and ideally you can get patches from the community. For internal projects, I have seen teams standardize on a Linux build and use virtualization on Mac/Windows.
But back to your question:
Building from source is a reasonable option. You could build when you deploy, or pre-build for all platforms and then deploy the binaries. Both Erlang and CouchDB use Autoconf which means you can
--prefix
them to a dedicated location (more-or-less standalone apps). It will take some trial and error but your build script cangcc
,make
,autoconf
, everything you need.apt-get
on Ubuntu,yum
on RHEL, Macports, whatever you need to get a common platform on your development and deployment systemconfigure --prefix=/opt/my_software
to keep it all in one place. (You can totally uninstall withrm -rf
.)This is an medium-level challenge--mostly trial and error. If possible, work within a build framework such as Rake or Toby's suggestion
passenger_stack
. Good luck!