couchdb: set single_node=true

to remove the need to check if the _users database was created
This commit is contained in:
maxlath
2025-02-27 00:17:20 +01:00
parent 80b8985198
commit 81181578fc
6 changed files with 10 additions and 33 deletions

View File

@@ -1,6 +0,0 @@
; CouchDB configuration file, named to have a lower priority than ./docker.ini
; See https://docs.couchdb.org/en/stable/config/index.html
[fabric]
; Prevent "No DB shards could be opened" errors, see https://github.com/apache/couchdb/issues/4497
shard_timeout_min_msec = 5000

View File

@@ -1,14 +1,5 @@
FROM couchdb:3.4.2
COPY docker-custom-entrypoint.sh /usr/local/bin/docker-custom-entrypoint.sh
COPY init_users_db.sh /usr/local/bin/init_users_db.sh
COPY local.ini /opt/couchdb/etc/local.d/local.ini
ENTRYPOINT ["tini", "--", "/usr/local/bin/docker-custom-entrypoint.sh"]
EXPOSE 5984
# Copied from the couchdb image Dockerfile
# https://github.com/apache/couchdb-docker/blob/734c61f/3.4.2/Dockerfile#L104
# as it would have been otherwise reset to an empty string
# See https://docs.docker.com/reference/dockerfile/#understand-how-cmd-and-entrypoint-interact
CMD ["/opt/couchdb/bin/couchdb"]
# Inherit ENTRYPOINT and CMD from couchdb image

View File

@@ -1,3 +0,0 @@
#!/bin/bash
/usr/local/bin/init_users_db.sh &
tini -- /docker-entrypoint.sh "$@"

View File

@@ -1,12 +0,0 @@
#!/bin/bash
while :; do {
echo "[init_users_db.sh] Waiting for CouchDB to be online to initialize the _users database"
curl http://localhost:5984 && {
echo "[init_users_db.sh] CouchDB is online! Trying to initialize _users database"
curl --user "$COUCHDB_USER:$COUCHDB_PASSWORD" -XPUT http://localhost:5984/_users
break
} || {
sleep 1
}
}; done

8
couchdb/local.ini Normal file
View File

@@ -0,0 +1,8 @@
[couchdb]
; Automatically create the system databases on startup (in particular `_users`)
; see https://docs.couchdb.org/en/stable/config/couchdb.html#couchdb/single_node
single_node = true
[fabric]
; Prevent "No DB shards could be opened" errors, see https://github.com/apache/couchdb/issues/4497
shard_timeout_min_msec = 5000

View File

@@ -22,7 +22,6 @@ services:
# - "5984:5984"
volumes:
- 'couchdb:/opt/couchdb/data'
- './configs:/opt/couchdb/etc/local.d'
tty: true
restart: unless-stopped
elasticsearch: