Skip to content

Commit

Permalink
feat!: upgrade ci, image, packages, audit (#145)
Browse files Browse the repository at this point in the history
* feat!: upgrade ci, image, packages, audit

* chore: ci

* chore: ignore

* chore: nvm ncu

* chore: ci

* chore: remove internal libs

* chore: changes

* chore: alias

* chore: linting

* chore: ci

* chore(snapshot): 13.0.0-snapshot.0

* chore: dockerfile

* chore: move test/, package.json out of src

* chore: move more files out of /src

* chore: fix structure

* chore: readme

* chore: ci

* chore: ci

* chore(snapshot): 13.0.0-snapshot.1

* chore: comp

* chore(snapshot): 13.0.0-snapshot.2

* chore(snapshot): 13.0.0-snapshot.3

* chore: address comments
  • Loading branch information
kleyow committed Jul 11, 2022
1 parent 2496366 commit 8c764a9
Show file tree
Hide file tree
Showing 62 changed files with 24,698 additions and 15,296 deletions.
448 changes: 296 additions & 152 deletions .circleci/config.yml

Large diffs are not rendered by default.

File renamed without changes.
File renamed without changes.
32 changes: 32 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
const config = {
env: {
es2020: true,
node: true,
'jest/globals': true,
},
plugins: ['ava', 'jest'],
extends: 'eslint:recommended',
rules: {
indent: [
'error',
4,
{ SwitchCase: 1 },
],
'linebreak-style': [
2,
'unix',
],
quotes: [
2,
'single',
],
semi: [
2,
'always',
],
'no-console': 2,
'no-prototype-builtins': 'off',
}
};

module.exports = config;
66 changes: 65 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -73,4 +73,68 @@ goldenpayeefsp
/.DS_Store


junit.xml
junit.xml

# Logs
logs
*.log
npm-debug.log*
.[Dd][Ss]_[Ss]tore

# Ignore test results
**/test/results/*

# Runtime data
pids
*.pid
*.seed

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

#Docs folder created for documentation
docs

# nyc test coverage
.nyc_output

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# node-waf configuration
.lock-wscript

# Compiled binary addons (http://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules
jspm_packages

# Optional npm cache directory
.npm

# Optional REPL history
.node_repl_history

# VSCode directory
.vscode

.npmrc

# --------------- #
# IntelliJ #
# --------------- #
.idea/
**/*.iml

#package-lock.json
.history

# This one's pretty obvious
secrets
# Ignore any log files or application data
*.sqlite
3 changes: 2 additions & 1 deletion src/.ncurc.json → .ncurc.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"reject": [
"eslint",
"node-fetch"
"node-fetch",
"ava"
]
}
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
16.15.0
1 change: 1 addition & 0 deletions src/.nycrc.yml → .nycrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,4 @@ exclude:
- '**/coverage/**'
- '**/.eslintrc.js'
- '**/jest.integration.config.js'
- '**/init/**'
File renamed without changes.
File renamed without changes.
35 changes: 25 additions & 10 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,16 +1,31 @@
FROM node:12.16.0-alpine as intermediate
FROM node:16.15.0-alpine as builder
USER root

WORKDIR /src/
COPY ./src/ /src/
RUN npm install --production
WORKDIR /opt/app/

FROM node:12.16.0-alpine
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 install -g node-gyp

WORKDIR /src/
COPY package.json package-lock.json* /opt/app/
RUN npm ci

COPY --from=intermediate /src/ /src/
COPY --from=intermediate /src/package.json /src/package.json
COPY src /opt/app/src

EXPOSE 3000 3001 3003
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
RUN ln -sf /dev/stdout ./logs/combined.log

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

CMD node /src/index.js
COPY --chown=app-user --from=builder /opt/app/ .
RUN npm prune --production

EXPOSE 3000 3001 3003
CMD ["npm", "run", "start"]
6 changes: 2 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ docker-compose up


## Configure
A sample simulator configuration is given in the file `\src\.env`.
A sample scheme adapter configuration is given in the file `\local.env`.
A sample simulator configuration is given in the file `.env`.
A sample scheme adapter configuration is given in the file `scheme-adapter.env`.

Configuration of parties and test execution steps is via...TODO

Expand Down Expand Up @@ -153,14 +153,12 @@ docker-compose up
## Unit Tests

```bash
cd ./src
npm run test:unit
```

## Integration Tests

```bash
cd ./src
docker-compose up -d

# wait until mojaloop-simulator is up and running
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ services:
image: "redis:5.0.4-alpine"
sim:
image: "mojaloop-simulator-backend"
build: ../
build: ./
env_file: ./sim-backend.env
ports:
- "3000:3000"
Expand All @@ -19,7 +19,7 @@ services:
- "4000:4000"
- "4001:4001"
depends_on:
- redis-sim
- redis-sim
redis-dfsp:
image: "redis:5.0.4-alpine"
scheme-adapter-dfsp:
Expand All @@ -37,4 +37,4 @@ services:
- "6000:3000"
depends_on:
- scheme-adapter-dfsp

4 changes: 2 additions & 2 deletions src/docker-compose-sim.yml → docker-compose-sim.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ services:
image: "redis:5.0.4-alpine"
sim:
image: "mojaloop-simulator-backend"
build: ../
build: ./
env_file: ./sim-backend.env
ports:
- "3000:3000"
Expand All @@ -19,4 +19,4 @@ services:
- "3500:3000"
- "3501:4000"
depends_on:
- redis
- redis
File renamed without changes.
5 changes: 2 additions & 3 deletions src/docker-compose.yml → docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,10 @@ services:

sim:
image: "mojaloop-simulator-backend"
build: ../
build: ./
env_file: ./sim-backend.env
volumes:
- ./rules.json:/src/rules.json

- ./src/rules.json:/opt/app/src/rules.json
ports:
- "3000:3000"
- "3001:3001"
Expand Down
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit 8c764a9

Please sign in to comment.