Skip to content

Commit 61e6cd1

Browse files
committed
Don't give up if we can't set config permissions
1 parent 7727325 commit 61e6cd1

File tree

2 files changed

+12
-8
lines changed

2 files changed

+12
-8
lines changed

2.2.0/docker-entrypoint.sh

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,14 @@ if [ "$1" = '/opt/couchdb/bin/couchdb' ]; then
3737
find /opt/couchdb/data -type d ! -perm 0755 -exec chmod 0755 '{}' +
3838
find /opt/couchdb/data -type f ! -perm 0644 -exec chmod 0644 '{}' +
3939

40-
# Do the same thing for configuration files and directories. Technically
40+
# Do something similar for configuration files and directories. Technically
4141
# CouchDB only needs read access to the configuration files as all online
4242
# changes will be applied to the "docker.ini" file below, but we set 644
43-
# for the sake of consistency
44-
find /opt/couchdb/etc -type d ! -perm 0755 -exec chmod 0755 '{}' +
45-
find /opt/couchdb/etc -type f ! -perm 0644 -exec chmod 0644 '{}' +
43+
# for the sake of consistency. We also add the `-f` flag because there may
44+
# be cases where some of the contents of etc/ are mounted read-only, and if
45+
# those files allow couchdb to read them we don't want to crash here ...
46+
find /opt/couchdb/etc -type d ! -perm 0755 -exec chmod -f 0755 '{}' +
47+
find /opt/couchdb/etc -type f ! -perm 0644 -exec chmod -f 0644 '{}' +
4648

4749
if [ ! -z "$NODENAME" ] && ! grep "couchdb@" /opt/couchdb/etc/vm.args; then
4850
echo "-name couchdb@$NODENAME" >> /opt/couchdb/etc/vm.args

dev/docker-entrypoint.sh

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,14 @@ if [ "$1" = '/opt/couchdb/bin/couchdb' ]; then
3737
find /opt/couchdb/data -type d ! -perm 0755 -exec chmod 0755 '{}' +
3838
find /opt/couchdb/data -type f ! -perm 0644 -exec chmod 0644 '{}' +
3939

40-
# Do the same thing for configuration files and directories. Technically
40+
# Do something similar for configuration files and directories. Technically
4141
# CouchDB only needs read access to the configuration files as all online
4242
# changes will be applied to the "docker.ini" file below, but we set 644
43-
# for the sake of consistency
44-
find /opt/couchdb/etc -type d ! -perm 0755 -exec chmod 0755 '{}' +
45-
find /opt/couchdb/etc -type f ! -perm 0644 -exec chmod 0644 '{}' +
43+
# for the sake of consistency. We also add the `-f` flag because there may
44+
# be cases where some of the contents of etc/ are mounted read-only, and if
45+
# those files allow couchdb to read them we don't want to crash here ...
46+
find /opt/couchdb/etc -type d ! -perm 0755 -exec chmod -f 0755 '{}' +
47+
find /opt/couchdb/etc -type f ! -perm 0644 -exec chmod -f 0644 '{}' +
4648

4749
if [ ! -z "$NODENAME" ] && ! grep "couchdb@" /opt/couchdb/etc/vm.args; then
4850
echo "-name couchdb@$NODENAME" >> /opt/couchdb/etc/vm.args

0 commit comments

Comments
 (0)