darknode-cli icon indicating copy to clipboard operation
darknode-cli copied to clipboard

Backup a running darknode and restore it.

Open tok-kkk opened this issue 5 years ago • 0 comments

Object

  • We want the CLI to be able to backup a darknode from its current status to a single file with password encryption.
  • We want the CLI to be able to restore a darknode from the backup file by providing the correct password. These will give us the ability to migrate darknode to another VPS.

Design

We'll introduce a new command backup to backup the current status of a darknode. It should take a string parameter which is the darknode name and

  1. SSH into the darknode and stop the darknode service.
  2. Create a copy for the database and config file
  3. Compress the files into a tarball and encrypt it using openssl enc command
  4. Clean up those temporary files.
  5. Download the encrypted file to the provided location.

Reason we don't use zip is that it's not pre-installed in ubuntu. Source for using openssl

When restoring the backup, we can

  1. Integrate it with current up command.

Or

  1. have a new restore command.

We'll introduce a new flag which takes a backup file. It should

  1. Check existence of the backup file and try to decrypt it with given password.
  2. Deploy the instance as normal
  3. Copy backup file to the instance.
  4. Extract files from the tarball.
  5. Setup service and start darknode as normal.
  6. Clean up

We should also let the user know the darknode will be stopped by running the backup command.

Discussion

  • Do we want to have a new command when restoring the darknode?
  • Do we want to restart the darknode service after finishing backup?
  • Do we want to support batch operation for the backup command? (i.e. allow --tags option)

tok-kkk avatar Apr 15 '20 12:04 tok-kkk