You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@couchdb.apache.org by Heather Airoldi <He...@gordon.edu> on 2012/04/18 18:00:24 UTC

Running a dev instance of Couch

Hi,

I have an instance of CouchDB running on my server and I am running a CouchApp on it.  I would like to set up a second instance of Couch to run on the server so that we can push development code to that instance without affecting the production environment.  What is the best way to do this?  I was thinking of just installing another instance of couch on the server and configure it to run on a different port, but I'm not sure how to go about doing that or how I can then start and stop each instance.  How are other people handling pushing development code?

Thanks,
Heather

Re: Running a dev instance of Couch

Posted by Dave Cottlehuber <da...@muse.net.nz>.
On 19 April 2012 21:55, Jim Klo <ji...@sri.com> wrote:
> maybe a cooky question but related, is it possible to specify any of this
> config in the local.ini on the command line?

Sorry Jim,

Not yet, but create a ticket & I'll look at doing it in line with what
was proposed at CouchDB summit.

A+
Dave

Re: Running a dev instance of Couch

Posted by Jim Klo <ji...@sri.com>.
maybe a cooky question but related, is it possible to specify any of this config in the local.ini on the command line?

I was going to setup some CI in Jenkins, and to allow concurrent tests to run, it would be nice to just specify some of this dynamically on the fly? Otherwise I can just build out the same number of configs as queues.

- Jim

Jim Klo
Senior Software Engineer
Center for Software Engineering
SRI International

On Apr 19, 2012, at 12:41 PM, Dave Cottlehuber wrote:

> On 19 April 2012 20:57, Heather Airoldi <He...@gordon.edu> wrote:
>> Thanks for the instructions Dave.  I followed your method on the Wiki, but unfortunately it does not seem to be working for me.  running the "couchdb -i -a /tmp/couchdb/etc/couchdb/local.ini" command after following the instructions says that Apache CouchDB is running, but when I try to access localhost:5985 it can't connect.  Any idea what I did wrong?  Here is my new /tmp/couchdb/etc/couchdb/local.ini file:
>> 
>> ; CouchDB Configuration Settings
>> 
>> ; Custom settings should be made in this file. They will override settings
>> ; in default.ini, but unlike changes made to default.ini, this file won't be
>> ; overwritten on server upgrade.
>> 
>> [couchdb]
>> ;max_document_size = 4294967296 ; bytes
>> database_dir = /tmp/couchdb/var/lib/couchdb
>> view_index_dir = /tmp/couchdb/var/lib/couchdb
>> uri_file = /tmp/couchdb/var/run/couchdb/couch.uri
>> 
>> [httpd]
>> port = 5985
>> bind_address = 0.0.0.0
>> ; Options for the MochiWeb HTTP server.
>> ;server_options = [{backlog, 128}, {acceptor_pool_size, 16}]
>> ; For more socket options, consult Erlang's module 'inet' man page.
>> ;socket_options = [{recbuf, 262144}, {sndbuf, 262144}, {nodelay, true}]
>> 
>> ; Uncomment next line to trigger basic-auth popup on unauthorized requests.
>> ;WWW-Authenticate = Basic realm="administrator"
>> 
>> ; Uncomment next line to set the configuration modification whitelist. Only
>> ; whitelisted values may be changed via the /_config URLs. To allow the admin
>> ; to change this value over HTTP, remember to include {httpd,config_whitelist}
>> ; itself. Excluding it from the list would require editing this file to update
>> ; the whitelist.
>> ;config_whitelist = [{httpd,config_whitelist}, {log,level}, {etc,etc}]
>> 
>> [httpd_global_handlers]
>> ;_google = {couch_httpd_proxy, handle_proxy_req, <<"http://www.google.com">>}
>> "/tmp/couchdb/etc/couchdb/local.ini" 81L, 320
>> 
>> Thanks,
>> Heather
>> ________________________________________
>> From: Dave Cottlehuber [dave@muse.net.nz]
>> Sent: Thursday, April 19, 2012 5:35 AM
>> To: user@couchdb.apache.org
>> Subject: Re: Running a dev instance of Couch
>> 
>> On 19 April 2012 10:46, Dave Cottlehuber <da...@muse.net.nz> wrote:
>>> mkdir -p $NEW/var/{lib,etc,run}/couchdb/
>>> [additional embarrassing errors omitted]
>> 
>> Typically I flubbed the cut-n-paste, a corrected version is on the
>> wiki so that future foobars will not be recorded in mailing list
>> perpetuity for my eternal shame.
>> 
>> http://wiki.apache.org/couchdb/Additional_Instances
> 
> Do you have the [log] section too?
> 
> [log]
> file = /tmp/couchdb/var/log/couchdb/couch.log
> 
> If you do IRC, pop on & ping me @dch if this isn't working still.
> 
> A+
> Dave


