Install camping on Ubuntu


– Camping is a web framework which consistently stays at less than 4kB of code. You can probably view the complete source code on a single page. But, you know, it’s so small that, if you think about it, what can it really do?

Camping is a Ruby Micro Framework

The idea here is to store a complete fledgling web application in a single file like many small CGIs. But to organize it as a Model-View-Controller application like Rails does. You can then easily move it to Rails once you’ve got it going.


– Camping is distributed as ruby gem, So we can install in single command.

$ gem install camping

– For full package we recommend to install camping-omnibus which contain all required libraries.

gem install camping-omnibus

If you are going to use the views you also need to install markaby,

$ gem install markaby

That's it. Now you can enjoy camping on your ubuntu.  

Sample nginx.conf file

Below is the sample nginx.conf file, which i used with unicorn. Basically you will get details description
of each configuration. I spent a lot of time to collect and understand. I hope it will help somebody.

Nginx Configuration

upstream interest_app_server { # fail_timeout=0 means we always retry an upstream even if it failed # to return a good HTTP response (in case the Unicorn master nukes a # single worker for timing out). server unix:/webapps/hello_django/run/gunicorn.sock fail_timeout=0; } server { listen 80; server_name; client_max_body_size 4G; access_log /webapps/hello_django/logs/nginx-access.log; error_log /webapps/hello_django/logs/nginx-error.log; location /static { root /webapps/hello_django/interest/; } location /media { root /webapps/hello_django/interest/; } location /static/admin { root /webapps/hello_django/lib/python2.7/site-packages/django/contrib/admin/; } location / { # an HTTP header important enough to have its own Wikipedia entry: # proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; # enable this if and only if you use HTTPS, this helps Rack # set the proper protocol for doing redirects: # proxy_set_header X-Forwarded-Proto https; # pass the Host: header from the client right along so redirects # can be set properly within the Rack application proxy_set_header Host $http_host; # we don't want nginx trying to do something clever with # redirects, we set the Host: header above already. proxy_redirect off; # set "proxy_buffering off" *only* for Rainbows! when doing # Comet/long-poll stuff. It's also safe to set if you're # using only serving fast clients with Unicorn + nginx. # Otherwise you _want_ nginx to buffer responses to slow # clients, really. # proxy_buffering off; # Try to serve static files from nginx, no point in making an # *application* server like Unicorn/Rainbows! serve static files. if (!-f $request_filename) { proxy_pass http://interest_app_server; break; } } # Error pages error_page 500 502 503 504 /500.html; location = /500.html { root /webapps/hello_django/interest/templates/; } }

Rails couchdb demo application

I was trying to create a demo application using couchdb as backend. I faced to many challenges to create demo application.

– couchdb installation on ubuntu 12.10

– Deciding  ORM

– Create demo_app

– configure couchdb.yml file

– Initialize model attributes.

– Access couchdb data from UI interface.

Below are the step by step instruction to fix all above issues and create a demo application.

1.  couchdb installation on ubuntu 12.10

I already blogged Couchdb installation instruction from source code. followed all steps to install couchdb on your ubuntu machine.

2. ORM

I used ‘couchrest_model’ ORM. Install couchrest_model using as ruby gem.

$ sudo gem install couchrest_model

3. Create demo application

$ rails new rails_couchdb –skip-active-record

Add couchrest_model gem in your gemfile.

gem 'couchrest_model'

Do bundle update.

4. configure couchdb.yml file

$ rails generate couchrest_model:config

then create order scaffold.

$rails g scaffold order name:string details:text phone:integer email:string

5. Initialize model attributes.

You need to require couchrest_model in your rails order model.

require 'couchrest_model' 

and add field using properties keyword.

  property :name,      String
  property :details,      String
  property :phone,     Integer, :default => 95556236
  property :email,      String

Now start your rails server, you able to perform CRUD operation on order table.

6. Access couchdb data from UI interface.

Visit  to access Couchdb data.

That’s it.