This is an automated email from the ASF dual-hosted git repository.

garren pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/couchdb-docker.git

commit 29ed69965ed616a9d0df9a6ffa081773d86c78bc
Author: Clemens Stolle <[email protected]>
AuthorDate: Mon May 9 19:54:09 2016 +0200

    improve admin-party detection (#53)
---
 1.6.1/docker-entrypoint.sh | 42 ++++++++++++++++++------------------------
 1 file changed, 18 insertions(+), 24 deletions(-)

diff --git a/1.6.1/docker-entrypoint.sh b/1.6.1/docker-entrypoint.sh
index 763d285..180d075 100755
--- a/1.6.1/docker-entrypoint.sh
+++ b/1.6.1/docker-entrypoint.sh
@@ -14,17 +14,30 @@
 set -e
 
 if [ "$1" = 'couchdb' ]; then
+       # we need to set the permissions here because docker mounts volumes as 
root
+       chown -R couchdb:couchdb \
+               /usr/local/var/lib/couchdb \
+               /usr/local/var/log/couchdb \
+               /usr/local/var/run/couchdb \
+               /usr/local/etc/couchdb
+
+       chmod -R 0770 \
+               /usr/local/var/lib/couchdb \
+               /usr/local/var/log/couchdb \
+               /usr/local/var/run/couchdb \
+               /usr/local/etc/couchdb
+
+       chmod 664 /usr/local/etc/couchdb/*.ini
+       chmod 775 /usr/local/etc/couchdb/*.d
 
        if [ "$COUCHDB_USER" ] && [ "$COUCHDB_PASSWORD" ]; then
                # Create admin
                printf "[admins]\n$COUCHDB_USER = $COUCHDB_PASSWORD\n" > 
/usr/local/etc/couchdb/local.d/docker.ini
+               chown couchdb:couchdb /usr/local/etc/couchdb/local.d/docker.ini
        fi
 
-       # Start CouchDB
-       couchdb -b > /dev/null 2>&1
-       while ! curl -s 127.0.0.1:5984 > /dev/null; do sleep 1; done
-
-       if [ "$(curl -s 127.0.0.1:5984/_config/admins)" == "{}" ]; then
+       # if we don't find an [admins] section followed by a non-comment, 
display a warning
+       if ! grep -Pzoqr '\[admins\]\n[^;]\w+' /usr/local/etc/couchdb; then
                # The - option suppresses leading tabs but *not* spaces. :)
                cat >&2 <<-'EOWARN'
                        ****************************************************
@@ -40,25 +53,6 @@ if [ "$1" = 'couchdb' ]; then
                EOWARN
        fi
 
-       # Stop CouchDB
-       couchdb -d > /dev/null 2>&1
-
-       # we need to set the permissions here because docker mounts volumes as 
root
-       chown -R couchdb:couchdb \
-               /usr/local/var/lib/couchdb \
-               /usr/local/var/log/couchdb \
-               /usr/local/var/run/couchdb \
-               /usr/local/etc/couchdb
-
-       chmod -R 0770 \
-               /usr/local/var/lib/couchdb \
-               /usr/local/var/log/couchdb \
-               /usr/local/var/run/couchdb \
-               /usr/local/etc/couchdb
-
-       chmod 664 /usr/local/etc/couchdb/*.ini
-       chmod 775 /usr/local/etc/couchdb/*.d
-
        exec gosu couchdb "$@"
 fi
 

-- 
To stop receiving notification emails like this one, please contact
"[email protected]" <[email protected]>.

Reply via email to