forked from INTO-CPS-Association/DTaaS
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds http mode to library microservice (INTO-CPS-Association#480 and I…
…NTO-CPS-Association#345) - Adds http file service to library microservice using cloudcmd package - Adds yarn commands to libms using pm2 npm package - Updates diagrams in developer documentation - Adds libms tests to pre-commit configuration --------- Co-authored-by: Mads Kelberg <[email protected]> Co-authored-by: Mads Kelberg <[email protected]>
- Loading branch information
1 parent
4414fe2
commit 5e795ef
Showing
17 changed files
with
6,029 additions
and
261 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -90,3 +90,4 @@ fi | |
sudo apt-get update -y | ||
sudo apt-get install -y yarn | ||
sudo npm install -g serve | ||
sudo npm install -g pm2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
PORT='4001' | ||
MODE='local' or 'gitlab' | ||
LOCAL_PATH ='/Users/<Username>/DTaaS/files' | ||
LOG_LEVEL='debug' | ||
APOLLO_PATH='/lib' or '' | ||
GRAPHQL_PLAYGROUND='false' or 'true' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
{ | ||
"name": "DTaaS Fileserver", | ||
"auth": false, | ||
"editor": "edward", | ||
"packer": "zip", | ||
"diff": true, | ||
"zip": true, | ||
"buffer": true, | ||
"dirStorage": true, | ||
"online": false, | ||
"open": false, | ||
"oneFilePanel": true, | ||
"keysPanel": false, | ||
"prefix": "/lib/files", | ||
"confirmCopy": true, | ||
"confirmMove": true, | ||
"showConfig": false, | ||
"showFileName": true, | ||
"contact": false, | ||
"configDialog": false, | ||
"console": false, | ||
"terminal": false, | ||
"vim": false, | ||
"columns": "name-size-date-owner-mode", | ||
"export": false, | ||
"import": false, | ||
"dropbox": false, | ||
"dropboxToken": "", | ||
"log": true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"name": "@into-cps-association/libms", | ||
"version": "0.3.2", | ||
"version": "0.4.0", | ||
"description": "microservices that handles request by fetching and returning the file-names and folders of given directory", | ||
"author": "[email protected]", | ||
"contributors": [ | ||
|
@@ -16,12 +16,18 @@ | |
"format": "prettier --ignore-path ../.gitignore --write \"**/*.{ts,tsx,css,scss}\"", | ||
"graph": "npx madge --image src.svg src && npx madge --image test.svg test", | ||
"start": "node dist/src/main.js", | ||
"start:pm2": "pm2 start pm2.config.js", | ||
"stop:pm2": "pm2 delete libms", | ||
"syntax": "npx eslint . --fix", | ||
"pretest": "npx shx cp test/data/user2/tools/README.md ../../files/user2/tools/README.md", | ||
"posttest": "npx rimraf ../../files/user2/tools/README.md", | ||
"test:all": "npx cross-env LOCAL_PATH=test/data jest --coverage", | ||
"test:all": "npx cross-env LOCAL_PATH=test/data jest --testPathIgnorePatterns=cloudcmd --coverage", | ||
"test:e2e": "npx cross-env LOCAL_PATH=test/data jest --config ./test/jest-e2e.json --coverage", | ||
"test:http": "yarn build && pm2 start -f --name libms-test dist/src/main.js -- -c .env -H ./config/http.json && jest test/cloudcmd --coverage --coverageThreshold=\"{}\" && pm2 delete libms-test", | ||
"test:http-nocov": "yarn build && pm2 start -f --name libms-test dist/src/main.js -- -c .env -H ./config/http.json && jest test/cloudcmd --coverage=false && pm2 delete libms-test", | ||
"test:http-github": "yarn build && yarn start:pm2 && jest test/cloudcmd --coverage --coverageThreshold=\"{}\" && pm2 delete libms", | ||
"test:int": "npx cross-env LOCAL_PATH=test/data jest ../test/integration --coverage", | ||
"test:nocov": "yarn test:http-nocov && npx cross-env LOCAL_PATH=test/data jest --testPathIgnorePatterns=cloudcmd --coverage=false", | ||
"test:unit": "npx cross-env LOCAL_PATH=test/data jest ../test/unit --coverage" | ||
}, | ||
"bin": "./dist/src/main.js", | ||
|
@@ -34,12 +40,15 @@ | |
"@nestjs/core": "^10.3.0", | ||
"@nestjs/graphql": "^12.0.11", | ||
"@nestjs/platform-express": "^10.3.0", | ||
"axios": "^1.5.1", | ||
"cloudcmd": "^16.17.7", | ||
"commander": "^11.1.0", | ||
"dotenv": "^16.3.1", | ||
"graphql": "^16.8.1", | ||
"mock-fs": "^5.2.0", | ||
"reflect-metadata": "^0.1.13", | ||
"rxjs": "^7.8.1", | ||
"socket.io": "^4.7.2", | ||
"type-graphql": "^2.0.0-beta.3" | ||
}, | ||
"devDependencies": { | ||
|
@@ -52,6 +61,7 @@ | |
"@types/supertest": "^2.0.13", | ||
"@typescript-eslint/eslint-plugin": "^6.19.0", | ||
"@typescript-eslint/parser": "^6.19.0", | ||
"cross-fetch": "^4.0.0", | ||
"eslint": "^8.56.0", | ||
"eslint-config-airbnb-base": "^15.0.0", | ||
"eslint-config-prettier": "^9.1.0", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
module.exports = { | ||
apps : [ | ||
{ | ||
name: "libms", | ||
script: "./dist/src/main.js", | ||
watch: false, | ||
args: "-H ./config/http.json" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { INestApplication } from '@nestjs/common'; | ||
import { Server } from 'socket.io'; | ||
import * as cloudcmd from 'cloudcmd'; | ||
import { join } from 'path'; | ||
|
||
const runCloudCMD = ( | ||
app: INestApplication, | ||
optionsPath: string, | ||
filesPath: string, | ||
) => { | ||
const { createConfigManager } = cloudcmd; | ||
const configManager = createConfigManager({ | ||
configPath: join(process.cwd(), optionsPath), | ||
}); | ||
|
||
configManager('root', filesPath); | ||
|
||
const server = app.getHttpServer(); | ||
|
||
const socket = new Server(server, { | ||
path: `${configManager('prefix')}/socket.io`, | ||
}); | ||
app.use( | ||
configManager('prefix'), | ||
cloudcmd({ | ||
configManager, | ||
socket, | ||
}), | ||
); | ||
}; | ||
|
||
export default runCloudCMD; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.