Hello there. I need some help in restoring ODK central. I have downloaded a backup and i want to use it on a different server. I have tried using ***sudo docker compose exec service node /usr/odk/lib/bin/restore.js /data/transfer/backup-2023-02-15T02_00_08.244Z.zip*** but i get the error beloe ----
node:internal/modules/cjs/loader:959
throw err;
^
Error: Cannot find module '/home/pwaiswa/central/server/lib/bin/restore.js'
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:956:15)
at Function.Module._load (node:internal/modules/cjs/loader:804:27)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
at node:internal/main/run_main_module:17:47 {
code: 'MODULE_NOT_FOUND',
requireStack: []
}
I have checked and found that there is no restore.js file in that directory. I found it in /home/pwaiswa/central/server/lib/bin/
I navigated to that directory and tried running ***sudo docker compose exec service node /data/transfer/backup-2023-02-15T02_00_08.244Z.zip*** but i also get the error below ---
PK
^
SyntaxError: Invalid or unexpected token
at Object.compileFunction (node:vm:360:18)
at wrapSafe (node:internal/modules/cjs/loader:1055:15)
at Module._compile (node:internal/modules/cjs/loader:1090:27)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1180:10)
at Module.load (node:internal/modules/cjs/loader:1004:32)
at Function.Module._load (node:internal/modules/cjs/loader:839:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
at node:internal/main/run_main_module:17:47
I kindly need some help since i have a presentation tomorrow morning. Thanks very much
Am running version v2023.2.0 for both server and client
Is the version of Central that created the backup the same as the version you are trying to restore to?
Your second command, as you have it pasted, is missing the reference to the restore.js file.
Even if you have navigated to the same directory as the file, you will need to have the reference to the file you want to run after the node in your command. I think you would be better off following the instructions in the docs for restoring a backup exactly. Change directory into the central folder, and execute the command from there. So I would think you may want to try something like...
cd
cd central
docker compose exec service node /home/pwaiswa/central/server/lib/bin/restore.js /data/transfer/backup-2023-02-15T02_00_08.244Z.zip
Did you create a passphase when you created the backup? You will also need to add that to the end of your command.
Thanks very much for the swift response. The version am restoring to is different from the version that I backed up from
Also, I followed instructions exactly as outlined in that documentation and failed. I also referenced the file with the full path but got the same error.
I have also followed your suggestion and got the response below ---
pwaiswa@instance-1:~/central$ sudo docker compose exec service node /home/pwaiswa/central/server/lib/bin/restore.js /data/transfer/backup-2023-02-15T02_00_08.244Z.zip
node:internal/modules/cjs/loader:959
throw err;
^
Error: Cannot find module '/home/pwaiswa/central/server/lib/bin/restore.js'
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:956:15)
at Function.Module._load (node:internal/modules/cjs/loader:804:27)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
at node:internal/main/run_main_module:17:47 {
code: 'MODULE_NOT_FOUND',
requireStack: []
}
A restore should be done to the same version that created the backup. If you need to install an older version of Central to match the version that created the backup please see this thread:
But again, I suspect your issue may be (at least partly) because you are trying to restore to a different version than the version the created the backup.
@danbjoseph after multiple trials, i got the correct version and managed to restore. I got the response below---
Success. You will have to log out of the site and log back in.
IMPORTANT: EVERYTHING has been restored to the way things were at the time of backup, including:
* all passwords and email addresses.
* anything deleted since the backup was made now exists again.
* your backup settings.
Please revisit all of these and make sure they are okay.
'{"success":true}'
However, I can only login in but cannot find the previous data.
I get the error below ---