|
| 1 | +import 'dotenv/config' |
| 2 | +import "source-map-support/register"; |
| 3 | +import * as cdk from "aws-cdk-lib"; |
| 4 | +import * as config from "./lib/config/fantomConfig"; |
| 5 | +import * as configTypes from "./lib/config/fantomConfig.interface"; |
| 6 | +import { FantomCommonStack } from "./lib/common-stack"; |
| 7 | +import { FantomSingleNodeStack } from "./lib/single-node-stack"; |
| 8 | +import { FantomHANodesStack } from "./lib/ha-nodes-stack"; |
| 9 | +import * as nag from "cdk-nag"; |
| 10 | + |
| 11 | +const app = new cdk.App(); |
| 12 | +cdk.Tags.of(app).add("Project", "AWS_FANTOM"); |
| 13 | + |
| 14 | +new FantomCommonStack(app, "fantom-common", { |
| 15 | + stackName: `fantom-nodes-common`, |
| 16 | + env: { account: config.baseConfig.accountId, region: config.baseConfig.region } |
| 17 | +}); |
| 18 | + |
| 19 | +new FantomSingleNodeStack(app, "fantom-single-node", { |
| 20 | + stackName: `fantom-single-node-${config.baseNodeConfig.nodeConfiguration}-${config.baseNodeConfig.fantomNetwork}`, |
| 21 | + |
| 22 | + env: { account: config.baseConfig.accountId, region: config.baseConfig.region }, |
| 23 | + nodeRole: <configTypes.FantomNodeRole> "single-node", |
| 24 | + instanceType: config.baseNodeConfig.instanceType, |
| 25 | + instanceCpuType: config.baseNodeConfig.instanceCpuType, |
| 26 | + fantomNetwork: config.baseNodeConfig.fantomNetwork, |
| 27 | + nodeConfiguration: config.baseNodeConfig.nodeConfiguration, |
| 28 | + snapshotsUrl:config.baseNodeConfig.snapshotsUrl, |
| 29 | + dataVolume: config.baseNodeConfig.dataVolume, |
| 30 | +}); |
| 31 | + |
| 32 | +new FantomHANodesStack(app, "fantom-ha-nodes", { |
| 33 | + stackName: `fantom-ha-nodes-${config.baseNodeConfig.nodeConfiguration}-${config.baseNodeConfig.fantomNetwork}`, |
| 34 | + env: { account: config.baseConfig.accountId, region: config.baseConfig.region }, |
| 35 | + nodeRole: <configTypes.FantomNodeRole> "rpc-node", |
| 36 | + instanceType: config.baseNodeConfig.instanceType, |
| 37 | + instanceCpuType: config.baseNodeConfig.instanceCpuType, |
| 38 | + fantomNetwork: config.baseNodeConfig.fantomNetwork, |
| 39 | + nodeConfiguration: config.baseNodeConfig.nodeConfiguration, |
| 40 | + snapshotsUrl:config.baseNodeConfig.snapshotsUrl, |
| 41 | + dataVolume: config.baseNodeConfig.dataVolume, |
| 42 | + |
| 43 | + albHealthCheckGracePeriodMin: config.haNodeConfig.albHealthCheckGracePeriodMin, |
| 44 | + heartBeatDelayMin: config.haNodeConfig.heartBeatDelayMin, |
| 45 | + numberOfNodes: config.haNodeConfig.numberOfNodes |
| 46 | +}); |
| 47 | + |
| 48 | +// Security Check |
| 49 | +cdk.Aspects.of(app).add( |
| 50 | + new nag.AwsSolutionsChecks({ |
| 51 | + verbose: false, |
| 52 | + reports: true, |
| 53 | + logIgnores: false |
| 54 | + }) |
| 55 | +); |
0 commit comments