Couchbase
  • Why NoSQL?
  • Couchbase Server
  • Download
  • Resources
  • Careers
Home | Forums | Couchbase | Couchbase Server 2.0

Promoting view between environments

3 replies [Last post]
  • Login or register to post comments
Mon, 09/24/2012 - 15:24
rahulaga
Offline
Joined: 09/06/2012
Groups: None

I wanted to find out what is the best practice/recommended way/tool to manage views across clusters.

For example I create a view in the admin tool in Dev and test it out. Then how do I export/import it to say Staging and then Production?

Any pointers would be much appreciated.

Top
  • Login or register to post comments
Wed, 10/10/2012 - 09:12
tgrall
Offline
Joined: 09/05/2012
Groups: None

Hello Rahulaga,

As far as I know this does not exist in Couchbase, but it should be easy to do it since you can retrieve and create Design View using simple REST call

You can find information about REST API here: http://www.couchbase.com/docs/couchbase-manual-2.0/couchbase-views-designdoc-api.html

So you can create a script or a program that uses this URL to get the view from one environment and push it into another one.

Let me know if you need more information.

Regards
Tug

__________________

Tug
@tgrall

Top
  • Login or register to post comments
Wed, 10/10/2012 - 09:36
tgrall
Offline
Joined: 09/05/2012
Groups: None

 

Here a small script that you can use as a starting point:

#!/bin/bash
content=$(curl -X GET -H 'Content-Type: application/json' $1)
curl -X PUT -H 'Content-Type: application/json' $2 -d "$content"

To execute it you can do

copy-view.sh "source" "destination"

For example:

./copy-view.sh "http://server1:8092/beer-sample/_design/beer" "http://server2:8092/new-bucket/_design/dev_beer"

I will encourage you to always put the destination in "developer" mode to test it before.

__________________

Tug
@tgrall

Top
  • Login or register to post comments
Wed, 10/10/2012 - 14:29
rahulaga
Offline
Joined: 09/06/2012
Groups: None

Thanks Tug. I've done something similar, and I'm actually maintaining the views as a JSON text file in the source control. I have a small program that loads those files and does a PUT on whichever couch URL I point it to. Seems to work so far, different developers on the team are also using it and can then work with source control and use the tool to sync up their local instances too.

Top
  • Login or register to post comments
  • Login or register to post comments
  • Login
  • Register

Company

  • About Us
  • Leadership
  • Customers
  • Partners
  • Contact Us

Product

  • Couchbase Server
  • Couchbase SDKs
  • Use Cases
  • Documentation
  • Forums

Open Source

  • Couchbase Project
  • Couchbase vs. CouchDB

Commercial

  • Subscriptions & Support
  • Training & Services

News

  • Blog
  • Newsletter
  • Press Releases
  • Buzz

Follow Us

    
  • Customer Login
  • Terms of Service
  • Privacy Policy
  • Trademark Policy
  • Site Map

© 2013 COUCHBASE All rights reserved.

Sign in to Couchbase Community

close
  • Create new account
  • Request new password
You are logging into the Forums, Wiki and Issue Tracker