Skip to content

Commit

Permalink
Wallet removed (#354)
Browse files Browse the repository at this point in the history
It doesn't support custom networks well enough. Configuration is hardcoded
  • Loading branch information
fboucquez committed Jan 12, 2022
1 parent a77aba0 commit c59da6e
Show file tree
Hide file tree
Showing 15 changed files with 5 additions and 164 deletions.
5 changes: 3 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,12 @@ The changelog format is based on [Keep a Changelog](https://keepachangelog.com/e
| Symbol Bootstrap | v1.1.2 | [symbol-bootstrap](https://www.npmjs.com/package/symbol-bootstrap) |

- Joeynet Testnet Release.
- The `bootstrap` preset is not the default anymore. The name must be provided via --preset or as a custom preset field.
- The `bootstrap` preset is not the default anymore. The name must be provided via `--preset` or as a custom preset field.
- A 'safe' custom preset is cached in the target folder. It's not required when upgrading the node without a configuration change.
- Added `--logger` option to the commands.
- Assemblies are shared between all the presets.
- Allowing user provided --preset and --assembly yml files.
- Allowing user provided `--preset` and `--assembly` yml files.
- Removed wallet from `demo` preset.

## [1.1.1] - Nov-16-2021

Expand Down
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ Properties in each file override the previous values (by object deep merge).
- [`peer`](presets/assemblies/assembly-peer.yml): A standard peer-only node that contains 1 peer node.
- [`api`](presets/assemblies/assembly-api.yml): A standard API node that contains 1 Mongo database, 1 API node, 1 REST gateway, and 1 broker.
- [`dual`](presets/assemblies/assembly-dual.yml): A standard dual node that contains 1 Mongo database, 1 API node, 1 REST gateway, 1 broker, and 1 peer node.
- [`demo`](presets/assemblies/assembly-demo.yml): A dual node with an additional explorer, web wallet and faucet for test and demonstration purposes.
- [`demo`](presets/assemblies/assembly-demo.yml): A dual node with an additional explorer and faucet for test and demonstration purposes.
- [`multinode`](presets/assemblies/assembly-multinode.yml): A special assembly that contains 1 API node and 2 peer-only nodes. This assembly is for testing, it showcases how a private network with 3 nodes runs.

### Custom preset:
Expand All @@ -91,7 +91,6 @@ The folder structure is:
- `./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.
- `./explorers`: The generated explorer configuration.
- `./wallets`: The generated wallet configuration.
- `./reports`: The location of the generated reports.

Note: **The target folder should not be manually modified**. This tool may override any file in the target folder when doing upgrades. Any custom configuration should be provided via a custom preset. Check out the custom preset [guides](docs/presetGuides.md)!
Expand Down
4 changes: 0 additions & 4 deletions presets/assemblies/assembly-demo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,6 @@ gateways:
databaseHost: 'db'
openPort: true
ipv4_address: 172.20.0.25
wallets:
- name: 'wallet'
title: 'Symbol Bootstrap Wallet'
openPort: '80'
explorers:
- name: 'explorer'
openPort: '90'
Expand Down
11 changes: 0 additions & 11 deletions presets/assemblies/assembly-multinode.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,17 +33,6 @@ gateways:
databaseHost: 'db-{{$index}}'
openPort: '{{add $index 3000}}'
ipv4_address: '172.20.0.{{add $index 25}}'
wallets:
- repeat: 0
title: 'Symbol Bootstrap Wallet'
name: 'wallet-{{$index}}'
defaultNodeUrl: 'http://localhost:{{add $index 3000}}'
namespaceName: '{{baseNamespace}}.{{currencyName}}'
openPort: '{{add $index 80}}'
restNodes:
- friendlyName: 'Bootstrap Rest $index'
url: 'http://localhost:{{add $index 3000}}'
roles: 2
explorers:
- repeat: 0
name: 'explorer-{{$index}}'
Expand Down
1 change: 0 additions & 1 deletion presets/shared.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ batchVerificationRandomSource:
symbolServerImage: symbolplatform/symbol-server:gcc-10-1.0.3.1
symbolRestImage: symbolplatform/symbol-rest:2.4.0
symbolExplorerImage: symbolplatform/symbol-explorer:1.1.0-alpha
symbolWalletImage: symbolplatform/symbol-desktop-wallet:1.0.1
symbolFaucetImage: symbolplatform/symbol-faucet:1.0.1-alpha
mongoImage: mongo:4.4.3-bionic
httpsPortalImage: steveltn/https-portal:1.19
Expand Down
17 changes: 0 additions & 17 deletions src/model/ConfigPreset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -342,20 +342,6 @@ export interface ExplorerPreset extends DockerServicePreset {
name: string;
}

export interface WalletProfilePreset {
name: number;
// if not provided, A file will be copied over from the working dir.
data?: any;
location?: string;
}

export interface WalletPreset extends DockerServicePreset {
// At least these properties.
repeat?: number;
name: string;
profiles?: WalletProfilePreset[];
}

export interface FaucetPreset extends DockerServicePreset {
// At least these properties.
gateway: string;
Expand Down Expand Up @@ -394,7 +380,6 @@ export interface CommonConfigPreset extends NodeConfigPreset, GatewayConfigPrese
faucetUrl?: string;
nemesisSeedFolder?: string; // Optional seed folder if user provides an external seed/00000 folder.

symbolWalletImage: string;
symbolServerImage: string;
symbolExplorerImage: string;
symbolRestImage: string;
Expand Down Expand Up @@ -450,7 +435,6 @@ export interface ConfigPreset extends CommonConfigPreset {
nodes?: NodePreset[];
gateways?: GatewayPreset[];
explorers?: ExplorerPreset[];
wallets?: WalletPreset[];
faucets?: FaucetPreset[];
httpsProxies?: HttpsProxyPreset[];
customPresetCache?: CustomPreset;
Expand All @@ -462,7 +446,6 @@ export interface CustomPreset extends Partial<CommonConfigPreset> {
nodes?: Partial<NodePreset>[];
gateways?: Partial<GatewayPreset>[];
explorers?: Partial<ExplorerPreset>[];
wallets?: Partial<WalletPreset>[];
faucets?: Partial<FaucetPreset>[];
httpsProxies?: Partial<HttpsProxyPreset>[];
}
1 change: 0 additions & 1 deletion src/service/BootstrapUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ export class BootstrapUtils {
public static readonly targetNodesFolder = 'nodes';
public static readonly targetGatewaysFolder = 'gateways';
public static readonly targetExplorersFolder = 'explorers';
public static readonly targetWalletsFolder = 'wallets';
public static readonly targetDatabasesFolder = 'databases';
public static readonly targetNemesisFolder = 'nemesis';
public static readonly defaultWorkingDir = '.';
Expand Down
22 changes: 0 additions & 22 deletions src/service/ComposeService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ const targetNodesFolder = BootstrapUtils.targetNodesFolder;
const targetDatabasesFolder = BootstrapUtils.targetDatabasesFolder;
const targetGatewaysFolder = BootstrapUtils.targetGatewaysFolder;
const targetExplorersFolder = BootstrapUtils.targetExplorersFolder;
const targetWalletsFolder = BootstrapUtils.targetWalletsFolder;

export interface PortConfiguration {
internalPort: number;
Expand Down Expand Up @@ -299,27 +298,6 @@ export class ComposeService {
}),
);

await Promise.all(
(presetData.wallets || [])
.filter((d) => !d.excludeDockerService)
.map(async (n) => {
const volumes = [vol(`../${targetWalletsFolder}/${n.name}`, '/usr/share/nginx/html/config', true)];
services.push(
await resolveService(n, {
container_name: n.name,
image: presetData.symbolWalletImage,
stop_signal: 'SIGINT',
working_dir: nodeWorkingDirectory,
ports: resolvePorts([{ internalPort: 80, openPort: n.openPort }]),
restart: restart,
volumes: volumes,
...this.resolveDebugOptions(presetData.dockerComposeDebugMode, n.dockerComposeDebugMode),
...n.compose,
}),
);
}),
);

await Promise.all(
(presetData.explorers || [])
.filter((d) => !d.excludeDockerService)
Expand Down
1 change: 0 additions & 1 deletion src/service/ConfigLoader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -625,7 +625,6 @@ export class ConfigLoader {
nodes: this.expandServicesRepeat(presetData, presetData.nodes || []),
gateways: this.expandServicesRepeat(presetData, presetData.gateways || []),
explorers: this.expandServicesRepeat(presetData, presetData.explorers || []),
wallets: this.expandServicesRepeat(presetData, presetData.wallets || []),
faucets: this.expandServicesRepeat(presetData, presetData.faucets || []),
nemesis: this.applyValueTemplate(presetData, presetData.nemesis),
};
Expand Down
55 changes: 1 addition & 54 deletions src/service/ConfigService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/

import * as fs from 'fs';
import { copyFileSync, existsSync, promises as fsPromises } from 'fs';
import { copyFileSync, existsSync } from 'fs';
import * as _ from 'lodash';
import { join } from 'path';
import {
Expand Down Expand Up @@ -175,7 +175,6 @@ export class ConfigService {
await this.generateNodes(presetData, addresses, remoteNodeService);
await this.generateGateways(presetData);
await this.generateExplorers(presetData, remoteNodeService);
await this.generateWallets(presetData, remoteNodeService);
const isUpgrade = !!oldPresetData || !!oldAddresses;
await this.resolveNemesis(presetData, addresses, isUpgrade);
await this.copyNemesis(addresses);
Expand Down Expand Up @@ -699,58 +698,6 @@ export class ConfigService {
);
}

private generateWallets(presetData: ConfigPreset, remoteNodeService: RemoteNodeService) {
return Promise.all(
(presetData.wallets || []).map(async (walletPreset, index: number) => {
const copyFrom = join(BootstrapUtils.ROOT_FOLDER, 'config', 'wallet');
const { restNodes, defaultNode } = await this.resolveRests(presetData, remoteNodeService);
const templateContext = {
namespaceName: `${presetData.baseNamespace}.${this.resolveCurrencyName(presetData)}`,
defaultNodeUrl: defaultNode,
restNodes: restNodes.map((url) => {
return { url: url, roles: 2, friendlyName: new URL(url).hostname };
}),
...presetData,
...walletPreset,
};

const name = templateContext.name || `wallet-${index}`;
const moveTo = BootstrapUtils.getTargetFolder(this.params.target, false, BootstrapUtils.targetWalletsFolder, name);
await BootstrapUtils.generateConfiguration(templateContext, copyFrom, moveTo);
await fsPromises.chmod(join(moveTo, 'app.conf.js'), 0o777);
await fsPromises.chmod(join(moveTo, 'fees.conf.js'), 0o777);
await fsPromises.chmod(join(moveTo, 'network.conf.js'), 0o777);
await fsPromises.chmod(join(moveTo, 'profileImporter.html'), 0o777);
await Promise.all(
(walletPreset.profiles || []).map(async (profile) => {
if (!profile.name) {
throw new Error('Profile`s name must be provided in the wallets preset when creating wallet profiles.');
}
const profileJsonFileName = `wallet-profile-${profile.name}.json`;

const loadProfileData = async (): Promise<string> => {
if (profile.data) {
return JSON.stringify(profile.data, null, 2);
}
if (profile.location) {
return BootstrapUtils.loadFileAsText(profile.location);
}
return BootstrapUtils.loadFileAsText(profileJsonFileName);
};

try {
const profileData = await loadProfileData();
await BootstrapUtils.writeTextFile(join(moveTo, profileJsonFileName), profileData);
} catch (e) {
const message = `Cannot create Wallet profile with name '${profile.name}'. Do you have the file '${profileJsonFileName}' in the current folder?. ${e}`;
throw new Error(message);
}
}),
);
}),
);
}