Re: Running a dev instance of Couch

Posted by Dave Cottlehuber <da...@muse.net.nz>.
On 19 April 2012 20:57, Heather Airoldi <He...@gordon.edu> wrote:
> Thanks for the instructions Dave.  I followed your method on the Wiki, but unfortunately it does not seem to be working for me.  running the "couchdb -i -a /tmp/couchdb/etc/couchdb/local.ini" command after following the instructions says that Apache CouchDB is running, but when I try to access localhost:5985 it can't connect.  Any idea what I did wrong?  Here is my new /tmp/couchdb/etc/couchdb/local.ini file:
>
> ; CouchDB Configuration Settings
>
> ; Custom settings should be made in this file. They will override settings
> ; in default.ini, but unlike changes made to default.ini, this file won't be
> ; overwritten on server upgrade.
>
> [couchdb]
> ;max_document_size = 4294967296 ; bytes
> database_dir = /tmp/couchdb/var/lib/couchdb
> view_index_dir = /tmp/couchdb/var/lib/couchdb
> uri_file = /tmp/couchdb/var/run/couchdb/couch.uri
>
> [httpd]
> port = 5985
> bind_address = 0.0.0.0
> ; Options for the MochiWeb HTTP server.
> ;server_options = [{backlog, 128}, {acceptor_pool_size, 16}]
> ; For more socket options, consult Erlang's module 'inet' man page.
> ;socket_options = [{recbuf, 262144}, {sndbuf, 262144}, {nodelay, true}]
>
> ; Uncomment next line to trigger basic-auth popup on unauthorized requests.
> ;WWW-Authenticate = Basic realm="administrator"
>
> ; Uncomment next line to set the configuration modification whitelist. Only
> ; whitelisted values may be changed via the /_config URLs. To allow the admin
> ; to change this value over HTTP, remember to include {httpd,config_whitelist}
> ; itself. Excluding it from the list would require editing this file to update
> ; the whitelist.
> ;config_whitelist = [{httpd,config_whitelist}, {log,level}, {etc,etc}]
>
> [httpd_global_handlers]
> ;_google = {couch_httpd_proxy, handle_proxy_req, <<"http://www.google.com">>}
> "/tmp/couchdb/etc/couchdb/local.ini" 81L, 320
>
> Thanks,
> Heather
> ________________________________________
> From: Dave Cottlehuber [dave@muse.net.nz]
> Sent: Thursday, April 19, 2012 5:35 AM
> To: user@couchdb.apache.org
> Subject: Re: Running a dev instance of Couch
>
> On 19 April 2012 10:46, Dave Cottlehuber <da...@muse.net.nz> wrote:
>> mkdir -p $NEW/var/{lib,etc,run}/couchdb/
>> [additional embarrassing errors omitted]
>
> Typically I flubbed the cut-n-paste, a corrected version is on the
> wiki so that future foobars will not be recorded in mailing list
> perpetuity for my eternal shame.
>
> http://wiki.apache.org/couchdb/Additional_Instances

Do you have the [log] section too?

[log]
file = /tmp/couchdb/var/log/couchdb/couch.log

If you do IRC, pop on & ping me @dch if this isn't working still.

A+
Dave

RE: Running a dev instance of Couch

Posted by Heather Airoldi <He...@gordon.edu>.
Thanks for the instructions Dave.  I followed your method on the Wiki, but unfortunately it does not seem to be working for me.  running the "couchdb -i -a /tmp/couchdb/etc/couchdb/local.ini" command after following the instructions says that Apache CouchDB is running, but when I try to access localhost:5985 it can't connect.  Any idea what I did wrong?  Here is my new /tmp/couchdb/etc/couchdb/local.ini file:

; CouchDB Configuration Settings

; Custom settings should be made in this file. They will override settings
; in default.ini, but unlike changes made to default.ini, this file won't be
; overwritten on server upgrade.

[couchdb]
;max_document_size = 4294967296 ; bytes
database_dir = /tmp/couchdb/var/lib/couchdb
view_index_dir = /tmp/couchdb/var/lib/couchdb
uri_file = /tmp/couchdb/var/run/couchdb/couch.uri

