A Rails Cloud Implementation Using CouchDB and Heroku, Page 2
Two Choices: Run CouchDB on Your Own Server or Use a Hosted CouchDB Service
For development, I run an "unofficial" all-in-one CouchDB application on my MacBook. I also run CouchDB on two of my servers for both testing and deployed applications. See the Resources section for links for installing CouchDB and implementing simple HTTP authentication.
You may simply want to use a commercial CouchDB service like Cloudant. Using either MongoHQ (for MongoDB services) or Cloudant is a great fit for web applications hosted on Heroku: leave the management of your Rails application to Heroku and the management of your data to Cloudant or MongoHQ. I expect to see more commercial MongoDB and CouchDB service providers in the future so you can shop around for the best price.
Just as I did for the MongoDB example, I like to set access information for a local or remote CouchDB server using environment variables; for example:
export COUCHDB_RUBY_DRIVER_HOST=xxxxxxx.com export COUCHDB_RUBY_DRIVER_PORT=5984
I change these values for whichever CouchDB server I am using. As with the MongoDB example, it is easy to pass CouchDB connection parameters to a deployed Heroku application:
$ heroku config:add COUCHDB_RUBY_DRIVER_HOST=xxxxxxx.com
COUCHDB_RUBY_DRIVER_PORT=5984 COUCHDB_PASS=password COUCHDB_USER=notessclient Adding config vars: COUCHDB_RUBY_DRIVER_HOST => xxxxxxx.com COUCHDB_RUBY_DRIVER_PORT => 5984 COUCHDB_PASS => password COUCHDB_USER => notesclient Restarting app...done.
I enjoy doing "bare metal" deployments to leased servers or VPS solutions like Amazon EC2, RimuHosting, Slicehost, etc. That said, sometimes it simply does not make economic sense to create custom deployments and administer your own servers. In those cases, three options are available:
- Use your own servers
- Use cloud deployment servers
- Use a hybrid of cloud services and your own servers
I hope this article provided you with the information necessary to make a wise deployment choice. You also have a few deployment and CouchDB tricks in your toolbox now.
For Further Reading
About the Author
Mark Watson is a consultant living in the mountains of Central Arizona with his wife Carol and a very feisty Meyers Parrot. He specializes in web applications, text mining, and artificial intelligence development. He is the author of 16 books and writes both a technology blog and an artificial intelligence blog.