From couchdb-dev-return-277-apmail-incubator-couchdb-dev-archive=incubator.apache.org@incubator.apache.org Wed Apr 23 21:36:21 2008 Return-Path: Delivered-To: apmail-incubator-couchdb-dev-archive@locus.apache.org Received: (qmail 2126 invoked from network); 23 Apr 2008 21:36:21 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 23 Apr 2008 21:36:21 -0000 Received: (qmail 90265 invoked by uid 500); 23 Apr 2008 21:36:22 -0000 Delivered-To: apmail-incubator-couchdb-dev-archive@incubator.apache.org Received: (qmail 90238 invoked by uid 500); 23 Apr 2008 21:36:22 -0000 Mailing-List: contact couchdb-dev-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: couchdb-dev@incubator.apache.org Delivered-To: mailing list couchdb-dev@incubator.apache.org Received: (qmail 90227 invoked by uid 99); 23 Apr 2008 21:36:22 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 23 Apr 2008 14:36:22 -0700 X-ASF-Spam-Status: No, hits=2.7 required=10.0 tests=SPF_NEUTRAL,WEIRD_PORT X-Spam-Check-By: apache.org Received-SPF: neutral (athena.apache.org: local policy) Received: from [83.97.50.139] (HELO jan.prima.de) (83.97.50.139) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 23 Apr 2008 21:35:35 +0000 Received: from [192.168.1.33] (e179079014.adsl.alicedsl.de [::ffff:85.179.79.14]) (AUTH: LOGIN jan, SSL: TLSv1/SSLv3,128bits,AES128-SHA) by jan.prima.de with esmtp; Wed, 23 Apr 2008 21:35:44 +0000 Message-Id: <04DA14B5-0F98-4DED-9AB1-B1FEB50C62F7@apache.org> From: Jan Lehnardt To: couchdb-dev@incubator.apache.org Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Mime-Version: 1.0 (Apple Message framework v919.2) Subject: Runtime Configuration #1 Date: Wed, 23 Apr 2008 23:35:07 +0200 X-Mailer: Apple Mail (2.919.2) X-Virus-Checked: Checked by ClamAV on apache.org Dear devs. I made some progress in getting CouchDB to be configurable at runtime. And I like you to try it out and send in suggestions for improvements. The patches can be found here: http://pastie.textmate.org/private/evprkfb1jihq2c1fnrtm7w apply that to trunk and here: http://pastie.textmate.org/private/wmkxbcx7ua3l1vz76jwba put that into a file at src/couchdb/couch_config.erl then run ./bootstrap && ./configure && make && make install Note that I changed the couch.ini file and you better install CouchDB into a fresh directory. What does this do: There is a new module couch_config that handles storing and retrieving configuration from the other modules in CouchDB. On startup, it initializes itself with the values from couch.ini. It includes a simple HTTP API as well. It also moves code from couch_server_sup.erl to couch_config.erl, making the former a tad simpler. What it doesn't do: For a new configuration value to take effect, the module that uses it must be restarted. This does not yet happen. So effectively, you'd still have to restart CouchDB to change settings. This will, however, be implemented so true runtime configuration is possible. Another feature I plan on is committing changes back to the couch.ini file. In conclusion, this doesn't add any actual features at the moment, but lays the groundwork for a set of cool features that weren't possible otherwise. The patch aims to not change behaviour in CouchDB, save renaming some ini options. The only place I didn't succeed in getting to work as it did before is the dump of configuration variables on startup with a log level set to "debug", but that should be an easy enough fix. Damien suggested not starting a branch for this, but if you'd prefer, I'm happy to set one up and maintain it until the config work is mature enough for trunk. I open for any suggestions here from implementation to HTTP API, please be creative :) Enjoy! Jan -- PS: Here's a teaser: $ curl -X GET http://localhost:5984/_config/httpd/port {"ok":true,"module":"httpd","key":"port","value":"5984"} $ curl -X PUT http://localhost:5984/_config/httpd/port -d "5985" {"ok":true,"module":"httpd","key":"port","value":"5985"} $ curl -X GET http://localhost:5984/_config/httpd/port {"ok":true,"module":"httpd","key":"port","value":"5985"} $ curl -X DELETE http://localhost:5984/_config/httpd/port {"ok":true,"module":"httpd","key":"port","old_value":"5985"} $ curl -X GET http://localhost:5984/_config/httpd/port {"ok":true,"module":"httpd","key":"port","value":"no_value"} $ curl -X PUT http://localhost:5984/_config/httpd/port -d "5984" {"ok":true,"module":"httpd","key":"port","value":"5984"}