private async resolveRests(
presetData: ConfigPreset,
remoteNodeService: RemoteNodeService,
Expand Down
15 changes: 0 additions & 15 deletions test/composes/expected-docker-compose-bootstrap-demo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,21 +76,6 @@ services:
networks:
default:
ipv4_address: 172.20.0.25
wallet:
container_name: wallet
image: 'symbolplatform/symbol-desktop-wallet:1.0.1'
stop_signal: SIGINT
working_dir: /symbol-workdir
ports:
- '80:80'
restart: 'on-failure:2'
volumes:
- '../wallets/wallet:/usr/share/nginx/html/config:ro'
security_opt:
- 'seccomp:unconfined'
cap_add:
- ALL
privileged: true
explorer:
container_name: explorer
image: 'symbolplatform/symbol-explorer:1.1.0-alpha'
Expand Down
20 changes: 0 additions & 20 deletions test/composes/expected-docker-compose-bootstrap-repeat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -314,26 +314,6 @@ services:
networks:
default:
ipv4_address: 172.20.0.28
wallet-0:
container_name: wallet-0
image: 'symbolplatform/symbol-desktop-wallet:1.0.1'
stop_signal: SIGINT
working_dir: /symbol-workdir
ports:
- '80:80'
restart: 'on-failure:2'
volumes:
- '../wallets/wallet-0:/usr/share/nginx/html/config:ro'
wallet-1:
container_name: wallet-1
image: 'symbolplatform/symbol-desktop-wallet:1.0.1'
stop_signal: SIGINT
working_dir: /symbol-workdir
ports:
- '81:80'
restart: 'on-failure:2'
volumes:
- '../wallets/wallet-1:/usr/share/nginx/html/config:ro'
explorer-0:
container_name: explorer-0
image: 'symbolplatform/symbol-explorer:1.1.0-alpha'
Expand Down
7 changes: 0 additions & 7 deletions test/custom_preset-aws.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,6 @@ explorers:
defaultNode: 'http://aws-rest-gateway-{{$index}}:3000'
restNodes:
- 'http://aws-rest-gateway-{{$index}}:3000'
wallets:
- repeat: 1
defaultNodeUrl: 'http://aws-rest-gateway-{{$index}}:3000'
restNodes:
- friendlyName: 'Bootstrap Rest $index'
url: 'http://aws-rest-gateway-{{$index}}:3000'
roles: 2
faucets:
- repeat: 1
environment:
Expand Down
5 changes: 0 additions & 5 deletions test/custom_preset.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,3 @@ nemesis:
TAI4NEL4SBQDSPY2XKMPIGOC53UALIXJ5WHRJVQ: 10000000000
TAWBSSHIKZNX6E65FJG4BVIJR236Z64Z77CMOJA: 5000000000
TDTZLYALSDGWBW5ZJJYKOM65YFHELZHGEEUDZ7A: 3000000000

wallets:
- profiles:
- name: test
location: ./test/profiles/wallet-profile-test.json
2 changes: 0 additions & 2 deletions test/repeat_preset.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ nodes:
# 4 rests
gateways:
- repeat: 4
wallets:
- repeat: 2
explorers:
- repeat: 3
faucets:
Expand Down

0 comments on commit c59da6e

Please sign in to comment.