[httpd]
port = 5985
bind_address = 0.0.0.0
; Options for the MochiWeb HTTP server.
;server_options = [{backlog, 128}, {acceptor_pool_size, 16}]
; For more socket options, consult Erlang's module 'inet' man page.
;socket_options = [{recbuf, 262144}, {sndbuf, 262144}, {nodelay, true}]

; Uncomment next line to trigger basic-auth popup on unauthorized requests.
;WWW-Authenticate = Basic realm="administrator"

; Uncomment next line to set the configuration modification whitelist. Only
; whitelisted values may be changed via the /_config URLs. To allow the admin
; to change this value over HTTP, remember to include {httpd,config_whitelist}
; itself. Excluding it from the list would require editing this file to update
; the whitelist.
;config_whitelist = [{httpd,config_whitelist}, {log,level}, {etc,etc}]

[httpd_global_handlers]
;_google = {couch_httpd_proxy, handle_proxy_req, <<"http://www.google.com">>}
"/tmp/couchdb/etc/couchdb/local.ini" 81L, 320

Thanks,
Heather
________________________________________
From: Dave Cottlehuber [dave@muse.net.nz]
Sent: Thursday, April 19, 2012 5:35 AM
To: user@couchdb.apache.org
Subject: Re: Running a dev instance of Couch

On 19 April 2012 10:46, Dave Cottlehuber <da...@muse.net.nz> wrote:
> mkdir -p $NEW/var/{lib,etc,run}/couchdb/
> [additional embarrassing errors omitted]

Typically I flubbed the cut-n-paste, a corrected version is on the
wiki so that future foobars will not be recorded in mailing list
perpetuity for my eternal shame.

http://wiki.apache.org/couchdb/Additional_Instances

A+
Dave



Re: Running a dev instance of Couch

Posted by Dave Cottlehuber <da...@muse.net.nz>.
On 19 April 2012 10:46, Dave Cottlehuber <da...@muse.net.nz> wrote:
> mkdir -p $NEW/var/{lib,etc,run}/couchdb/
> [additional embarrassing errors omitted]

Typically I flubbed the cut-n-paste, a corrected version is on the
wiki so that future foobars will not be recorded in mailing list
perpetuity for my eternal shame.

http://wiki.apache.org/couchdb/Additional_Instances

A+
Dave

Re: Running a dev instance of Couch

Posted by Dave Cottlehuber <da...@muse.net.nz>.
On 18 April 2012 19:10, Heather Airoldi <He...@gordon.edu> wrote:
> Running locally is what we had currently been doing for testing.  However, we felt the need to be able to test on our actual server since the configuration (SSL, etc.) and performance are quite different there than on my local machine.
>
>  I think the best option will be Dave's suggestion to install a second instance with a modified ./configure.  A second DB on the same instance may also work but the challenge is that we are creating new databases frequently, and our CouchApp has a page for users to select which database to load data from but we don't want databases we create while testing to show up there.  There are ways to exclude those databases from the list, but I thought it might be cleaner to have all test data and code in a separate space.
>
> I think I'll look into the ./configure options and see how much code I'd need to change to run everything in "dev" mode on a second instance.  Duplicating the server is not an option unfortunately.
>
> Thanks for your input everyone.
>
> -Heather
> ________________________________________
> From: Robert Newson [rnewson@apache.org]
> Sent: Wednesday, April 18, 2012 12:50 PM
> To: user@couchdb.apache.org
> Subject: Re: Running a dev instance of Couch
>
> Why not run locally? I always 'make dev && ./utils/run' on my machine.
>
> B.
>
> On 18 April 2012 17:33, Mark Hahn <ma...@hahnca.com> wrote:
>> I recommend that you duplicate the server.  On amazon that takes only
>> minutes.  Then release is a simple rcp command.
>>
>> This is the simplest and safest solution.
>
>

Hi Heather,

Actually you don't even need to run configure again, couch can share
the same binaries. I had this in the back of my mind but it didn't
make it to the keyboard before send. As penance here's a full recipe:

# adapt as reqd
$OLD=/usr/local/couchdb
$NEW=/tmp/couchdb

# chown as reqd for additional user, couch needs r/w to all of the following:
mkdir -p $NEW/etc/couchdb/
mkdir -p $NEW/var/{lib,etc,run}/couchdb/

cp $OLD/etc/couchdb/local.ini $NEW

