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:
$ couchapp push http://someserver:port/mydb
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):
$ couchapp push app.js http://someserver:port/mydb
Then you can check your application by such link:
http://someserver:port/mydb/_design/myapp/index.html
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:
[vhosts]
simple_app.couchdb = /mydb/_design/myapp/_rewrite
“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:
section = vhosts
option = simple_app.couchdb 
value = /mydb/_design/myapp/_rewrite
Finally, configure Nginx to proxy the requests to the running CouchDB (or use another proxy server):
server {
  listen 80;
  server_name simple_app.couchdb

  location / {
    proxy_pass http://0.0.0.0:5984;
    proxy_redirect off;
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  }

}
Now your application should be available by this url:
http://simple_app.couchdb
That’s all folks!