From ecca5eb2307cc29ff155cd49cc9ed3cb89b8fd47 Mon Sep 17 00:00:00 2001 From: jhowarth Date: Tue, 17 Jul 2012 12:08:48 -0700 Subject: [PATCH] Allow users to specify bind address. --- .gitignore | 1 + attributes/default.rb | 7 +++-- recipes/default.rb | 10 +++++++ templates/default/local.ini.erb | 49 +++++++++++++++++++++++++++++++++ 4 files changed, 64 insertions(+), 3 deletions(-) create mode 100644 .gitignore create mode 100644 templates/default/local.ini.erb diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..dbec55f --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +*.sw[op] diff --git a/attributes/default.rb b/attributes/default.rb index 4e7d915..196c670 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -17,6 +17,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -set['couch_db']['src_checksum'] = "6ef82a7ba0f132d55af7cc78b30658d5b3a4f7be3f449308c8d7fa2ad473677c" -set['couch_db']['src_version'] = "1.0.2" -set['couch_db']['src_mirror'] = "http://archive.apache.org/dist/couchdb/#{node['couch_db']['src_version']}/apache-couchdb-#{node['couch_db']['src_version']}.tar.gz" +set['couch_db']['src_checksum'] = "6ef82a7ba0f132d55af7cc78b30658d5b3a4f7be3f449308c8d7fa2ad473677c" +set['couch_db']['src_version'] = "1.0.2" +set['couch_db']['src_mirror'] = "http://archive.apache.org/dist/couchdb/#{node['couch_db']['src_version']}/apache-couchdb-#{node['couch_db']['src_version']}.tar.gz" +default['couch_db']['bind_address'] = nil diff --git a/recipes/default.rb b/recipes/default.rb index c69c0bb..85f6001 100644 --- a/recipes/default.rb +++ b/recipes/default.rb @@ -42,6 +42,16 @@ ) end +template "/etc/couchdb/local.ini" do + source "local.ini.erb" + owner "couchdb" + group "couchdb" + mode 0664 + variables( + :bind_address => node['couch_db']['bind_address'] + ) +end + directory "/var/lib/couchdb" do owner "couchdb" group "couchdb" diff --git a/templates/default/local.ini.erb b/templates/default/local.ini.erb new file mode 100644 index 0000000..2d06d15 --- /dev/null +++ b/templates/default/local.ini.erb @@ -0,0 +1,49 @@ +; 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 + +[httpd] +;port = 5984 +<% if @bind_address %> +bind_address = <%= @bind_address %> +<% else %> +;bind_address = 127.0.0.1 +<% end %> +; Uncomment next line to trigger basic-auth popup on unauthorized requests. +;WWW-Authenticate = Basic realm="administrator" + +[couch_httpd_auth] +; If you set this to true, you should also uncomment the WWW-Authenticate line +; above. If you don't configure a WWW-Authenticate header, CouchDB will send +; Basic realm="server" in order to prevent you getting logged out. +; require_valid_user = false + +[log] +;level = debug + + +; To enable Virtual Hosts in CouchDB, add a vhost = path directive. All requests to +; the Virual Host will be redirected to the path. In the example below all requests +; to http://example.com/ are redirected to /database. +; If you run CouchDB on a specific port, include the port number in the vhost: +; example.com:5984 = /database + +[vhosts] +;example.com = /database/ + +[update_notification] +;unique notifier name=/full/path/to/exe -with "cmd line arg" + +; To create an admin account uncomment the '[admins]' section below and add a +; line in the format 'username = password'. When you next start CouchDB, it +; will change the password to a hash (so that your passwords don't linger +; around in plain-text files). You can add more admin accounts with more +; 'username = password' lines. Don't forget to restart CouchDB after +; changing this. +[admins] +;admin = mysecretpassword