From 350a62de4d428bb0d5ad8667cf99f638da1a6ac6 Mon Sep 17 00:00:00 2001 From: fernando Date: Mon, 18 Jan 2021 08:19:03 -0300 Subject: [PATCH] Improved logging --- CHANGELOG.md | 2 ++ README.md | 2 +- docs/backup.md | 4 ++-- docs/config.md | 2 +- docs/start.md | 2 +- src/commands/backup.ts | 2 +- src/commands/config.ts | 2 +- src/service/BackupSyncService.ts | 5 ++++- 8 files changed, 13 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 25fc70958..87ab92427 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,8 @@ The changelog format is based on [Keep a Changelog](https://keepachangelog.com/e ---|---|--- Symbol Bootstrap | v0.4.1 | [symbol-bootstrap](https://www.npmjs.com/package/symbol-bootstrap) +- Added `--backupSync` to `config` and `start` commands. It downloads a backup with the Mongo and RocksDb databases for faster synchronization. +- Added `backup` command. The command backups the Mongo and RocksDb data folder into a Zip file that can be used for `--backupSync` feature. - Improved --password. It's only required when private keys need to be read. - Added `database` service to server and broker `depends_on` compose services. - Fixed `link --unlink` command for Voting Key Link transactions. diff --git a/README.md b/README.md index fd139f8de..740bc9f78 100644 --- a/README.md +++ b/README.md @@ -264,7 +264,7 @@ General users should install this tool like any other node module. # Command Topics -* [`symbol-bootstrap backup`](docs/backup.md) - It backups the mongo and data folder into a Zip file that can be used for --backupSync feature. Bootstrap compose services must be stopped before calling this command. +* [`symbol-bootstrap backup`](docs/backup.md) - The command backups the Mongo and RocksDb data folder into a Zip file that can be used for --backupSync feature. Bootstrap compose services must be stopped before calling this command. * [`symbol-bootstrap clean`](docs/clean.md) - It removes the target folder deleting the generated configuration and data * [`symbol-bootstrap compose`](docs/compose.md) - It generates the `docker-compose.yml` file from the configured network. * [`symbol-bootstrap config`](docs/config.md) - Command used to set up the configuration files and the nemesis block for the current network diff --git a/docs/backup.md b/docs/backup.md index c1c06f7aa..0e6fe0ff6 100644 --- a/docs/backup.md +++ b/docs/backup.md @@ -1,7 +1,7 @@ `symbol-bootstrap backup` ========================= -It backups the mongo and data folder into a Zip file that can be used for --backupSync feature. Bootstrap compose services must be stopped before calling this command. +The command backups the Mongo and RocksDb data folder into a Zip file that can be used for --backupSync feature. Bootstrap compose services must be stopped before calling this command. Note: this command is designed for NGL to be used when running public main or public test networks. It's not backing up any node specific information. @@ -9,7 +9,7 @@ Note: this command is designed for NGL to be used when running public main or pu ## `symbol-bootstrap backup` -It backups the mongo and data folder into a Zip file that can be used for --backupSync feature. Bootstrap compose services must be stopped before calling this command. +The command backups the Mongo and RocksDb data folder into a Zip file that can be used for --backupSync feature. Bootstrap compose services must be stopped before calling this command. ``` USAGE diff --git a/docs/config.md b/docs/config.md index ff10d13cd..aa4374044 100644 --- a/docs/config.md +++ b/docs/config.md @@ -30,7 +30,7 @@ OPTIONS -u, --user=user [default: current] User used to run docker images when creating configuration files like certificates or nemesis block. "current" means the current user. - --backupSync It downloads a backup with the mongo and rockdb databases for faster + --backupSync It downloads a backup with the Mongo and RocksDb databases for faster synchronization. --pullImages It pulls the utility images from DockerHub when running the configuration. It only diff --git a/docs/start.md b/docs/start.md index 78799c1f7..43728c8c4 100644 --- a/docs/start.md +++ b/docs/start.md @@ -47,7 +47,7 @@ OPTIONS Add extra arguments to the docker-compose up command. Check out https://docs.docker.com/compose/reference/up. --backupSync - It downloads a backup with the mongo and rockdb databases for faster synchronization. + It downloads a backup with the Mongo and RocksDb databases for faster synchronization. --healthCheck It checks if the services created with docker compose are up and running. diff --git a/src/commands/backup.ts b/src/commands/backup.ts index 9c88819ce..6af6f20dd 100644 --- a/src/commands/backup.ts +++ b/src/commands/backup.ts @@ -17,7 +17,7 @@ import { Command, flags } from '@oclif/command'; import { BootstrapService, BootstrapUtils } from '../service'; export default class Backup extends Command { - static description = `It backups the mongo and data folder into a Zip file that can be used for --backupSync feature. Bootstrap compose services must be stopped before calling this command. + static description = `The command backups the Mongo and RocksDb data folder into a Zip file that can be used for --backupSync feature. Bootstrap compose services must be stopped before calling this command. Note: this command is designed for NGL to be used when running public main or public test networks. It's not backing up any node specific information.`; diff --git a/src/commands/config.ts b/src/commands/config.ts index 990447036..833af1ded 100644 --- a/src/commands/config.ts +++ b/src/commands/config.ts @@ -59,7 +59,7 @@ export default class Config extends Command { }), backupSync: flags.boolean({ - description: 'It downloads a backup with the mongo and rockdb databases for faster synchronization.', + description: 'It downloads a backup with the Mongo and RocksDb databases for faster synchronization.', default: ConfigService.defaultParams.backupSync, }), diff --git a/src/service/BackupSyncService.ts b/src/service/BackupSyncService.ts index bf2beab1f..9e74bc2cd 100644 --- a/src/service/BackupSyncService.ts +++ b/src/service/BackupSyncService.ts @@ -85,6 +85,9 @@ export class BackupSyncService { await this.unzip(fileLocation, 'data', destinationFolder); }), ); + logger.info( + `Zip backup '${fileLocation}' has been restored. HINT: You can remove this file if you want to reclaim the disk space for future use.`, + ); } private unzip(globalDestination: string, innerFolder: string, targetFolder: string): Promise { @@ -208,7 +211,7 @@ export class BackupSyncService { public async createBackup(passedPresetData?: ConfigPreset): Promise { const configLoader = new ConfigLoader(); - const presetData = passedPresetData ?? configLoader.loadExistingPresetData(this.params.target, ''); + const presetData = passedPresetData ?? configLoader.loadExistingPresetData(this.params.target, false); const node = presetData.nodes?.find((node) => (!this.params.nodeName || node.name == this.params.nodeName) && node.api); if (!node && this.params.nodeName) {