Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat!: upgrade ci, image, packages, audit #381

Merged
merged 16 commits into from
Jul 15, 2022
471 changes: 383 additions & 88 deletions .circleci/config.yml

Large diffs are not rendered by default.

2 changes: 0 additions & 2 deletions .eslintignore

This file was deleted.

24 changes: 0 additions & 24 deletions .eslintrc

This file was deleted.

7 changes: 7 additions & 0 deletions .ncurc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
## Add a TODO comment indicating the reason for each rejected dependency upgrade added to this list, and what should be done to resolve it (i.e. handle it through a story, etc).
reject: [
# TODO: v6+ (ref: https://github.com/sindresorhus/get-port/releases/tag/v6.0.0) is an ESM library and thus not compatible with CommonJS. Future story needed to resolve.
"get-port",
# @hapi/catbox-memory v6 and onwards breaks tests. Needs investigation.
"@hapi/catbox-memory"
]
4 changes: 0 additions & 4 deletions .ncurc.yml

This file was deleted.

1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
16.15.0
43 changes: 22 additions & 21 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,32 +1,33 @@
FROM node:12.16.1-alpine as builder
FROM node:16.15.0-alpine as builder
USER root

WORKDIR /opt/central-settlement
WORKDIR /opt/app/

RUN apk add --no-cache -t build-dependencies git make gcc g++ python libtool autoconf automake \
RUN apk add --no-cache -t build-dependencies git make gcc g++ python3 libtool autoconf automake \
&& cd $(npm root -g)/npm \
&& npm config set unsafe-perm true
&& npm config set unsafe-perm true \
&& npm install -g node-gyp

COPY package.json package-lock.json* /opt/central-settlement/
COPY package.json package-lock.json* /opt/app/
RUN npm ci

RUN npm install
COPY config /opt/app/config
COPY scripts /opt/app/scripts
COPY src /opt/app/src
COPY README.md /opt/app

COPY config /opt/central-settlement/config
COPY scripts /opt/central-settlement/scripts
COPY src /opt/central-settlement/src
COPY README.md /opt/central-settlement

FROM builder
WORKDIR /opt/central-settlement
FROM node:16.15.0-alpine
WORKDIR /opt/app/

# Create empty log file & link stdout to the application log file
RUN mkdir ./logs && touch ./logs/combined.log \
&& ln -sf /dev/stdout ./logs/combined.log \
&& adduser -D ml-user
# Create a non-root user: ml-user
# RUN adduser -D ml-user
USER ml-user

COPY --chown=ml-user --from=builder /opt/central-settlement .
RUN mkdir ./logs && touch ./logs/combined.log
RUN ln -sf /dev/stdout ./logs/combined.log

# Create a non-root user: app-user
RUN adduser -D app-user
USER app-user

COPY --chown=app-user --from=builder /opt/app/ .
RUN npm prune --production

