Skip to content

Commit

Permalink
feat: upgrade to node LTS v16 (#302)
Browse files Browse the repository at this point in the history
feat(mojaloop/#2767): upgrade nodeJS version for quoting-service - mojaloop/project#2767

standardised CI scripts, however, the test-integration CI job needed minor tweaks to work with the quoting-service's implementation
updated docker-compose files to work correctly
added wait-4-docker npm script
fixed lint issues
updated .nvmrc to latest LTS version
added standard CI scripts/config to package.json: release, snapshot, standard-version, etc
updated gitignore to include test/results and IGNORE patterns
updated README with standard auto-release information
Fixed imports
Cleaned up Package.json
Removed unnecessary dependencies
Removed unnecessary files
Notes:

Helm chart mountPaths need to be updated from /opt/quoting-service to /opt/app as follows:
    volumeMounts:
    - mountPath: /opt/app/config
      name: <deployment-name>
BREAKING CHANGE: Major version bump for node v16 LTS support, re-structuring of project directories to align to core Mojaloop repositories and docker image now uses /opt/app instead of /opt/quoting-service which will impact config mounts.
  • Loading branch information
gibaros authored Jun 9, 2022
1 parent 3e8d9ad commit bc11b7c
Show file tree
Hide file tree
Showing 12 changed files with 21,381 additions and 7,390 deletions.
511 changes: 385 additions & 126 deletions .circleci/config.yml

Large diffs are not rendered by default.

6 changes: 0 additions & 6 deletions .ncurc.json

This file was deleted.

5 changes: 5 additions & 0 deletions .ncurc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
## 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: [
"json-rules-engine",
"eslint"
]
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
16.15.0
30 changes: 16 additions & 14 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,36 +1,38 @@
FROM node:12.16.1-alpine as builder
FROM node:16.15.0-alpine as builder
USER root

WORKDIR /opt/quoting-service
WORKDIR /opt/app

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

COPY package.json package-lock.json* /opt/quoting-service/
COPY package.json package-lock.json* /opt/app/

RUN npm install
RUN npm ci

RUN apk del build-dependencies

COPY config /opt/quoting-service/config
COPY src /opt/quoting-service/src
COPY src /opt/app/src
COPY config /opt/app/config

FROM node:12.16.1-alpine
FROM node:16.15.0-alpine

WORKDIR /opt/quoting-service
WORKDIR /opt/app

# Create empty log file & link stdout to the application log file
RUN mkdir ./logs && touch ./logs/combined.log
# Links combined to stdout
RUN ln -sf /dev/stdout ./logs/combined.log

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

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

EXPOSE 3002
CMD ["npm", "run", "start"]
CMD ["npm", "start"]
50 changes: 50 additions & 0 deletions audit-resolve.json
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,56 @@
"decision": "ignore",
"madeAt": 1646392187792,
"expiresAt": 1648984175470
},
"1070449|@mojaloop/central-services-shared>@mojaloop/event-sdk>grpc>protobufjs": {
"decision": "ignore",
"madeAt": 1654706006773,
"expiresAt": 1657297987895
},
"1070449|@mojaloop/event-sdk>grpc>protobufjs": {
"decision": "ignore",
"madeAt": 1654706006773,
"expiresAt": 1657297987895
},
"1070030|@mojaloop/central-services-shared>@mojaloop/event-sdk>grpc>protobufjs>widdershins>markdown-it": {
"decision": "ignore",
"madeAt": 1654706022493,
"expiresAt": 1657297987895
},
"1070030|shins>markdown-it": {
"decision": "ignore",
"madeAt": 1654706022493,
"expiresAt": 1657297987895
},
"1068310|@mojaloop/central-services-shared>@mojaloop/event-sdk>grpc>protobufjs>widdershins>markdown-it>yargs>yargs-parser": {
"decision": "ignore",
"madeAt": 1654706029847,
"expiresAt": 1657297987895
},
"1070412|ejs": {
"decision": "ignore",
"madeAt": 1654706033457,
"expiresAt": 1657297987895
},
"1068155|shins>markdown-it>sanitize-html": {
"decision": "ignore",
"madeAt": 1654706037747,
"expiresAt": 1657297987895
},
"1070260|shins>markdown-it>sanitize-html": {
"decision": "ignore",
"madeAt": 1654706041235,
"expiresAt": 1657297987895
},
"1067553|swagger2openapi>better-ajv-errors>jsonpointer": {
"decision": "ignore",
"madeAt": 1654706044130,
"expiresAt": 1657297987895
},
"1067946|swagger2openapi>better-ajv-errors>jsonpointer>oas-validator>ajv": {
"decision": "ignore",
"madeAt": 1654706048509,
"expiresAt": 1657297987895
}
},
"rules": {},
Expand Down
4 changes: 2 additions & 2 deletions docker-compose.base.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,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
environment:
- CLEDG_DATABASE_URI=mysql://central_ledger:password@mysql:3306/central_ledger
- CLEDG_SIDECAR__DISABLED=true
Expand All @@ -25,7 +25,7 @@ services:
- "3000:3000"
volumes:
# override the default values with our own - this is because the KAFKA_HOST env variable is ignored for some reason
- ./docker/ml-api-adapter/default.json:/opt/ml-api-adapter/config/default.json
- ./docker/ml-api-adapter/default.json:/opt/app/config/default.json

# TODO: we should be able to remove this - I think the image command is broken
command:
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ services:
environment:
- CSL_LOG_TRANSPORT=file
volumes:
- ./docker/quoting-service/default.json:/opt/quoting-service/config/default.json
- ./docker/quoting-service/default.json:/opt/app/config/default.json
Loading

0 comments on commit bc11b7c

Please sign in to comment.