From 6cc2c265730f19e1c84eef565a1682a41f53c01a Mon Sep 17 00:00:00 2001 From: "CanbiZ (MickLesk)" <47820557+MickLesk@users.noreply.github.com> Date: Sat, 21 Mar 2026 21:13:32 +0100 Subject: [PATCH] Anytype-server: wait for MongoDB readiness before rs.initiate() (#13165) --- install/anytype-server-install.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/install/anytype-server-install.sh b/install/anytype-server-install.sh index 9070c2a34..c7d3dd023 100644 --- a/install/anytype-server-install.sh +++ b/install/anytype-server-install.sh @@ -22,7 +22,12 @@ replication: replSetName: "rs0" EOF systemctl restart mongod -sleep 3 +for i in $(seq 1 30); do + if mongosh --quiet --eval "db.adminCommand('ping')" &>/dev/null; then + break + fi + sleep 2 +done $STD mongosh --eval 'rs.initiate({_id: "rs0", members: [{_id: 0, host: "127.0.0.1:27017"}]})' msg_ok "Configured MongoDB Replica Set"