The layout will look like this:
/tmp/couchdb
├── /tmp/couchdb/etc
│   └── /tmp/couchdb/etc/couchdb
│       └── /tmp/couchdb/etc/couchdb/local.ini
└── /tmp/couchdb/var
    ├── /tmp/couchdb/var/lib
    │   └── /tmp/couchdb/var/lib/couchdb
    ├── /tmp/couchdb/var/log
    │   └── /tmp/couchdb/var/log/couchdb
    └── /tmp/couchdb/var/run
        └── /tmp/couchdb/var/run/couchdb

You then need to adapt the local.ini file to use these, and obviously
a different port/bind_address combo. I used:

[couchdb]
database_dir = /tmp/couchdb/var/lib/couchdb
view_index_dir = /tmp/couchdb/var/lib/couchdb
uri_file = /tmp/var/couchdb/run/couchdb/couch.uri

[httpd]
port = 5985
bind_address = 0.0.0.0

[log]
file = /tmp/couchdb/var/log/couchdb/couch.log

Finally, run couchdb (in my case interactively using -i):

couchdb -i -a /tmp/couchdb/etc/couchdb/local.ini

& you're done.

Caveat, if you've got admins created then don't forget to prune them
in the duplicated local.ini if needed.

A+
Dave

RE: Running a dev instance of Couch

Posted by Heather Airoldi <He...@gordon.edu>.
Running locally is what we had currently been doing for testing.  However, we felt the need to be able to test on our actual server since the configuration (SSL, etc.) and performance are quite different there than on my local machine. 

 I think the best option will be Dave's suggestion to install a second instance with a modified ./configure.  A second DB on the same instance may also work but the challenge is that we are creating new databases frequently, and our CouchApp has a page for users to select which database to load data from but we don't want databases we create while testing to show up there.  There are ways to exclude those databases from the list, but I thought it might be cleaner to have all test data and code in a separate space.

I think I'll look into the ./configure options and see how much code I'd need to change to run everything in "dev" mode on a second instance.  Duplicating the server is not an option unfortunately.

Thanks for your input everyone.

-Heather
________________________________________
From: Robert Newson [rnewson@apache.org]
Sent: Wednesday, April 18, 2012 12:50 PM
To: user@couchdb.apache.org
Subject: Re: Running a dev instance of Couch

Why not run locally? I always 'make dev && ./utils/run' on my machine.

B.

On 18 April 2012 17:33, Mark Hahn <ma...@hahnca.com> wrote:
> I recommend that you duplicate the server.  On amazon that takes only
> minutes.  Then release is a simple rcp command.
>
> This is the simplest and safest solution.



Re: Running a dev instance of Couch

Posted by Mark Hahn <ma...@hahnca.com>.
>   segregated hosts will reduce the the wallet

Not on amazon.  I run a big instance for production and a cheap instance
for dev.

I would not develop on a production machine because of bugs hurting
performance of production or even shutting it down.  Maybe my dev builds
are buggier than most.  :-)

Re: Running a dev instance of Couch

Posted by Robert Newson <rn...@apache.org>.
Why not run locally? I always 'make dev && ./utils/run' on my machine.

B.

On 18 April 2012 17:33, Mark Hahn <ma...@hahnca.com> wrote:
> I recommend that you duplicate the server.  On amazon that takes only
> minutes.  Then release is a simple rcp command.
>
> This is the simplest and safest solution.

Re: Running a dev instance of Couch

Posted by Dave Cottlehuber <da...@muse.net.nz>.
On 18 April 2012 18:33, Mark Hahn <ma...@hahnca.com> wrote:
> I recommend that you duplicate the server.  On amazon that takes only
> minutes.  Then release is a simple rcp command.
>
> This is the simplest and safest solution.

Depending on what impact you are trying to avoid, and how big your
current app is, you might just need a second DB on the same instance.
You should not often need to restart couch.

Next stage would be a 2nd instance on the same server (quickest
approach is likely to either build from source with a modified
./configure --....). Unless you're already running into IO limits
while building views or under load this is likely sufficient.

Finally as Mark suggests segregated hosts will reduce the the wallet
as fast as it will avoid cross-couch performance issues. But you will
have the LAN in between your instances then.

A+
Dave

Re: Running a dev instance of Couch

Posted by Mark Hahn <ma...@hahnca.com>.
I recommend that you duplicate the server.  On amazon that takes only
minutes.  Then release is a simple rcp command.

This is the simplest and safest solution.