Skip to content

Commit

Permalink
Verify command (#232)
Browse files Browse the repository at this point in the history
  • Loading branch information
fboucquez authored Apr 9, 2021
1 parent 943e378 commit 012ff0f
Show file tree
Hide file tree
Showing 10 changed files with 424 additions and 12 deletions.
5 changes: 5 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ services:
- docker
env:
global:
- DOCKER_COMPOSE_VERSION=1.25.0
- DEV_BRANCH=dev
- RELEASE_BRANCH=main
- POST_RELEASE_BRANCH=main
Expand All @@ -18,6 +19,10 @@ cache:
- node_modules
- .eslintcache
before_script:
- sudo rm /usr/local/bin/docker-compose
- curl -L https://github.com/docker/compose/releases/download/${DOCKER_COMPOSE_VERSION}/docker-compose-`uname -s`-`uname -m` > docker-compose
- chmod +x docker-compose
- sudo mv docker-compose /usr/local/bin
- . ./travis/node-functions.sh
- VERSION="$(node_load_version)"
- if [[ ! -z "$DOCKER_USERNAME" ]] ; then echo "${DOCKER_PASSWORD}" | docker login -u "${DOCKER_USERNAME}" --password-stdin; fi
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ The changelog format is based on [Keep a Changelog](https://keepachangelog.com/e
| Symbol Bootstrap | v1.0.4 | [symbol-bootstrap](https://www.npmjs.com/package/symbol-bootstrap) |

- New `testnet.symboldev.network` testnet!
- Added `verify` command.
- Fixed host override when no custom preset is provided in mainnet.
- Fixed case issue validating keys when creating certificates.
- Updated Wallet to latest 1.0.1 release.
Expand Down
17 changes: 8 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,21 +87,19 @@ The folder where the generated config, docker files and data are stored. The fol
- `./gateways`: it holds the configuration and logs for all the defined node rest gateways.
- `./nemesis`: The folder used to hold the nemesis block. Block 1 data is generated via `nemgen` tool for new networks. For existing network, it is copied over.
- `./databases`: the location where the mongo data is stored for the different database instances.
- `./docker`: the generated docker-compose.yml, mongo init scripts and server basic bash scripts.
- `./docker`: the generated docker-compose.yml, mongo init scripts and server basic bash scripts.
- `./reports`: the location of the generated reports.

# Requirements

- Node 12+
- Docker
- Docker Compose
- Node 12.0.0+
- Docker 18.3.0+
- Docker Compose 1.25.0+

Validate your environment by running:

```
node -v
docker -v
docker-compose -v
symbol-bootstrap verify
```

Check your user can run docker without sudo:
Expand Down Expand Up @@ -216,8 +214,8 @@ Alternatively, you can use the [BootstrapService](https://github.com/nemtech/sym
Example:

```ts
import {BootstrapService, StartParams, Preset} from 'symbol-bootstrap';
import {expect} from '@oclif/test';
import {BootstrapService, StartParams, Preset} from 'symbol-bootstrap';
import {expect} from '@oclif/test';

it('Bootstrap e2e test', async () => {
const service = new BootstrapService();
Expand Down Expand Up @@ -279,6 +277,7 @@ General users should install this tool like any other node module.
* [`symbol-bootstrap run`](docs/run.md) - It boots the network via docker using the generated `docker-compose.yml` file and configuration. The config and compose methods/commands need to be called before this method. This is just a wrapper for the `docker-compose up` bash call.
* [`symbol-bootstrap start`](docs/start.md) - Single command that aggregates config, compose and run in one line!
* [`symbol-bootstrap stop`](docs/stop.md) - It stops the docker-compose network if running (symbol-bootstrap started with --detached). This is just a wrapper for the `docker-compose down` bash call.
* [`symbol-bootstrap verify`](docs/verify.md) - It tests the installed software in the current computer reporting if there is any missing dependency, invalid version, or software related issue.

<!-- commandsstop -->

Expand Down
23 changes: 23 additions & 0 deletions docs/verify.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
`symbol-bootstrap verify`
=========================

It tests the installed software in the current computer reporting if there is any missing dependency, invalid version, or software related issue.

* [`symbol-bootstrap verify`](#symbol-bootstrap-verify)

## `symbol-bootstrap verify`

It tests the installed software in the current computer reporting if there is any missing dependency, invalid version, or software related issue.

```
USAGE
$ symbol-bootstrap verify
OPTIONS
-h, --help It shows the help of this command.
EXAMPLE
$ symbol-bootstrap verify
```

_See code: [src/commands/verify.ts](https://github.com/nemtech/symbol-bootstrap/blob/v1.0.4/src/commands/verify.ts)_
57 changes: 54 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"memorystream": "^0.3.1",
"node-forge": "^0.10.0",
"rxjs": "^6.6.3",
"semver": "^7.3.5",
"shx": "^0.3.2",
"sshpk": "^1.16.1",
"symbol-sdk": "^0.23.2",
Expand All @@ -40,6 +41,7 @@
"@types/mocha": "^8.2.2",
"@types/node": "^10.17.28",
"@types/node-forge": "^0.9.4",
"@types/semver": "^7.3.4",
"@types/sshpk": "^1.10.5",
"@types/winston": "^2.4.4",
"@typescript-eslint/eslint-plugin": "^3.7.1",
Expand Down
45 changes: 45 additions & 0 deletions src/commands/verify.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/*
* Copyright 2020 NEM
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

import { Command } from '@oclif/command';
import { LogType } from '../logger';
import Logger from '../logger/Logger';
import LoggerFactory from '../logger/LoggerFactory';
import { BootstrapUtils, CommandUtils, VerifyService } from '../service';
const logger: Logger = LoggerFactory.getLogger(LogType.System);

export default class Clean extends Command {
static description =
'It tests the installed software in the current computer reporting if there is any missing dependency, invalid version, or software related issue.';
static examples = [`$ symbol-bootstrap verify`];

static flags = {
help: CommandUtils.helpFlag,
};

public async run(): Promise<void> {
BootstrapUtils.showBanner();
const report = await new VerifyService(this.config.root).createReport();
logger.info(`OS: ${report.platform}`);
report.lines.forEach((line) => {
if (line.recommendation) {
logger.warn(`${line.header} - Warning! - ${line.message} - ${line.recommendation}`);
} else {
logger.info(`${line.header} - OK! - ${line.message}`);
}
});
}
}
Loading

0 comments on commit 012ff0f

Please sign in to comment.