Skip to content

Commit

Permalink
feat: upgrade mongoose to 8.1.0 and casbin to 5.28.0 (#76)
Browse files Browse the repository at this point in the history
* update mongoose, casbin and typescript

* add proper return types

* improve removepolicies to clear role correctly

* update mongo version to 6

* increase timeout to 4 seconds

* use new mongosh

* small bumps
  • Loading branch information
Emanuele Tonello authored Jan 25, 2024
1 parent a5082cd commit 78f5a6a
Show file tree
Hide file tree
Showing 11 changed files with 1,221 additions and 527 deletions.
2 changes: 1 addition & 1 deletion .github/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM mongo:5.0.16
FROM mongo:6.0.13

VOLUME /data
EXPOSE 27001 27002 27003
Expand Down
16 changes: 8 additions & 8 deletions .github/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ function waitForMongo {
n=0
until [ $n -ge 20 ]
do
mongo admin --quiet --port $port --eval "db" && break
mongosh admin --quiet --port $port --eval "db" && break
n=$[$n+1]
sleep 2
done
Expand All @@ -38,18 +38,18 @@ waitForMongo 27003

echo "CONFIGURING REPLICA SET"
CONFIG="{ _id: '$REPLICA_SET_NAME', members: [{_id: 0, host: 'localhost:27001', priority: 2 }, { _id: 1, host: 'localhost:27002' }, { _id: 2, host: 'localhost:27003' } ]}"
mongo admin --port 27001 --eval "db.runCommand({ replSetInitiate: $CONFIG })"
mongosh admin --port 27001 --eval "db.runCommand({ replSetInitiate: $CONFIG })"

waitForMongo 27002
waitForMongo 27003

mongo admin --port 27001 --eval "db.runCommand({ setParameter: 1, quiet: 1 })"
mongo admin --port 27002 --eval "db.runCommand({ setParameter: 1, quiet: 1 })"
mongo admin --port 27003 --eval "db.runCommand({ setParameter: 1, quiet: 1 })"
mongosh admin --port 27001 --eval "db.runCommand({ setParameter: 1, quiet: 1 })"
mongosh admin --port 27002 --eval "db.runCommand({ setParameter: 1, quiet: 1 })"
mongosh admin --port 27003 --eval "db.runCommand({ setParameter: 1, quiet: 1 })"

mongo admin --port 27001 --eval "db.adminCommand({ setParameter: 1, maxTransactionLockRequestTimeoutMillis: 5000 })"
mongo admin --port 27002 --eval "db.adminCommand({ setParameter: 1, maxTransactionLockRequestTimeoutMillis: 5000 })"
mongo admin --port 27003 --eval "db.adminCommand({ setParameter: 1, maxTransactionLockRequestTimeoutMillis: 5000 })"
mongosh admin --port 27001 --eval "db.adminCommand({ setParameter: 1, maxTransactionLockRequestTimeoutMillis: 5000 })"
mongosh admin --port 27002 --eval "db.adminCommand({ setParameter: 1, maxTransactionLockRequestTimeoutMillis: 5000 })"
mongosh admin --port 27003 --eval "db.adminCommand({ setParameter: 1, maxTransactionLockRequestTimeoutMillis: 5000 })"

echo "REPLICA SET ONLINE"

Expand Down
10 changes: 10 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"endOfLine": "lf",
"semi": true,
"camelcase": false,
"new-cap": false,
"singleQuote": true,
"tabWidth": 2,
"trailingComma": "none",
"printWidth": 100
}
15 changes: 8 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,15 @@
"prepare": "npm run build"
},
"devDependencies": {
"@typescript-eslint/eslint-plugin": "^4.21.0",
"casbin": "^5.11.5",
"@types/node": "^20.11.6",
"@typescript-eslint/eslint-plugin": "^6.19.1",
"casbin": "^5.28.0",
"chai": "^4.3.0",
"coveralls": "^3.0.9",
"coveralls": "^3.1.1",
"cz-conventional-changelog": "^3.3.0",
"eslint": "^7.20.0",
"eslint-config-standard": "^16.0.2",
"eslint-plugin-import": "^2.22.1",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-promise": "^4.3.1",
"eslint-plugin-standard": "^5.0.0",
Expand All @@ -77,13 +78,13 @@
"npm-run-all": "^4.1.5",
"nyc": "^15.1.0",
"sinon": "^9.0.0",
"typescript": "^4.2.3"
"typescript": "^5.3.3"
},
"dependencies": {
"mongoose": "^7.3.4"
"mongoose": "^8.1.1"
},
"peerDependencies": {
"casbin": "^5.13.2"
"casbin": "^5.28.0"
},
"husky": {
"hooks": {
Expand Down
Loading

0 comments on commit 78f5a6a

Please sign in to comment.