From b8c1e47c73d60c112054e64f48bfa5a8b2ec659f Mon Sep 17 00:00:00 2001 From: Simon Larsen Date: Mon, 6 Jun 2022 12:00:39 +0100 Subject: [PATCH] fix database transformer --- Common/Models/BaseModel.ts | 27 + Common/Models/User.ts | 1 + Common/Types/API/URL.ts | 6 +- Common/Types/Email.ts | 6 +- Common/Types/HashedString.ts | 32 +- Common/Types/ObjectID.ts | 6 +- Common/Types/Version.ts | 6 +- Common/package-lock.json | 22 + Common/package.json | 2 + CommonServer/Services/DatabaseService.ts | 18 +- Nginx/default.conf | 6 +- docker-compose.dev.yml | 932 +++++++++++------------ 12 files changed, 552 insertions(+), 512 deletions(-) diff --git a/Common/Models/BaseModel.ts b/Common/Models/BaseModel.ts index fc21d96da0..086611a703 100644 --- a/Common/Models/BaseModel.ts +++ b/Common/Models/BaseModel.ts @@ -24,6 +24,21 @@ import ObjectID from '../Types/ObjectID'; import AccessControl from '../Types/Database/AccessControls/AccessControl'; import Dictionary from '../Types/Dictionary'; import HashedString from '../Types/HashedString'; +import Email from '../Types/Email'; +import Phone from '../Types/Phone'; +import PositiveNumber from '../Types/PositiveNumber'; + +export type DbTypes = + string | + number | + PositiveNumber | + Email | + HashedString | + URL | + Phone | + JSONObject | + JSONArray | + Buffer; export default class BaseModel extends BaseEntity { @TableColumn({ title: 'ID' }) @@ -137,6 +152,18 @@ export default class BaseModel extends BaseEntity { return new Columns(Object.keys(getTableColumns(this))); } + public hasValue(columnName: string) { + return !!(this as any)[columnName]; + } + + public getValue(columnName: string): T { + return (this as any)[columnName] as T; + } + + public setValue(columnName: string, value: T) { + return (this as any)[columnName] = value; + } + public getUniqueColumns(): Columns { const dictionary: Dictionary = getTableColumns(this); diff --git a/Common/Models/User.ts b/Common/Models/User.ts index a855c07a2f..232e416ab3 100644 --- a/Common/Models/User.ts +++ b/Common/Models/User.ts @@ -81,6 +81,7 @@ class User extends BaseModel { length: ColumnLength.HashedString, unique: false, nullable: true, + transformer: HashedString.getDatabaseTransformer() }) public password?: HashedString = undefined; diff --git a/Common/Types/API/URL.ts b/Common/Types/API/URL.ts index 7f57d32e79..6132877ed4 100644 --- a/Common/Types/API/URL.ts +++ b/Common/Types/API/URL.ts @@ -98,10 +98,10 @@ export default class URL extends DatabaseProperty { } protected static override toDatabase( - _value: URL | FindOperator + value: URL | FindOperator ): string | null { - if (_value) { - return _value.toString(); + if (value) { + return value.toString(); } return null; diff --git a/Common/Types/Email.ts b/Common/Types/Email.ts index 0e41a3e319..906616f6b4 100644 --- a/Common/Types/Email.ts +++ b/Common/Types/Email.ts @@ -75,10 +75,10 @@ export default class Email extends DatabaseProperty { } public static override toDatabase( - _value: Email | FindOperator + value: Email | FindOperator ): string | null { - if (_value) { - return _value.toString(); + if (value) { + return value.toString(); } return null; diff --git a/Common/Types/HashedString.ts b/Common/Types/HashedString.ts index 4e0a35f36c..d26318db1a 100644 --- a/Common/Types/HashedString.ts +++ b/Common/Types/HashedString.ts @@ -2,8 +2,8 @@ import { FindOperator } from 'typeorm'; import UUID from '../Utils/UUID'; import DatabaseProperty from './Database/DatabaseProperty'; import BadOperationException from './Exception/BadOperationException'; -import EncryptionAlgorithm from './EncryptionAlgorithm'; import ObjectID from './ObjectID'; +import CryptoJS from 'crypto-js'; export default class HashedString extends DatabaseProperty { private isHashed: boolean = false; @@ -31,10 +31,11 @@ export default class HashedString extends DatabaseProperty { } protected static override toDatabase( - _value: HashedString | FindOperator + value: HashedString | FindOperator ): string | null { - if (_value) { - return _value.toString(); + + if (value) { + return value.toString(); } return null; @@ -56,26 +57,9 @@ export default class HashedString extends DatabaseProperty { const valueToHash: string = (encryptionSecret || '') + this.value; this.isHashed = true; - // encode as UTF-8 - const msgBuffer: Uint8Array = new TextEncoder().encode(valueToHash); - - // hash the message - const hashBuffer: ArrayBuffer = await crypto.subtle.digest( - EncryptionAlgorithm.SHA256, - msgBuffer - ); - - // convert ArrayBuffer to Array - const hashArray: Array = Array.from(new Uint8Array(hashBuffer)); - - // convert bytes to hex string - const hashHex: string = hashArray - .map((b: number) => { - return b.toString(16).padStart(2, '0'); - }) - .join(''); - this.value = hashHex; - return hashHex; + + this.value = CryptoJS.SHA256(valueToHash).toString(); + return this.value; } public static async hashValue( diff --git a/Common/Types/ObjectID.ts b/Common/Types/ObjectID.ts index 80a93d1b3b..f5f025cab2 100644 --- a/Common/Types/ObjectID.ts +++ b/Common/Types/ObjectID.ts @@ -26,10 +26,10 @@ export default class ObjectID extends DatabaseProperty { } protected static override toDatabase( - _value: ObjectID | FindOperator + value: ObjectID | FindOperator ): string | null { - if (_value) { - return _value.toString(); + if (value) { + return value.toString(); } return null; diff --git a/Common/Types/Version.ts b/Common/Types/Version.ts index 624bc5d42f..d439f67159 100644 --- a/Common/Types/Version.ts +++ b/Common/Types/Version.ts @@ -27,10 +27,10 @@ export default class Version extends DatabaseProperty { } protected static override toDatabase( - _value: Version | FindOperator + value: Version | FindOperator ): string | null { - if (_value) { - return _value.toString(); + if (value) { + return value.toString(); } return null; diff --git a/Common/package-lock.json b/Common/package-lock.json index 78477e3c39..c45076e30b 100644 --- a/Common/package-lock.json +++ b/Common/package-lock.json @@ -9,9 +9,11 @@ "version": "1.0.0", "license": "MIT", "dependencies": { + "@types/crypto-js": "^4.1.1", "@types/nanoid-dictionary": "^4.2.0", "@types/uuid": "^8.3.4", "axios": "^0.26.1", + "crypto-js": "^4.1.1", "moment": "^2.29.2", "nanoid": "^3.3.2", "nanoid-dictionary": "^4.3.0", @@ -952,6 +954,11 @@ "@babel/types": "^7.3.0" } }, + "node_modules/@types/crypto-js": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/@types/crypto-js/-/crypto-js-4.1.1.tgz", + "integrity": "sha512-BG7fQKZ689HIoc5h+6D2Dgq1fABRa0RbBWKBd9SP/MVRVXROflpm5fhwyATX5duFmbStzyzyycPB8qUYKDH3NA==" + }, "node_modules/@types/graceful-fs": { "version": "4.1.5", "resolved": "https://registry.npmjs.org/@types/graceful-fs/-/graceful-fs-4.1.5.tgz", @@ -1584,6 +1591,11 @@ "node": ">= 8" } }, + "node_modules/crypto-js": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/crypto-js/-/crypto-js-4.1.1.tgz", + "integrity": "sha512-o2JlM7ydqd3Qk9CA0L4NL6mTzU2sdx96a+oOfPu8Mkl/PK51vSyoi8/rQ8NknZtk44vq15lmhAj9CIAGwgeWKw==" + }, "node_modules/cssom": { "version": "0.4.4", "resolved": "https://registry.npmjs.org/cssom/-/cssom-0.4.4.tgz", @@ -5274,6 +5286,11 @@ "@babel/types": "^7.3.0" } }, + "@types/crypto-js": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/@types/crypto-js/-/crypto-js-4.1.1.tgz", + "integrity": "sha512-BG7fQKZ689HIoc5h+6D2Dgq1fABRa0RbBWKBd9SP/MVRVXROflpm5fhwyATX5duFmbStzyzyycPB8qUYKDH3NA==" + }, "@types/graceful-fs": { "version": "4.1.5", "resolved": "https://registry.npmjs.org/@types/graceful-fs/-/graceful-fs-4.1.5.tgz", @@ -5755,6 +5772,11 @@ "which": "^2.0.1" } }, + "crypto-js": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/crypto-js/-/crypto-js-4.1.1.tgz", + "integrity": "sha512-o2JlM7ydqd3Qk9CA0L4NL6mTzU2sdx96a+oOfPu8Mkl/PK51vSyoi8/rQ8NknZtk44vq15lmhAj9CIAGwgeWKw==" + }, "cssom": { "version": "0.4.4", "resolved": "https://registry.npmjs.org/cssom/-/cssom-0.4.4.tgz", diff --git a/Common/package.json b/Common/package.json index 9e1acb4b28..c4db239814 100644 --- a/Common/package.json +++ b/Common/package.json @@ -17,9 +17,11 @@ "ts-jest": "^27.1.4" }, "dependencies": { + "@types/crypto-js": "^4.1.1", "@types/nanoid-dictionary": "^4.2.0", "@types/uuid": "^8.3.4", "axios": "^0.26.1", + "crypto-js": "^4.1.1", "moment": "^2.29.2", "nanoid": "^3.3.2", "nanoid-dictionary": "^4.3.0", diff --git a/CommonServer/Services/DatabaseService.ts b/CommonServer/Services/DatabaseService.ts index 199e753619..c863af38e5 100644 --- a/CommonServer/Services/DatabaseService.ts +++ b/CommonServer/Services/DatabaseService.ts @@ -28,6 +28,7 @@ import HashedString from 'Common/Types/HashedString'; import UpdateByID from '../Types/DB/UpdateByID'; import ObjectID from 'Common/Types/ObjectID'; import Role from 'Common/Types/Role'; +import Columns from 'Common/Types/Database/Columns'; class DatabaseService { private postgresDatabase!: PostgresDatabase; @@ -121,10 +122,13 @@ class DatabaseService { } protected async hash(data: TBaseModel): Promise { - for (const key of data.getHashedColumns().columns) { + const columns: Columns = data.getHashedColumns(); + + + for (const key of columns.columns) { if ( - (data as any)[key] && - !((data as any)[key] as HashedString).isValueHashed + data.hasValue(key) && + !((data.getValue(key) as HashedString).isValueHashed()) ) { await ((data as any)[key] as HashedString).hashValue( EncryptionSecret @@ -140,8 +144,8 @@ class DatabaseService { for (const key of data.getEncryptedColumns().columns) { // If data is an object. - if (typeof (data as any)[key] === 'object') { - const dataObj: JSONObject = (data as any)[key]; + if (typeof data.getValue(key) === 'object') { + const dataObj: JSONObject = data.getValue(key) as JSONObject; for (const key in dataObj) { dataObj[key] = Encryption.decrypt( @@ -150,10 +154,10 @@ class DatabaseService { ); } - (data as any)[key] = dataObj; + data.setValue(key, dataObj); } else { //If its string or other type. - (data as any)[key] = Encryption.decrypt((data as any)[key], iv); + data.setValue(key, Encryption.decrypt((data as any)[key], iv)); } } diff --git a/Nginx/default.conf b/Nginx/default.conf index 4e27217635..6c320e5e35 100644 --- a/Nginx/default.conf +++ b/Nginx/default.conf @@ -46,9 +46,9 @@ server { ssl_certificate /etc/nginx/certs/nginx.crt; ssl_certificate_key /etc/nginx/certs/nginx.key; - location / { - proxy_pass http://home/; - } + # location / { + # proxy_pass http://home/; + # } location /accounts { proxy_set_header Host $host; diff --git a/docker-compose.dev.yml b/docker-compose.dev.yml index 030c53dc51..f748bf06bc 100644 --- a/docker-compose.dev.yml +++ b/docker-compose.dev.yml @@ -106,214 +106,214 @@ services: - /usr/src/CommonServer/node_modules/ - data-ingestor: - ports: - - '3200:3200' - - '9338:9229' # Debugging port. - build: - network: host - context: . - dockerfile: ./DataIngestor/Dockerfile.dev - env_file: - - ./Common/.env - - ./CommonServer/.env - - ./DataIngestor/.env - environment: *common-variables - depends_on: - - script-runner - - dashboard-api - - realtime - volumes: - - ./DataIngestor:/usr/src/app - # Use node modules of the container and not host system. - # https://stackoverflow.com/questions/29181032/add-a-volume-to-docker-but-exclude-a-sub-folder - - /usr/src/app/node_modules/ - - ./Common:/usr/src/Common - - ./CommonServer:/usr/src/CommonServer - - ./CommonUI:/usr/src/CommonUI - - /usr/src/Common/node_modules/ - - /usr/src/CommonUI/node_modules/ - - /usr/src/CommonServer/node_modules/ + # data-ingestor: + # ports: + # - '3200:3200' + # - '9338:9229' # Debugging port. + # build: + # network: host + # context: . + # dockerfile: ./DataIngestor/Dockerfile.dev + # env_file: + # - ./Common/.env + # - ./CommonServer/.env + # - ./DataIngestor/.env + # environment: *common-variables + # depends_on: + # - script-runner + # - dashboard-api + # - realtime + # volumes: + # - ./DataIngestor:/usr/src/app + # # Use node modules of the container and not host system. + # # https://stackoverflow.com/questions/29181032/add-a-volume-to-docker-but-exclude-a-sub-folder + # - /usr/src/app/node_modules/ + # - ./Common:/usr/src/Common + # - ./CommonServer:/usr/src/CommonServer + # - ./CommonUI:/usr/src/CommonUI + # - /usr/src/Common/node_modules/ + # - /usr/src/CommonUI/node_modules/ + # - /usr/src/CommonServer/node_modules/ - realtime: - ports: - - '3300:3300' - - '9250:9229' # Debugging port. - build: - network: host - context: . - dockerfile: ./Realtime/Dockerfile.dev - env_file: - - ./Common/.env - - ./CommonServer/.env - - ./Realtime/.env - environment: *common-variables - volumes: - - ./Realtime:/usr/src/app - # Use node modules of the container and not host system. - # https://stackoverflow.com/questions/29181032/add-a-volume-to-docker-but-exclude-a-sub-folder - - /usr/src/app/node_modules/ - - ./Common:/usr/src/Common - - ./CommonServer:/usr/src/CommonServer - - ./CommonUI:/usr/src/CommonUI - - /usr/src/Common/node_modules/ - - /usr/src/CommonUI/node_modules/ - - /usr/src/CommonServer/node_modules/ + # realtime: + # ports: + # - '3300:3300' + # - '9250:9229' # Debugging port. + # build: + # network: host + # context: . + # dockerfile: ./Realtime/Dockerfile.dev + # env_file: + # - ./Common/.env + # - ./CommonServer/.env + # - ./Realtime/.env + # environment: *common-variables + # volumes: + # - ./Realtime:/usr/src/app + # # Use node modules of the container and not host system. + # # https://stackoverflow.com/questions/29181032/add-a-volume-to-docker-but-exclude-a-sub-folder + # - /usr/src/app/node_modules/ + # - ./Common:/usr/src/Common + # - ./CommonServer:/usr/src/CommonServer + # - ./CommonUI:/usr/src/CommonUI + # - /usr/src/Common/node_modules/ + # - /usr/src/CommonUI/node_modules/ + # - /usr/src/CommonServer/node_modules/ - helmchart: - ports: - - '3423:3423' - build: - network: host - context: . - dockerfile: ./HelmChart/Dockerfile - env_file: - - ./Common/.env - - ./CommonServer/.env - - ./HelmChart/.env - environment: *common-variables - volumes: - - ./HelmChart:/usr/src/app - # Use node modules of the container and not host system. - # https://stackoverflow.com/questions/29181032/add-a-volume-to-docker-but-exclude-a-sub-folder - - /usr/src/app/node_modules/ - - ./Common:/usr/src/Common - - ./CommonServer:/usr/src/CommonServer - - ./CommonUI:/usr/src/CommonUI - - /usr/src/Common/node_modules/ - - /usr/src/CommonUI/node_modules/ - - /usr/src/CommonServer/node_modules/ + # helmchart: + # ports: + # - '3423:3423' + # build: + # network: host + # context: . + # dockerfile: ./HelmChart/Dockerfile + # env_file: + # - ./Common/.env + # - ./CommonServer/.env + # - ./HelmChart/.env + # environment: *common-variables + # volumes: + # - ./HelmChart:/usr/src/app + # # Use node modules of the container and not host system. + # # https://stackoverflow.com/questions/29181032/add-a-volume-to-docker-but-exclude-a-sub-folder + # - /usr/src/app/node_modules/ + # - ./Common:/usr/src/Common + # - ./CommonServer:/usr/src/CommonServer + # - ./CommonUI:/usr/src/CommonUI + # - /usr/src/Common/node_modules/ + # - /usr/src/CommonUI/node_modules/ + # - /usr/src/CommonServer/node_modules/ - probe-api: - ports: - - '3400:3400' - - '9251:9229' # Debugging port. - build: - network: host - context: . - dockerfile: ./ProbeAPI/Dockerfile.dev - env_file: - - ./Common/.env - - ./CommonServer/.env - - ./ProbeAPI/.env - environment: *common-variables - volumes: - - ./ProbeAPI:/usr/src/app - # Use node modules of the container and not host system. - # https://stackoverflow.com/questions/29181032/add-a-volume-to-docker-but-exclude-a-sub-folder - - /usr/src/app/node_modules/ - - ./Common:/usr/src/Common - - ./CommonServer:/usr/src/CommonServer - - ./CommonUI:/usr/src/CommonUI - - /usr/src/Common/node_modules/ - - /usr/src/CommonUI/node_modules/ - - /usr/src/CommonServer/node_modules/ + # probe-api: + # ports: + # - '3400:3400' + # - '9251:9229' # Debugging port. + # build: + # network: host + # context: . + # dockerfile: ./ProbeAPI/Dockerfile.dev + # env_file: + # - ./Common/.env + # - ./CommonServer/.env + # - ./ProbeAPI/.env + # environment: *common-variables + # volumes: + # - ./ProbeAPI:/usr/src/app + # # Use node modules of the container and not host system. + # # https://stackoverflow.com/questions/29181032/add-a-volume-to-docker-but-exclude-a-sub-folder + # - /usr/src/app/node_modules/ + # - ./Common:/usr/src/Common + # - ./CommonServer:/usr/src/CommonServer + # - ./CommonUI:/usr/src/CommonUI + # - /usr/src/Common/node_modules/ + # - /usr/src/CommonUI/node_modules/ + # - /usr/src/CommonServer/node_modules/ - # There can only be one probe in developer docker compose. - probe: - ports: - - '9238:9229' # Debugging port. - build: - network: host - context: . - dockerfile: ./Probe/Dockerfile.dev - env_file: - - ./Common/.env - - ./CommonServer/.env - - ./Probe/.env - environment: - <<: *common-variables - PROBE_NAME: Probe 1 - PROBE_KEY: test-key - volumes: - - ./Probe:/usr/src/app - # Use node modules of the container and not host system. - # https://stackoverflow.com/questions/29181032/add-a-volume-to-docker-but-exclude-a-sub-folder - - /usr/src/app/node_modules/ - - ./Common:/usr/src/Common - - ./CommonServer:/usr/src/CommonServer - - ./CommonUI:/usr/src/CommonUI - - /usr/src/Common/node_modules/ - - /usr/src/CommonUI/node_modules/ - - /usr/src/CommonServer/node_modules/ + # # There can only be one probe in developer docker compose. + # probe: + # ports: + # - '9238:9229' # Debugging port. + # build: + # network: host + # context: . + # dockerfile: ./Probe/Dockerfile.dev + # env_file: + # - ./Common/.env + # - ./CommonServer/.env + # - ./Probe/.env + # environment: + # <<: *common-variables + # PROBE_NAME: Probe 1 + # PROBE_KEY: test-key + # volumes: + # - ./Probe:/usr/src/app + # # Use node modules of the container and not host system. + # # https://stackoverflow.com/questions/29181032/add-a-volume-to-docker-but-exclude-a-sub-folder + # - /usr/src/app/node_modules/ + # - ./Common:/usr/src/Common + # - ./CommonServer:/usr/src/CommonServer + # - ./CommonUI:/usr/src/CommonUI + # - /usr/src/Common/node_modules/ + # - /usr/src/CommonUI/node_modules/ + # - /usr/src/CommonServer/node_modules/ - api-docs: - ports: - - '1445:1445' - build: - network: host - context: . - dockerfile: ./ApiDocs/Dockerfile.dev - env_file: - - ./Common/.env - - ./CommonServer/.env - - ./ApiDocs/.env - environment: *common-variables - volumes: - - ./ApiDocs:/usr/src/app - # Use node modules of the container and not host system. - # https://stackoverflow.com/questions/29181032/add-a-volume-to-docker-but-exclude-a-sub-folder - - /usr/src/app/node_modules/ - - ./Common:/usr/src/Common - - ./CommonServer:/usr/src/CommonServer - - ./CommonUI:/usr/src/CommonUI - - /usr/src/Common/node_modules/ - - /usr/src/CommonUI/node_modules/ - - /usr/src/CommonServer/node_modules/ + # api-docs: + # ports: + # - '1445:1445' + # build: + # network: host + # context: . + # dockerfile: ./ApiDocs/Dockerfile.dev + # env_file: + # - ./Common/.env + # - ./CommonServer/.env + # - ./ApiDocs/.env + # environment: *common-variables + # volumes: + # - ./ApiDocs:/usr/src/app + # # Use node modules of the container and not host system. + # # https://stackoverflow.com/questions/29181032/add-a-volume-to-docker-but-exclude-a-sub-folder + # - /usr/src/app/node_modules/ + # - ./Common:/usr/src/Common + # - ./CommonServer:/usr/src/CommonServer + # - ./CommonUI:/usr/src/CommonUI + # - /usr/src/Common/node_modules/ + # - /usr/src/CommonUI/node_modules/ + # - /usr/src/CommonServer/node_modules/ - script-runner: - ports: - - '3009:3009' - - '9236:9229' # Debugging port. - build: - network: host - context: . - dockerfile: ./ScriptRunner/Dockerfile.dev - env_file: - - ./Common/.env - - ./CommonServer/.env - - ./ScriptRunner/.env - environment: *common-variables - volumes: - - ./ScriptRunner:/usr/src/app - # Use node modules of the container and not host system. - # https://stackoverflow.com/questions/29181032/add-a-volume-to-docker-but-exclude-a-sub-folder - - /usr/src/app/node_modules/ - - ./Common:/usr/src/Common - - ./CommonServer:/usr/src/CommonServer - - ./CommonUI:/usr/src/CommonUI - - /usr/src/Common/node_modules/ - - /usr/src/CommonUI/node_modules/ - - /usr/src/CommonServer/node_modules/ + # script-runner: + # ports: + # - '3009:3009' + # - '9236:9229' # Debugging port. + # build: + # network: host + # context: . + # dockerfile: ./ScriptRunner/Dockerfile.dev + # env_file: + # - ./Common/.env + # - ./CommonServer/.env + # - ./ScriptRunner/.env + # environment: *common-variables + # volumes: + # - ./ScriptRunner:/usr/src/app + # # Use node modules of the container and not host system. + # # https://stackoverflow.com/questions/29181032/add-a-volume-to-docker-but-exclude-a-sub-folder + # - /usr/src/app/node_modules/ + # - ./Common:/usr/src/Common + # - ./CommonServer:/usr/src/CommonServer + # - ./CommonUI:/usr/src/CommonUI + # - /usr/src/Common/node_modules/ + # - /usr/src/CommonUI/node_modules/ + # - /usr/src/CommonServer/node_modules/ - dashboard-api: - ports: - - '3002:3002' # Service Port. - - '9232:9229' # Debugging port. - build: - network: host - context: . - dockerfile: ./DashboardAPI/Dockerfile.dev - env_file: - - ./Common/.env - - ./CommonServer/.env - - ./DashboardAPI/.env - environment: *common-variables - depends_on: - - redis - volumes: - - ./DashboardAPI:/usr/src/app - # Use node modules of the container and not host system. - # https://stackoverflow.com/questions/29181032/add-a-volume-to-docker-but-exclude-a-sub-folder - - /usr/src/app/node_modules/ - - ./Common:/usr/src/Common - - ./CommonServer:/usr/src/CommonServer - - ./CommonUI:/usr/src/CommonUI - - /usr/src/Common/node_modules/ - - /usr/src/CommonUI/node_modules/ - - /usr/src/CommonServer/node_modules/ + # dashboard-api: + # ports: + # - '3002:3002' # Service Port. + # - '9232:9229' # Debugging port. + # build: + # network: host + # context: . + # dockerfile: ./DashboardAPI/Dockerfile.dev + # env_file: + # - ./Common/.env + # - ./CommonServer/.env + # - ./DashboardAPI/.env + # environment: *common-variables + # depends_on: + # - redis + # volumes: + # - ./DashboardAPI:/usr/src/app + # # Use node modules of the container and not host system. + # # https://stackoverflow.com/questions/29181032/add-a-volume-to-docker-but-exclude-a-sub-folder + # - /usr/src/app/node_modules/ + # - ./Common:/usr/src/Common + # - ./CommonServer:/usr/src/CommonServer + # - ./CommonUI:/usr/src/CommonUI + # - /usr/src/Common/node_modules/ + # - /usr/src/CommonUI/node_modules/ + # - /usr/src/CommonServer/node_modules/ identity: ports: @@ -348,283 +348,283 @@ services: - /usr/src/CommonUI/node_modules/ - /usr/src/CommonServer/node_modules/ - alert: - ports: - - '3088:3088' - - '9133:9229' # Debugging port. - build: - network: host - context: . - dockerfile: ./Alert/Dockerfile.dev - env_file: - - ./Common/.env - - ./CommonServer/.env - - ./Alert/.env - environment: *common-variables - depends_on: - - redis - - postgres - volumes: - - ./Alert:/usr/src/app - # Use node modules of the container and not host system. - # https://stackoverflow.com/questions/29181032/add-a-volume-to-docker-but-exclude-a-sub-folder - - /usr/src/app/node_modules/ - - ./Common:/usr/src/Common - - ./CommonServer:/usr/src/CommonServer - - ./CommonUI:/usr/src/CommonUI - - /usr/src/Common/node_modules/ - - /usr/src/CommonUI/node_modules/ - - /usr/src/CommonServer/node_modules/ + # alert: + # ports: + # - '3088:3088' + # - '9133:9229' # Debugging port. + # build: + # network: host + # context: . + # dockerfile: ./Alert/Dockerfile.dev + # env_file: + # - ./Common/.env + # - ./CommonServer/.env + # - ./Alert/.env + # environment: *common-variables + # depends_on: + # - redis + # - postgres + # volumes: + # - ./Alert:/usr/src/app + # # Use node modules of the container and not host system. + # # https://stackoverflow.com/questions/29181032/add-a-volume-to-docker-but-exclude-a-sub-folder + # - /usr/src/app/node_modules/ + # - ./Common:/usr/src/Common + # - ./CommonServer:/usr/src/CommonServer + # - ./CommonUI:/usr/src/CommonUI + # - /usr/src/Common/node_modules/ + # - /usr/src/CommonUI/node_modules/ + # - /usr/src/CommonServer/node_modules/ - integration: - ports: - - '3089:3089' - - '9134:9229' # Debugging port. - build: - network: host - context: . - dockerfile: ./Integration/Dockerfile.dev - env_file: - - ./Common/.env - - ./CommonServer/.env - - ./Integration/.env - environment: *common-variables - depends_on: - - redis - - postgres - volumes: - - ./Integration:/usr/src/app - # Use node modules of the container and not host system. - # https://stackoverflow.com/questions/29181032/add-a-volume-to-docker-but-exclude-a-sub-folder - - /usr/src/app/node_modules/ - - ./Common:/usr/src/Common - - ./CommonServer:/usr/src/CommonServer - - ./CommonUI:/usr/src/CommonUI - - /usr/src/Common/node_modules/ - - /usr/src/CommonUI/node_modules/ - - /usr/src/CommonServer/node_modules/ + # integration: + # ports: + # - '3089:3089' + # - '9134:9229' # Debugging port. + # build: + # network: host + # context: . + # dockerfile: ./Integration/Dockerfile.dev + # env_file: + # - ./Common/.env + # - ./CommonServer/.env + # - ./Integration/.env + # environment: *common-variables + # depends_on: + # - redis + # - postgres + # volumes: + # - ./Integration:/usr/src/app + # # Use node modules of the container and not host system. + # # https://stackoverflow.com/questions/29181032/add-a-volume-to-docker-but-exclude-a-sub-folder + # - /usr/src/app/node_modules/ + # - ./Common:/usr/src/Common + # - ./CommonServer:/usr/src/CommonServer + # - ./CommonUI:/usr/src/CommonUI + # - /usr/src/Common/node_modules/ + # - /usr/src/CommonUI/node_modules/ + # - /usr/src/CommonServer/node_modules/ - dashboard: - ports: - - '3000:3000' - build: - network: host - context: . - dockerfile: ./dashboard/Dockerfile.dev - env_file: - - ./Common/.env - - ./CommonUI/.env - - ./Dashboard/.env - environment: *common-variables - volumes: - - ./Dashboard:/usr/src/app - # Use node modules of the container and not host system. - # https://stackoverflow.com/questions/29181032/add-a-volume-to-docker-but-exclude-a-sub-folder - - /usr/src/app/node_modules/ - - ./Common:/usr/src/Common - - ./CommonServer:/usr/src/CommonServer - - ./CommonUI:/usr/src/CommonUI - - /usr/src/Common/node_modules/ - - /usr/src/CommonUI/node_modules/ - - /usr/src/CommonServer/node_modules/ + # dashboard: + # ports: + # - '3000:3000' + # build: + # network: host + # context: . + # dockerfile: ./dashboard/Dockerfile.dev + # env_file: + # - ./Common/.env + # - ./CommonUI/.env + # - ./Dashboard/.env + # environment: *common-variables + # volumes: + # - ./Dashboard:/usr/src/app + # # Use node modules of the container and not host system. + # # https://stackoverflow.com/questions/29181032/add-a-volume-to-docker-but-exclude-a-sub-folder + # - /usr/src/app/node_modules/ + # - ./Common:/usr/src/Common + # - ./CommonServer:/usr/src/CommonServer + # - ./CommonUI:/usr/src/CommonUI + # - /usr/src/Common/node_modules/ + # - /usr/src/CommonUI/node_modules/ + # - /usr/src/CommonServer/node_modules/ - home: - ports: - - '1444:1444' - - '9235:9229' # Debugging port. - env_file: - - ./Common/.env - - ./CommonServer/.env - - ./Home/.env - environment: *common-variables - build: - network: host - context: . - dockerfile: ./Home/Dockerfile.dev - volumes: - - ./Home:/usr/src/app - # Use node modules of the container and not host system. - # https://stackoverflow.com/questions/29181032/add-a-volume-to-docker-but-exclude-a-sub-folder - - /usr/src/app/node_modules/ - - ./Common:/usr/src/Common - - ./CommonServer:/usr/src/CommonServer - - ./CommonUI:/usr/src/CommonUI - - /usr/src/Common/node_modules/ - - /usr/src/CommonUI/node_modules/ - - /usr/src/CommonServer/node_modules/ + # home: + # ports: + # - '1444:1444' + # - '9235:9229' # Debugging port. + # env_file: + # - ./Common/.env + # - ./CommonServer/.env + # - ./Home/.env + # environment: *common-variables + # build: + # network: host + # context: . + # dockerfile: ./Home/Dockerfile.dev + # volumes: + # - ./Home:/usr/src/app + # # Use node modules of the container and not host system. + # # https://stackoverflow.com/questions/29181032/add-a-volume-to-docker-but-exclude-a-sub-folder + # - /usr/src/app/node_modules/ + # - ./Common:/usr/src/Common + # - ./CommonServer:/usr/src/CommonServer + # - ./CommonUI:/usr/src/CommonUI + # - /usr/src/Common/node_modules/ + # - /usr/src/CommonUI/node_modules/ + # - /usr/src/CommonServer/node_modules/ - status-page: - ports: - - '3006:3006' - build: - network: host - context: . - dockerfile: ./StatusPage/Dockerfile.dev - env_file: - - ./Common/.env - - ./CommonUI/.env - - ./StatusPage/.env - environment: *common-variables - volumes: - - ./StatusPage:/usr/src/app - # Use node modules of the container and not host system. - # https://stackoverflow.com/questions/29181032/add-a-volume-to-docker-but-exclude-a-sub-folder - - /usr/src/app/node_modules/ - - ./Common:/usr/src/Common - - ./CommonServer:/usr/src/CommonServer - - ./CommonUI:/usr/src/CommonUI - - /usr/src/Common/node_modules/ - - /usr/src/CommonUI/node_modules/ - - /usr/src/CommonServer/node_modules/ + # status-page: + # ports: + # - '3006:3006' + # build: + # network: host + # context: . + # dockerfile: ./StatusPage/Dockerfile.dev + # env_file: + # - ./Common/.env + # - ./CommonUI/.env + # - ./StatusPage/.env + # environment: *common-variables + # volumes: + # - ./StatusPage:/usr/src/app + # # Use node modules of the container and not host system. + # # https://stackoverflow.com/questions/29181032/add-a-volume-to-docker-but-exclude-a-sub-folder + # - /usr/src/app/node_modules/ + # - ./Common:/usr/src/Common + # - ./CommonServer:/usr/src/CommonServer + # - ./CommonUI:/usr/src/CommonUI + # - /usr/src/Common/node_modules/ + # - /usr/src/CommonUI/node_modules/ + # - /usr/src/CommonServer/node_modules/ - admin-dashboard: - ports: - - '3100:3100' - build: - network: host - context: . - dockerfile: ./AdminDashboard/Dockerfile.dev - env_file: - - ./Common/.env - - ./CommonUI/.env - - ./AdminDashboard/.env - environment: *common-variables - volumes: - - ./AdminDashboard:/usr/src/app - # Use node modules of the container and not host system. - # https://stackoverflow.com/questions/29181032/add-a-volume-to-docker-but-exclude-a-sub-folder - - /usr/src/app/node_modules/ - - ./Common:/usr/src/Common - - ./CommonServer:/usr/src/CommonServer - - ./CommonUI:/usr/src/CommonUI - - /usr/src/Common/node_modules/ - - /usr/src/CommonUI/node_modules/ - - /usr/src/CommonServer/node_modules/ + # admin-dashboard: + # ports: + # - '3100:3100' + # build: + # network: host + # context: . + # dockerfile: ./AdminDashboard/Dockerfile.dev + # env_file: + # - ./Common/.env + # - ./CommonUI/.env + # - ./AdminDashboard/.env + # environment: *common-variables + # volumes: + # - ./AdminDashboard:/usr/src/app + # # Use node modules of the container and not host system. + # # https://stackoverflow.com/questions/29181032/add-a-volume-to-docker-but-exclude-a-sub-folder + # - /usr/src/app/node_modules/ + # - ./Common:/usr/src/Common + # - ./CommonServer:/usr/src/CommonServer + # - ./CommonUI:/usr/src/CommonUI + # - /usr/src/Common/node_modules/ + # - /usr/src/CommonUI/node_modules/ + # - /usr/src/CommonServer/node_modules/ - http-test-server: - ports: - - '3010:3010' - - '9234:9229' # Debugging port. - env_file: - - ./Common/.env - - ./CommonUI/.env - - ./HttpTestServer/.env - environment: *common-variables - build: - network: host - context: . - dockerfile: ./HTTPTestServer/Dockerfile.dev - volumes: - - ./HttpTestServer:/usr/src/app - # Use node modules of the container and not host system. - # https://stackoverflow.com/questions/29181032/add-a-volume-to-docker-but-exclude-a-sub-folder - - /usr/src/app/node_modules/ - - ./Common:/usr/src/Common - - ./CommonServer:/usr/src/CommonServer - - ./CommonUI:/usr/src/CommonUI - - /usr/src/Common/node_modules/ - - /usr/src/CommonUI/node_modules/ - - /usr/src/CommonServer/node_modules/ + # http-test-server: + # ports: + # - '3010:3010' + # - '9234:9229' # Debugging port. + # env_file: + # - ./Common/.env + # - ./CommonUI/.env + # - ./HttpTestServer/.env + # environment: *common-variables + # build: + # network: host + # context: . + # dockerfile: ./HTTPTestServer/Dockerfile.dev + # volumes: + # - ./HttpTestServer:/usr/src/app + # # Use node modules of the container and not host system. + # # https://stackoverflow.com/questions/29181032/add-a-volume-to-docker-but-exclude-a-sub-folder + # - /usr/src/app/node_modules/ + # - ./Common:/usr/src/Common + # - ./CommonServer:/usr/src/CommonServer + # - ./CommonUI:/usr/src/CommonUI + # - /usr/src/Common/node_modules/ + # - /usr/src/CommonUI/node_modules/ + # - /usr/src/CommonServer/node_modules/ - licensing: - ports: - - '3004:3004' - - '9233:9229' # Debugging port. - env_file: - - ./Common/.env - - ./CommonServer/.env - - ./Licensing/.env - environment: *common-variables - build: - network: host - context: . - dockerfile: ./Licensing/Dockerfile.dev - volumes: - - ./Licensing:/usr/src/app - # Use node modules of the container and not host system. - # https://stackoverflow.com/questions/29181032/add-a-volume-to-docker-but-exclude-a-sub-folder - - /usr/src/app/node_modules/ - - ./Common:/usr/src/Common - - ./CommonServer:/usr/src/CommonServer - - ./CommonUI:/usr/src/CommonUI - - /usr/src/Common/node_modules/ - - /usr/src/CommonUI/node_modules/ - - /usr/src/CommonServer/node_modules/ + # licensing: + # ports: + # - '3004:3004' + # - '9233:9229' # Debugging port. + # env_file: + # - ./Common/.env + # - ./CommonServer/.env + # - ./Licensing/.env + # environment: *common-variables + # build: + # network: host + # context: . + # dockerfile: ./Licensing/Dockerfile.dev + # volumes: + # - ./Licensing:/usr/src/app + # # Use node modules of the container and not host system. + # # https://stackoverflow.com/questions/29181032/add-a-volume-to-docker-but-exclude-a-sub-folder + # - /usr/src/app/node_modules/ + # - ./Common:/usr/src/Common + # - ./CommonServer:/usr/src/CommonServer + # - ./CommonUI:/usr/src/CommonUI + # - /usr/src/Common/node_modules/ + # - /usr/src/CommonUI/node_modules/ + # - /usr/src/CommonServer/node_modules/ - application-scanner: - ports: - - '3005:3005' - - '9240:9229' # Debugging port. - build: - network: host - context: . - dockerfile: ./ApplicationScanner/Dockerfile.dev - env_file: - - ./Common/.env - - ./CommonServer/.env - - ./ApplicationScanner/.env - environment: *common-variables - volumes: - - ./ApplicationScanner:/usr/src/app - # Use node modules of the container and not host system. - # https://stackoverflow.com/questions/29181032/add-a-volume-to-docker-but-exclude-a-sub-folder - - /usr/src/app/node_modules/ - - ./Common:/usr/src/Common - - ./CommonServer:/usr/src/CommonServer - - ./CommonUI:/usr/src/CommonUI - - /usr/src/Common/node_modules/ - - /usr/src/CommonUI/node_modules/ - - /usr/src/CommonServer/node_modules/ + # application-scanner: + # ports: + # - '3005:3005' + # - '9240:9229' # Debugging port. + # build: + # network: host + # context: . + # dockerfile: ./ApplicationScanner/Dockerfile.dev + # env_file: + # - ./Common/.env + # - ./CommonServer/.env + # - ./ApplicationScanner/.env + # environment: *common-variables + # volumes: + # - ./ApplicationScanner:/usr/src/app + # # Use node modules of the container and not host system. + # # https://stackoverflow.com/questions/29181032/add-a-volume-to-docker-but-exclude-a-sub-folder + # - /usr/src/app/node_modules/ + # - ./Common:/usr/src/Common + # - ./CommonServer:/usr/src/CommonServer + # - ./CommonUI:/usr/src/CommonUI + # - /usr/src/Common/node_modules/ + # - /usr/src/CommonUI/node_modules/ + # - /usr/src/CommonServer/node_modules/ - container-scanner: - ports: - - '3055:3055' - - '9242:9229' # Debugging port. - build: - network: host - context: . - dockerfile: ./ContainerScanner/Dockerfile.dev - env_file: - - ./Common/.env - - ./CommonServer/.env - - ./ContainerScanner/.env - environment: *common-variables - volumes: - - ./ContainerScanner:/usr/src/app - # Use node modules of the container and not host system. - # https://stackoverflow.com/questions/29181032/add-a-volume-to-docker-but-exclude-a-sub-folder - - /usr/src/app/node_modules/ - - ./Common:/usr/src/Common - - ./CommonServer:/usr/src/CommonServer - - ./CommonUI:/usr/src/CommonUI - - /usr/src/Common/node_modules/ - - /usr/src/CommonUI/node_modules/ - - /usr/src/CommonServer/node_modules/ + # container-scanner: + # ports: + # - '3055:3055' + # - '9242:9229' # Debugging port. + # build: + # network: host + # context: . + # dockerfile: ./ContainerScanner/Dockerfile.dev + # env_file: + # - ./Common/.env + # - ./CommonServer/.env + # - ./ContainerScanner/.env + # environment: *common-variables + # volumes: + # - ./ContainerScanner:/usr/src/app + # # Use node modules of the container and not host system. + # # https://stackoverflow.com/questions/29181032/add-a-volume-to-docker-but-exclude-a-sub-folder + # - /usr/src/app/node_modules/ + # - ./Common:/usr/src/Common + # - ./CommonServer:/usr/src/CommonServer + # - ./CommonUI:/usr/src/CommonUI + # - /usr/src/Common/node_modules/ + # - /usr/src/CommonUI/node_modules/ + # - /usr/src/CommonServer/node_modules/ - lighthouse-runner: - ports: - - '3015:3015' - - '9241:9229' # Debugging port. - build: - network: host - context: . - dockerfile: ./LighthouseRunner/Dockerfile.dev - env_file: - - ./Common/.env - - ./CommonServer/.env - - ./LighthouseRunner/.env - environment: *common-variables - volumes: - - ./LighthouseRunner:/usr/src/app - # Use node modules of the container and not host system. - # https://stackoverflow.com/questions/29181032/add-a-volume-to-docker-but-exclude-a-sub-folder - - /usr/src/app/node_modules/ - - ./Common:/usr/src/Common - - ./CommonServer:/usr/src/CommonServer - - ./CommonUI:/usr/src/CommonUI - - /usr/src/Common/node_modules/ - - /usr/src/CommonUI/node_modules/ - - /usr/src/CommonServer/node_modules/ + # lighthouse-runner: + # ports: + # - '3015:3015' + # - '9241:9229' # Debugging port. + # build: + # network: host + # context: . + # dockerfile: ./LighthouseRunner/Dockerfile.dev + # env_file: + # - ./Common/.env + # - ./CommonServer/.env + # - ./LighthouseRunner/.env + # environment: *common-variables + # volumes: + # - ./LighthouseRunner:/usr/src/app + # # Use node modules of the container and not host system. + # # https://stackoverflow.com/questions/29181032/add-a-volume-to-docker-but-exclude-a-sub-folder + # - /usr/src/app/node_modules/ + # - ./Common:/usr/src/Common + # - ./CommonServer:/usr/src/CommonServer + # - ./CommonUI:/usr/src/CommonUI + # - /usr/src/Common/node_modules/ + # - /usr/src/CommonUI/node_modules/ + # - /usr/src/CommonServer/node_modules/ nginx: depends_on: - identity