Distribute CouchDB as part of a Rails application?

I am working on a Rails project, and the Architect asked me to explore the integration of CouchDB into an application so that it can be deployed by Capistrano on several platforms and managed by Rake.

My assumption was that I could set up an Erlang virtual machine in various environments, and then distribute the CouchDB application with Capistrano. However, I cannot find any option to load CouchDB without Erlang runtime. I can, however, see the option of creating CouchDB from a source, which I assume is platform dependent.

I'm new to Erlang and CouchBD, am I missing something? Is there a way to integrate CouchDB into a Rails application and distribute it across multiple platforms?

+4
source share
2 answers

I think you will not find a silver bullet. The Erlang distribution is similar to the Ruby distribution; however, Ruby has the advantage of being included in many OS installations by default.

I know ejabberd has pre-created binaries for many distributions. You can explore how they do it.

The right decision probably depends on how many "multiple platforms" you target. If it is "Ubuntu 8.04 plus Ubuntu 10.04", which is different from several Linux distributions, plus OSX, as well as FreeBSD. Usually, only open source projects support these many platforms, and ideally, you can get patches from the community. For internal projects, I saw teams standardize Linux builds and use virtualization on Mac / Windows.

But back to your question:

Creating from a source is a smart option. You can create during deployment or pre-assembly for all platforms and then deploy binary files. Both Erlang and CouchDB use Autoconf, which means that you can --prefix them to allocate allocated space (more or less stand-alone applications). This will require some trial and error, but your build script may

  • Platform Dependency Configuration: gcc , make , autoconf , all you need. apt-get on Ubuntu, yum on RHEL, Macports, all you need to get a common platform on your development and deployment system.
  • Compile and install the rest using the tools from step 1. Use configure --prefix=/opt/my_software to save everything in one place. (You can completely remove it with rm -rf .)

This is a mid-level challenge - mostly trial and error. If possible, work as part of the build, for example, the Rake or Toby passenger_stack offer. Good luck

+1
source

Take a look at some of the tools for providing Rails services (such as passenger_stack ). The passenger stack will download, create and install support services for your Rails application ... maybe you can adapt or use Erlang and CouchDB as a base for installing.

There are many alternatives to this. Deprec contains recipes for the provision of Capistrano. The essential idea is the same.

+2
source

Source: https://habr.com/ru/post/1308713/


All Articles