Allow multiple FoundationDB instances in the same process
This commit is contained in:
@@ -6,7 +6,7 @@ edition = "2024"
|
||||
[features]
|
||||
#default = ["sqlite", "postgres", "mysql", "rocks", "s3", "redis", "nats", "azure", "foundationdb"]
|
||||
#default = ["sqlite", "postgres", "mysql", "rocks", "s3", "redis", "foundationdb"]
|
||||
default = ["rocks", "s3"]
|
||||
default = ["rocks"]
|
||||
sqlite = ["store/sqlite", "directory/sqlite"]
|
||||
foundationdb = ["store/foundation", "common/foundation"]
|
||||
postgres = ["store/postgres", "directory/postgres"]
|
||||
|
||||
@@ -60,11 +60,18 @@ services:
|
||||
tmpfs:
|
||||
- /var/fdb/data
|
||||
- /var/fdb/logs
|
||||
healthcheck:
|
||||
test: [ "CMD-SHELL", "fdbcli --exec 'status' --timeout 3 >/dev/null 2>&1" ]
|
||||
interval: 2s
|
||||
timeout: 5s
|
||||
retries: 30
|
||||
start_period: 5s
|
||||
|
||||
fdb-init:
|
||||
image: foundationdb/foundationdb:7.4.6
|
||||
depends_on:
|
||||
- foundationdb
|
||||
foundationdb:
|
||||
condition: service_healthy
|
||||
volumes:
|
||||
- fdb-config:/var/fdb
|
||||
- ./scripts/init-fdb.sh:/init-fdb.sh:ro
|
||||
|
||||
@@ -1,7 +1,18 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
set -eu
|
||||
|
||||
fdbcli --exec "configure new single memory"
|
||||
echo "FoundationDB configured."
|
||||
exit 0
|
||||
for i in $(seq 1 30); do
|
||||
if fdbcli --exec 'status minimal' --timeout 5 2>&1 | grep -q "The database is available"; then
|
||||
echo "FoundationDB already configured."
|
||||
exit 0
|
||||
fi
|
||||
if fdbcli --exec 'configure new single memory' --timeout 5 2>&1 | grep -q "Database created"; then
|
||||
echo "FoundationDB configured."
|
||||
exit 0
|
||||
fi
|
||||
echo "Waiting for FoundationDB to be ready (attempt $i)..."
|
||||
sleep 2
|
||||
done
|
||||
|
||||
echo "ERROR: Failed to configure FoundationDB after retries" >&2
|
||||
exit 1
|
||||
|
||||
Reference in New Issue
Block a user