CouchDB and CouchApp. Part 3

Hello my dear friends. In Part 1, we built a simple couchapp application. In Part 2, I shown number of tips for using CouchDB on production.
Today we will deploy our CouchApp application to the production environment.

CouchApp have built-in “push” command, which helps you to build and push design document along with your application to CouchDB. In Python version of CouchApp such command looks like:

where “http://someserver:port/mydb” is a direction to your database in CouchDB. For Node.js version such command looks like this (almost the same):

Then you can check your application by such link:

where “myapp” is your app design document name, “index.html” is your HTML file.

Now lets add a domain for this application and display it without this long URI.

To add a virtual host, add a CNAME pointer to the DNS for your domain name. Add an entry to your Configuration File (default linux location “/etc/couchdb/local.ini”) in the [vhosts] section:

“simple_app.couchdb” is a virtual host of application.

Next, add vhosts entry to couchdb by visiting configuration page in Futon app and adding a new section:

Finally, configure Nginx to proxy the requests to the running CouchDB (or use another proxy server):

Now your application should be available by this url:

That’s all folks!