genbox 1.0.68 → 1.0.69
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/db-utils.js +3 -16
- package/package.json +1 -1
package/dist/db-utils.js
CHANGED
|
@@ -286,7 +286,8 @@ async function runRemoteMongoRestoreDynamic(ipAddress, options = {}) {
|
|
|
286
286
|
return new Promise((resolve) => {
|
|
287
287
|
options.onProgress?.('Detecting MongoDB and restoring database...');
|
|
288
288
|
// The restore command - detects MongoDB port dynamically
|
|
289
|
-
// Note: Uses sed
|
|
289
|
+
// Note: Uses sed instead of grep -P for portability (grep -P not available on Alpine)
|
|
290
|
+
// Note: Skips mongosh check since it's not installed on genboxes - mongorestore will fail if DB not ready
|
|
290
291
|
const restoreCmd = `
|
|
291
292
|
set -e
|
|
292
293
|
|
|
@@ -304,23 +305,9 @@ fi
|
|
|
304
305
|
|
|
305
306
|
echo "MongoDB detected on port: $MONGO_PORT"
|
|
306
307
|
|
|
307
|
-
# Wait for MongoDB to be responsive
|
|
308
|
-
for i in $(seq 1 30); do
|
|
309
|
-
if mongosh --quiet --host localhost --port $MONGO_PORT --eval "db.runCommand({ping:1})" 2>/dev/null; then
|
|
310
|
-
echo "MongoDB is ready"
|
|
311
|
-
break
|
|
312
|
-
fi
|
|
313
|
-
if [ $i -eq 30 ]; then
|
|
314
|
-
echo "ERROR: MongoDB not responding after 30 attempts"
|
|
315
|
-
exit 1
|
|
316
|
-
fi
|
|
317
|
-
echo "Waiting for MongoDB... ($i/30)"
|
|
318
|
-
sleep 2
|
|
319
|
-
done
|
|
320
|
-
|
|
321
308
|
# Restore the database from the uploaded dump
|
|
322
309
|
if [ -f /home/dev/.db-dump.gz ]; then
|
|
323
|
-
echo "Restoring database..."
|
|
310
|
+
echo "Restoring database to localhost:$MONGO_PORT..."
|
|
324
311
|
# The dump is a raw mongodump --archive file (gzipped), not a tar archive
|
|
325
312
|
# Don't use --db flag with --archive as it causes issues
|
|
326
313
|
mongorestore --host localhost:$MONGO_PORT --drop --gzip --archive=/home/dev/.db-dump.gz
|