CouchDB Rails

Rails-CouchDB

Integrate CouchDB with Ruby on Rails

This quickstart guide will help you to integrate your Ruby on Rails application with CouchDB service on App42 PaaS.


Glossary

Kontena – Kontena is a lightweight container that will run your apps and services in an isolated and secured manner. You can specify the power of the Kontena while setting up infra or creating services. One Kontena power specifies to 256 MB Memory and 128 MHz CPU.

Service – Services in the App42 PaaS are add-on components which are needed in an App. App42 PaaS supports multiple services like SQL databases, NoSQL databases and more.

Prerequisites

To get going with App42 PaaS, below are few prerequisites that will allow you to use AppHQ – App42 PaaS Management Console as well as Command Line Client.


Configure CouchDB credentials into Ruby on Rails App

Once you have created the CouchDB service, You need to let Rails know about the database configuration information to connect with service. We do this in the file couchdb.yml, available in the app_root_dir/config subdirectory of Rails Application you created. You need to change the host, port, database, username and password lines to reflect the permissions on the databases you’ve created.

protocol: 'http'                                               
host: < host >                  # VM IP
port: < port >                  # VM Port
prefix: < database name >       # Database Name a/c to prefix and suffix 
suffix: production              # Database Name a/c to  prefix and suffix
username: < user_name >         # User Name
password: '< password >'        # Password

You can also use our Sample Apps and extend it to suit your needs. Here is the link to Ruby on Rails CouchDB Sample App

Update Application

After doing all the modifications to your App, you need to update it on App42 PaaS to get the changes affected in your App running on App42 PaaS platform.

$ app42 update
Enter App Name: javademo
1: Binary
2: Source
Choose Upload Type [Binary]: 2

Updating Application... OK

Operation is in progress, Please wait...-
App deployed successfully.