EXPOSE 3007
Expand Down
175 changes: 175 additions & 0 deletions audit-resolve.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,181 @@
"decision": "ignore",
"madeAt": 1628084074530,
"expiresAt": 1628688867371
},
"1075703|@mojaloop/central-ledger>@mojaloop/central-services-shared>@mojaloop/event-sdk>grpc>protobufjs": {
"decision": "ignore",
"madeAt": 1657629687346,
"expiresAt": 1660221683913
},
"1075703|@mojaloop/central-services-shared>@mojaloop/event-sdk>grpc>protobufjs": {
"decision": "ignore",
"madeAt": 1657629687346,
"expiresAt": 1660221683913
},
"1075703|@mojaloop/event-sdk>grpc>protobufjs": {
"decision": "ignore",
"madeAt": 1657629687346,
"expiresAt": 1660221683913
},
"1075704|@mojaloop/central-ledger>@mojaloop/central-services-shared>@mojaloop/event-sdk>grpc>protobufjs": {
"decision": "ignore",
"madeAt": 1657629688409,
"expiresAt": 1660221683913
},
"1075704|@mojaloop/central-services-shared>@mojaloop/event-sdk>grpc>protobufjs": {
"decision": "ignore",
"madeAt": 1657629688409,
"expiresAt": 1660221683913
},
"1075704|@mojaloop/event-sdk>grpc>protobufjs": {
"decision": "ignore",
"madeAt": 1657629688409,
"expiresAt": 1660221683913
},
"1081008|@mojaloop/central-ledger>@mojaloop/central-services-shared>@mojaloop/event-sdk>grpc>protobufjs>moment": {
"decision": "ignore",
"madeAt": 1657629689277,
"expiresAt": 1660221683913
},
"1081008|@mojaloop/central-services-shared>@mojaloop/event-sdk>grpc>protobufjs>moment": {
"decision": "ignore",
"madeAt": 1657629689277,
"expiresAt": 1660221683913
},
"1081008|@mojaloop/event-sdk>grpc>protobufjs>moment": {
"decision": "ignore",
"madeAt": 1657629689277,
"expiresAt": 1660221683913
},
"1070030|@mojaloop/central-ledger>@mojaloop/central-services-shared>@mojaloop/event-sdk>grpc>protobufjs>moment>shins>markdown-it": {
"decision": "ignore",
"madeAt": 1657629690392,
"expiresAt": 1660221683913
},
"1070030|@mojaloop/central-services-shared>@mojaloop/event-sdk>grpc>protobufjs>moment>shins>markdown-it": {
"decision": "ignore",
"madeAt": 1657629690392,
"expiresAt": 1660221683913
},
"1070030|widdershins>markdown-it": {
"decision": "ignore",
"madeAt": 1657629690392,
"expiresAt": 1660221683913
},
"1068155|@mojaloop/central-ledger>@mojaloop/central-services-shared>@mojaloop/event-sdk>grpc>protobufjs>moment>shins>markdown-it>sanitize-html": {
"decision": "ignore",
"madeAt": 1657629691438,
"expiresAt": 1660221683913
},
"1068155|@mojaloop/central-services-shared>@mojaloop/event-sdk>grpc>protobufjs>moment>shins>markdown-it>sanitize-html": {
"decision": "ignore",
"madeAt": 1657629691438,
"expiresAt": 1660221683913
},
"1070260|@mojaloop/central-ledger>@mojaloop/central-services-shared>@mojaloop/event-sdk>grpc>protobufjs>moment>shins>markdown-it>sanitize-html": {
"decision": "ignore",
"madeAt": 1657629692694,
"expiresAt": 1660221683913
},
"1070260|@mojaloop/central-services-shared>@mojaloop/event-sdk>grpc>protobufjs>moment>shins>markdown-it>sanitize-html": {
"decision": "ignore",
"madeAt": 1657629692694,
"expiresAt": 1660221683913
},
"1068386|@mojaloop/central-ledger>@mojaloop/central-services-shared>@mojaloop/event-sdk>grpc>protobufjs>moment>shins>markdown-it>sanitize-html>hapi-auth-basic>hapi": {
"decision": "ignore",
"madeAt": 1657629693729,
"expiresAt": 1660221683913
},
"1068399|@mojaloop/central-ledger>@mojaloop/central-services-shared>@mojaloop/event-sdk>grpc>protobufjs>moment>shins>markdown-it>sanitize-html>hapi-auth-basic>hapi>ammo": {
"decision": "ignore",
"madeAt": 1657629694728,
"expiresAt": 1660221683913
},
"1068389|@mojaloop/central-ledger>@mojaloop/central-services-shared>@mojaloop/event-sdk>grpc>protobufjs>moment>shins>markdown-it>sanitize-html>hapi-auth-basic>hapi>ammo>subtext": {
"decision": "ignore",
"madeAt": 1657629695680,
"expiresAt": 1660221683913
},
"1068390|@mojaloop/central-ledger>@mojaloop/central-services-shared>@mojaloop/event-sdk>grpc>protobufjs>moment>shins>markdown-it>sanitize-html>hapi-auth-basic>hapi>ammo>subtext": {
"decision": "ignore",
"madeAt": 1657629696657,
"expiresAt": 1660221683913
},
"1070412|ejs": {
"decision": "ignore",
"madeAt": 1657629697573,
"expiresAt": 1660221683913
},
"1067553|swagger2openapi>better-ajv-errors>jsonpointer": {
"decision": "ignore",
"madeAt": 1657629698480,
"expiresAt": 1660221683913
},
"1067946|swagger2openapi>better-ajv-errors>jsonpointer>oas-validator>ajv": {
"decision": "ignore",
"madeAt": 1657629699455,
"expiresAt": 1660221683913
},
"1068310|widdershins>markdown-it>yargs>yargs-parser": {
"decision": "ignore",
"madeAt": 1657629700477,
"expiresAt": 1660221683913
},
"1070030|@mojaloop/central-ledger>@mojaloop/central-services-shared>@mojaloop/event-sdk>grpc>protobufjs>moment>widdershins>markdown-it": {
"decision": "ignore",
"madeAt": 1657636901888,
"expiresAt": 1660228897171
},
"1070030|@mojaloop/central-services-shared>@mojaloop/event-sdk>grpc>protobufjs>moment>widdershins>markdown-it": {
"decision": "ignore",
"madeAt": 1657636901888,
"expiresAt": 1660228897171
},
"1070030|shins>markdown-it": {
"decision": "ignore",
"madeAt": 1657636901888,
"expiresAt": 1660228897171
},
"1068310|@mojaloop/central-ledger>@mojaloop/central-services-shared>@mojaloop/event-sdk>grpc>protobufjs>moment>widdershins>markdown-it>yargs>yargs-parser": {
"decision": "ignore",
"madeAt": 1657636902724,
"expiresAt": 1660228897171
},
"1068310|@mojaloop/central-services-shared>@mojaloop/event-sdk>grpc>protobufjs>moment>widdershins>markdown-it>yargs>yargs-parser": {
"decision": "ignore",
"madeAt": 1657636902724,
"expiresAt": 1660228897171
},
"1068386|@mojaloop/central-ledger>@mojaloop/central-services-shared>@mojaloop/event-sdk>grpc>protobufjs>moment>widdershins>markdown-it>yargs>yargs-parser>hapi-auth-basic>hapi": {
"decision": "ignore",
"madeAt": 1657636903526,
"expiresAt": 1660228897171
},
"1068399|@mojaloop/central-ledger>@mojaloop/central-services-shared>@mojaloop/event-sdk>grpc>protobufjs>moment>widdershins>markdown-it>yargs>yargs-parser>hapi-auth-basic>hapi>ammo": {
"decision": "ignore",
"madeAt": 1657636904398,
"expiresAt": 1660228897171
},
"1068389|@mojaloop/central-ledger>@mojaloop/central-services-shared>@mojaloop/event-sdk>grpc>protobufjs>moment>widdershins>markdown-it>yargs>yargs-parser>hapi-auth-basic>hapi>ammo>subtext": {
"decision": "ignore",
"madeAt": 1657636905230,
"expiresAt": 1660228897171
},
"1068390|@mojaloop/central-ledger>@mojaloop/central-services-shared>@mojaloop/event-sdk>grpc>protobufjs>moment>widdershins>markdown-it>yargs>yargs-parser>hapi-auth-basic>hapi>ammo>subtext": {
"decision": "ignore",
"madeAt": 1657636906169,
"expiresAt": 1660228897171
},
"1068155|shins>markdown-it>sanitize-html": {
"decision": "ignore",
"madeAt": 1657636907134,
"expiresAt": 1660228897171
},
"1070260|shins>markdown-it>sanitize-html": {
"decision": "ignore",
"madeAt": 1657636908087,
"expiresAt": 1660228897171
}
},
"rules": {},
Expand Down
18 changes: 9 additions & 9 deletions docker-compose.integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ services:
build:
dockerfile: test-integration.Dockerfile
context: .
cache_from:
cache_from:
- mojaloop/central-settlement
- central-settlement:test
container_name: cs_central-settlement
Expand All @@ -17,9 +17,9 @@ services:
ports:
- "3007:3007"
volumes:
- ./docker/central-settlement/default.json:/opt/central-settlement/config/default.json
- ./test:/opt/central-settlement/test
- ./src:/opt/central-settlement/src
- ./docker/central-settlement/default.json:/opt/app/config/default.json
- ./test:/opt/app/test
- ./src:/opt/app/src
environment:
- CENTRAL_LEDGER_HOST=central-ledger
- ML_API_ADAPTER_HOST=ml-api-adapter
Expand All @@ -29,12 +29,12 @@ services:
- TRANSFERS_FULFILMENT=XoSz1cL0tljJSCp_VtIYmPNw-zFUgGfbUqf69AagUzY
- TRANSFERS_CONDITION=HOr22-H3AfTDHrSkPjJtVPRdKouuMkDXTR4ejlQa8Ks
command:
- tail
- -f
- tail
- -f
- /dev/null

