summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvarac <varacanero@zeromail.org>2013-03-12 14:33:24 +0100
committervarac <varacanero@zeromail.org>2013-03-12 14:33:24 +0100
commit3633f137c99a4fcb647cb098ee01704ff3f7554c (patch)
tree7e7a2334149f12f42725b4d9a549034a18142b8b
parent0ffc583488ee044be30ea5bf7fae751505419a9b (diff)
parent01941d905a71a2088ec080703f4e5430dec7a2ec (diff)
Merge branch 'feature/bigcouch' into develop
Conflicts: provider_base/services/couchdb.json
-rw-r--r--provider_base/services/couchdb.json3
-rw-r--r--puppet/manifests/site.pp4
-rw-r--r--puppet/modules/site_apt/manifests/dist_upgrade.pp1
-rwxr-xr-xpuppet/modules/site_couchdb/files/couchdb160
-rw-r--r--puppet/modules/site_couchdb/files/local.ini4
-rw-r--r--puppet/modules/site_couchdb/manifests/configure.pp27
-rw-r--r--puppet/modules/site_couchdb/manifests/init.pp20
7 files changed, 20 insertions, 199 deletions
diff --git a/provider_base/services/couchdb.json b/provider_base/services/couchdb.json
index ac84eeb2..c3502c6b 100644
--- a/provider_base/services/couchdb.json
+++ b/provider_base/services/couchdb.json
@@ -5,6 +5,9 @@
},
"couch": {
"port": 5984,
+ "bigcouch": {
+ "cookie": "= secret :bigcouch_cookie"
+ },
"users": {
"admin": {
"username": "admin",
diff --git a/puppet/manifests/site.pp b/puppet/manifests/site.pp
index 8cfa92ef..f55e6925 100644
--- a/puppet/manifests/site.pp
+++ b/puppet/manifests/site.pp
@@ -21,7 +21,9 @@ if 'openvpn' in $services {
}
if 'couchdb' in $services {
- include site_couchdb
+ class {'site_couchdb':
+ bigcouch => true
+ }
}
if 'webapp' in $services {
diff --git a/puppet/modules/site_apt/manifests/dist_upgrade.pp b/puppet/modules/site_apt/manifests/dist_upgrade.pp
index 91301efd..08de31bb 100644
--- a/puppet/modules/site_apt/manifests/dist_upgrade.pp
+++ b/puppet/modules/site_apt/manifests/dist_upgrade.pp
@@ -6,6 +6,7 @@ class site_apt::dist_upgrade {
exec{'initial_apt_update':
command => '/usr/bin/apt-get update',
refreshonly => false,
+ timeout => 360,
}
exec{'initial_apt_dist_upgrade':
command => "/usr/bin/apt-get -q -y -o 'DPkg::Options::=--force-confold' dist-upgrade",
diff --git a/puppet/modules/site_couchdb/files/couchdb b/puppet/modules/site_couchdb/files/couchdb
deleted file mode 100755
index ccdfe716..00000000
--- a/puppet/modules/site_couchdb/files/couchdb
+++ /dev/null
@@ -1,160 +0,0 @@
-#!/bin/sh -e
-
-# Licensed under the Apache License, Version 2.0 (the "License"); you may not
-# use this file except in compliance with the License. You may obtain a copy of
-# the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations under
-# the License.
-
-### BEGIN INIT INFO
-# Provides: couchdb
-# Required-Start: $local_fs $remote_fs
-# Required-Stop: $local_fs $remote_fs
-# Default-Start: 2 3 4 5
-# Default-Stop: 0 1 6
-# Short-Description: Apache CouchDB init script
-# Description: Apache CouchDB init script for the database server.
-### END INIT INFO
-
-SCRIPT_OK=0
-SCRIPT_ERROR=1
-
-DESCRIPTION="database server"
-NAME=couchdb
-SCRIPT_NAME=`basename $0`
-COUCHDB=/usr/bin/couchdb
-CONFIGURATION_FILE=/etc/default/couchdb
-RUN_DIR=/var/run/couchdb
-LSB_LIBRARY=/lib/lsb/init-functions
-
-if test ! -x $COUCHDB; then
- exit $SCRIPT_ERROR
-fi
-
-if test -r $CONFIGURATION_FILE; then
- . $CONFIGURATION_FILE
-fi
-
-log_daemon_msg () {
- # Dummy function to be replaced by LSB library.
-
- echo $@
-}
-
-log_end_msg () {
- # Dummy function to be replaced by LSB library.
-
- if test "$1" != "0"; then
- echo "Error with $DESCRIPTION: $NAME"
- fi
- return $1
-}
-
-if test -r $LSB_LIBRARY; then
- . $LSB_LIBRARY
-fi
-
-run_command () {
- command="$1"
- if test -n "$COUCHDB_OPTIONS"; then
- command="$command $COUCHDB_OPTIONS"
- fi
- if test -n "$COUCHDB_USER"; then
- if su $COUCHDB_USER -c "$command"; then
- return $SCRIPT_OK
- else
- return $SCRIPT_ERROR
- fi
- else
- if $command; then
- return $SCRIPT_OK
- else
- return $SCRIPT_ERROR
- fi
- fi
-}
-
-start_couchdb () {
- # Start Apache CouchDB as a background process.
-
- mkdir -p "$RUN_DIR"
- chown -R "$COUCHDB_USER" "$RUN_DIR"
- command="$COUCHDB -b"
- if test -n "$COUCHDB_STDOUT_FILE"; then
- command="$command -o $COUCHDB_STDOUT_FILE"
- fi
- if test -n "$COUCHDB_STDERR_FILE"; then
- command="$command -e $COUCHDB_STDERR_FILE"
- fi
- if test -n "$COUCHDB_RESPAWN_TIMEOUT"; then
- command="$command -r $COUCHDB_RESPAWN_TIMEOUT"
- fi
- run_command "$command" > /dev/null
-}
-
-stop_couchdb () {
- # Stop the running Apache CouchDB process.
-
- run_command "$COUCHDB -d" > /dev/null
- pkill -u couchdb
- # always return true even if no remaining couchdb procs got killed
- /bin/true
-}
-
-display_status () {
- # Display the status of the running Apache CouchDB process.
-
- run_command "$COUCHDB -s"
-}
-
-parse_script_option_list () {
- # Parse arguments passed to the script and take appropriate action.
-
- case "$1" in
- start)
- log_daemon_msg "Starting $DESCRIPTION" $NAME
- if start_couchdb; then
- log_end_msg $SCRIPT_OK
- else
- log_end_msg $SCRIPT_ERROR
- fi
- ;;
- stop)
- log_daemon_msg "Stopping $DESCRIPTION" $NAME
- if stop_couchdb; then
- log_end_msg $SCRIPT_OK
- else
- log_end_msg $SCRIPT_ERROR
- fi
- ;;
- restart|force-reload)
- log_daemon_msg "Restarting $DESCRIPTION" $NAME
- if stop_couchdb; then
- if start_couchdb; then
- log_end_msg $SCRIPT_OK
- else
- log_end_msg $SCRIPT_ERROR
- fi
- else
- log_end_msg $SCRIPT_ERROR
- fi
- ;;
- status)
- display_status
- ;;
- *)
- cat << EOF >&2
-Usage: $SCRIPT_NAME {start|stop|restart|force-reload|status}
-EOF
- exit $SCRIPT_ERROR
- ;;
- esac
-}
-
-parse_script_option_list $@
diff --git a/puppet/modules/site_couchdb/files/local.ini b/puppet/modules/site_couchdb/files/local.ini
index b3376cbb..22aa0177 100644
--- a/puppet/modules/site_couchdb/files/local.ini
+++ b/puppet/modules/site_couchdb/files/local.ini
@@ -28,8 +28,10 @@
[httpd_global_handlers]
;_google = {couch_httpd_proxy, handle_proxy_req, <<"http://www.google.com">>}
+# futon is enabled by default on bigcouch in default.ini
+# we need to find another way to disable futon, it won't work disabling it here
# enable futon
-_utils = {couch_httpd_misc_handlers, handle_utils_dir_req, "/usr/share/couchdb/www"}
+#_utils = {couch_httpd_misc_handlers, handle_utils_dir_req, "/usr/share/couchdb/www"}
# disable futon
#_utils = {couch_httpd_misc_handlers, handle_welcome_req, <<"Welcome, Futon is disabled!">>}
diff --git a/puppet/modules/site_couchdb/manifests/configure.pp b/puppet/modules/site_couchdb/manifests/configure.pp
deleted file mode 100644
index 333511b5..00000000
--- a/puppet/modules/site_couchdb/manifests/configure.pp
+++ /dev/null
@@ -1,27 +0,0 @@
-class site_couchdb::configure {
-
- file { '/etc/init.d/couchdb':
- source => 'puppet:///modules/site_couchdb/couchdb',
- mode => '0755',
- owner => 'root',
- group => 'root',
- }
-
- file { '/etc/couchdb/local.d/admin.ini':
- content => "[admins]
-admin = $site_couchdb::couchdb_admin_pw
-",
- mode => '0600',
- owner => 'couchdb',
- group => 'couchdb',
- notify => Service[couchdb]
- }
-
-
- exec { '/etc/init.d/couchdb restart; sleep 6':
- path => ['/bin', '/usr/bin',],
- subscribe => File['/etc/couchdb/local.d/admin.ini',
- '/etc/couchdb/local.ini'],
- refreshonly => true
- }
-}
diff --git a/puppet/modules/site_couchdb/manifests/init.pp b/puppet/modules/site_couchdb/manifests/init.pp
index 9ecde5e6..419e4122 100644
--- a/puppet/modules/site_couchdb/manifests/init.pp
+++ b/puppet/modules/site_couchdb/manifests/init.pp
@@ -1,6 +1,5 @@
-class site_couchdb {
+class site_couchdb ( $bigcouch = false ) {
tag 'leap_service'
- include couchdb
$x509 = hiera('x509')
$key = $x509['key']
@@ -16,21 +15,22 @@ class site_couchdb {
$couchdb_ca_daemon = $couchdb_users['ca_daemon']
$couchdb_ca_daemon_user = $couchdb_ca_daemon['username']
$couchdb_ca_daemon_pw = $couchdb_ca_daemon['password']
+ $bigcouch_config = $couchdb_config['bigcouch']
+ $bigcouch_cookie = $bigcouch_config['cookie']
- Package ['couchdb']
- -> File['/etc/init.d/couchdb']
- -> File['/etc/couchdb/local.ini']
- -> File['/etc/couchdb/local.d/admin.ini']
- -> File['/etc/couchdb/couchdb.netrc']
+ class {'couchdb':
+ bigcouch => $bigcouch,
+ admin_pw => $couchdb_admin_pw,
+ bigcouch_cookie => $bigcouch_cookie
+ }
+
+ Service ['couchdb']
-> Couchdb::Create_db['users']
-> Couchdb::Create_db['client_certificates']
-> Couchdb::Add_user[$couchdb_webapp_user]
-> Couchdb::Add_user[$couchdb_ca_daemon_user]
-> Site_couchdb::Apache_ssl_proxy['apache_ssl_proxy']
- include site_couchdb::configure
- include couchdb::deploy_config
-
site_couchdb::apache_ssl_proxy { 'apache_ssl_proxy':
key => $key,
cert => $cert