From 367ea65e67bc4fef8f8edf882000ea6f9d161333 Mon Sep 17 00:00:00 2001 From: Jay Date: Fri, 6 Nov 2026 02:49:43 +0100 Subject: [PATCH 1/2] [MySpotify] docs: Document the manual MongoDB restore Dokploy's built-in restore runs `mongorestore --db --archive`, which current MongoDB tools reject ("invalid db name"). Document the working manual restore with --nsInclude and the root user from the container environment, and point the migration steps to it. Co-Authored-By: Claude Opus 5.5 --- myspotify/README.md | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/myspotify/README.md b/myspotify/README.md index 71b5bbd..ee6d76b 100644 --- a/myspotify/README.md +++ b/myspotify/README.md @@ -30,6 +30,29 @@ The stack does not back itself up. Configure a Dokploy compose backup for the `myspotify-mongo` service (database `your_spotify`, type MongoDB, with the root credentials above) and test a restore. +## Restoring a backup + +Dokploy's built-in restore does not work for MongoDB: it runs +`mongorestore --db --archive`, which current MongoDB tools +reject with `invalid db name`. Restore the backup file by hand: + +1. Download the backup (`.bson.gz`) from the S3 destination. +2. Stop the API so nothing writes during the restore: + `docker stop myspotify-api` +3. Restore it with the root user from the container environment: + + ```sh + docker exec -i myspotify-mongo sh -c 'mongorestore \ + -u "$MONGO_INITDB_ROOT_USERNAME" -p "$MONGO_INITDB_ROOT_PASSWORD" \ + --authenticationDatabase admin --archive --gzip --drop \ + --nsInclude "your_spotify.*"' < backup.bson.gz + ``` + +4. Start the API again: `docker start myspotify-api` + +The file has the same format as `mongodump --archive --gzip`, so +the same command restores a manual dump. + ## Migrating from the host-path version Earlier versions stored MongoDB in `${MYSPOTIFY_DATA}/mongo` @@ -40,9 +63,8 @@ migrated automatically. `docker exec myspotify-mongo mongodump -d your_spotify --archive --gzip > your_spotify.archive.gz` 2. Deploy this version, so MongoDB creates the root user in the new volume. -3. Restore the dump into the new database (Dokploy restore, or - `mongorestore --archive --gzip --drop` with the root - credentials) before using the app. +3. Restore the dump into the new database before using the app, + as described in [Restoring a backup](#restoring-a-backup). ## Networks From 30f423aeca6bf7dd9b3ccd020cf47aef837cebbb Mon Sep 17 00:00:00 2001 From: Jay Date: Fri, 6 Nov 2026 02:55:56 +0100 Subject: [PATCH 2/2] [MySpotify] docs: Warn about --drop and check the restore result Co-Authored-By: Claude Opus 5.5 --- myspotify/README.md | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/myspotify/README.md b/myspotify/README.md index ee6d76b..a31fe32 100644 --- a/myspotify/README.md +++ b/myspotify/README.md @@ -34,7 +34,11 @@ type MongoDB, with the root credentials above) and test a restore. Dokploy's built-in restore does not work for MongoDB: it runs `mongorestore --db --archive`, which current MongoDB tools -reject with `invalid db name`. Restore the backup file by hand: +reject with `invalid db name`. Restore the backup file by hand. + +`--drop` replaces the collections in the backup, so take a fresh +backup first if the current data matters. The backup must come +from the same MongoDB major version (8.x) as the target. 1. Download the backup (`.bson.gz`) from the S3 destination. 2. Stop the API so nothing writes during the restore: @@ -48,7 +52,9 @@ reject with `invalid db name`. Restore the backup file by hand: --nsInclude "your_spotify.*"' < backup.bson.gz ``` -4. Start the API again: `docker start myspotify-api` +4. Check the summary line (`N document(s) restored successfully. + 0 document(s) failed to restore.`), then start the API again: + `docker start myspotify-api` The file has the same format as `mongodump --archive --gzip`, so the same command restores a manual dump. @@ -64,7 +70,8 @@ migrated automatically. 2. Deploy this version, so MongoDB creates the root user in the new volume. 3. Restore the dump into the new database before using the app, - as described in [Restoring a backup](#restoring-a-backup). + as described in [Restoring a backup](#restoring-a-backup) + (use `your_spotify.archive.gz` instead of `backup.bson.gz`). ## Networks