central-ledger:
image: mojaloop/central-ledger:latest # mojaloop/central-ledger:latest #
image: mojaloop/central-ledger:latest # mojaloop/central-ledger:latest #
container_name: central-ledger-int
command:
- "sh"
Expand All @@ -49,7 +49,7 @@ services:
ports:
- "3001:3001"
volumes:
- ./docker/central-ledger/default.json:/opt/central-ledger/config/default.json
- ./docker/central-ledger/default.json:/opt/app/config/default.json
- ./docker/wait-for:/opt/wait-for

ml-api-adapter:
Expand All @@ -68,7 +68,7 @@ services:
ports:
- "3000:3000"
volumes:
- ./docker/ml-api-adapter/default.json:/opt/ml-api-adapter/config/default.json
- ./docker/ml-api-adapter/default.json:/opt/app/config/default.json
- ./docker/wait-for:/opt/wait-for

mysql:
Expand Down
6 changes: 3 additions & 3 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ services:
ports:
- "3007:3007"
volumes:
- ./docker/central-settlement/default.json:/opt/central-settlement/config/default.json
- ./docker/central-settlement/default.json:/opt/app/config/default.json
- ./docker/wait-for:/opt/wait-for

central-ledger:
Expand All @@ -40,7 +40,7 @@ services:
ports:
- "3001:3001"
volumes:
- ./docker/central-ledger/default.json:/opt/central-ledger/config/default.json
- ./docker/central-ledger/default.json:/opt/app/config/default.json
- ./docker/wait-for:/opt/wait-for

ml-api-adapter:
Expand All @@ -59,7 +59,7 @@ services:
ports:
- "3000:3000"
volumes:
- ./docker/ml-api-adapter/default.json:/opt/ml-api-adapter/config/default.json
- ./docker/ml-api-adapter/default.json:/opt/app/config/default.json
- ./docker/wait-for:/opt/wait-for

mysql:
Expand Down
Loading