diff --git a/.nvmrc b/.nvmrc index f599e28..5b7269c 100644 --- a/.nvmrc +++ b/.nvmrc @@ -1 +1 @@ -10 +10.19.0 diff --git a/CHANGELOG.md b/CHANGELOG.md index e5501dd..317b759 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,15 @@ ### Master +* ... + +### 2.3.4 * monorepo: pin monorepo, scaffolder and project to node 10 -* CI: execute lint/build/test for generated create-aaa-backend project al the time +* CI: execute lint/build/test for generated create-aaa-backend project all the time +* storage: db connection pool defaults (min=1, max=cpu_cores*2, idle=10000ms) and allow to specify via `pgConnection.pool`. + * Furhermore allows to specify pool size via `SEQ_POOL_MIN`, `SEQ_POOL_MAX` and `SEQ_POOL_IDLE` env vars. +* ansible provision fixes + +### 2.3.0-2.3.3 +* bad builds, ignore. ### 2.2.5 * Update dependencies with high vulnerabilities diff --git a/README.md b/README.md index 9a16b3a..9de3487 100644 --- a/README.md +++ b/README.md @@ -134,8 +134,8 @@ local$ git commit -m "merge latest" local$ git tag 1.16.1 # 3. Push to github -local$ git push origin-github -local$ git push origin-github 1.16.1 +local$ git push origin-github +local$ git push origin-github 1.16.1 ``` ### I want to add a dependency diff --git a/lerna.json b/lerna.json index 14cceb4..f942160 100644 --- a/lerna.json +++ b/lerna.json @@ -6,5 +6,5 @@ "hoist": true, "npmClient": "yarn", "useWorkspaces": true, - "version": "2.2.5" + "version": "2.3.4" } diff --git a/packages/aaa-build-tools/package.json b/packages/aaa-build-tools/package.json index ff2b5e6..e558b14 100644 --- a/packages/aaa-build-tools/package.json +++ b/packages/aaa-build-tools/package.json @@ -1,6 +1,6 @@ { "name": "@aaa-backend-stack/build-tools", - "version": "2.2.0", + "version": "2.3.4", "description": "base tools for env sourcing and building cli tools", "license": "MIT", "author": "all about apps", @@ -42,7 +42,7 @@ "sort-package-json": "1.7.1" }, "devDependencies": { - "@aaa-backend-stack/tslint-rules": "^2.2.0", + "@aaa-backend-stack/tslint-rules": "^2.3.4", "tslint": "5.11.0", "typescript": "3.7.2" }, diff --git a/packages/aaa-devtools/package.json b/packages/aaa-devtools/package.json index 0418741..7ef46e3 100644 --- a/packages/aaa-devtools/package.json +++ b/packages/aaa-devtools/package.json @@ -1,6 +1,6 @@ { "name": "@aaa-backend-stack/devtools", - "version": "2.2.4", + "version": "2.3.4", "description": "Websocket devtools which integrates with aaa logger (pipes logs from stdout)", "license": "MIT", "author": "all about apps", @@ -16,8 +16,8 @@ "test": "exit 0" }, "dependencies": { - "@aaa-backend-stack/build-tools": "^2.2.0", - "@aaa-backend-stack/git-info": "^2.2.4", + "@aaa-backend-stack/build-tools": "^2.3.4", + "@aaa-backend-stack/git-info": "^2.3.4", "@types/lodash": "4.14.144", "@types/ws": "3.2.1", "bufferutil": "4.0.1", @@ -26,8 +26,8 @@ "ws": "3.3.3" }, "devDependencies": { - "@aaa-backend-stack/test-environment": "^2.2.4", - "@aaa-backend-stack/tslint-rules": "^2.2.0", + "@aaa-backend-stack/test-environment": "^2.3.4", + "@aaa-backend-stack/tslint-rules": "^2.3.4", "tslint": "5.11.0", "typescript": "3.7.2" }, diff --git a/packages/aaa-example-lib/package.json b/packages/aaa-example-lib/package.json index c96eb7d..d0865a1 100644 --- a/packages/aaa-example-lib/package.json +++ b/packages/aaa-example-lib/package.json @@ -1,6 +1,6 @@ { "name": "@aaa-backend-stack/example-lib", - "version": "2.2.4", + "version": "2.3.4", "private": true, "description": "Example Lib", "license": "MIT", @@ -17,12 +17,12 @@ "test": "exit 0" }, "dependencies": { - "@aaa-backend-stack/build-tools": "^2.2.0", - "@aaa-backend-stack/utils": "^2.2.4" + "@aaa-backend-stack/build-tools": "^2.3.4", + "@aaa-backend-stack/utils": "^2.3.4" }, "devDependencies": { - "@aaa-backend-stack/test-environment": "^2.2.4", - "@aaa-backend-stack/tslint-rules": "^2.2.0", + "@aaa-backend-stack/test-environment": "^2.3.4", + "@aaa-backend-stack/tslint-rules": "^2.3.4", "tslint": "5.11.0", "typescript": "3.7.2" }, diff --git a/packages/aaa-file-storage-local/package.json b/packages/aaa-file-storage-local/package.json index 19cd7fa..5edab76 100644 --- a/packages/aaa-file-storage-local/package.json +++ b/packages/aaa-file-storage-local/package.json @@ -1,6 +1,6 @@ { "name": "@aaa-backend-stack/file-storage-local", - "version": "2.2.4", + "version": "2.3.4", "description": "File storage service implementation using local file system", "license": "MIT", "author": "all about apps", @@ -16,18 +16,18 @@ "test": "exit 0" }, "dependencies": { - "@aaa-backend-stack/build-tools": "^2.2.0", - "@aaa-backend-stack/file-storage": "^2.2.0", - "@aaa-backend-stack/logger": "^2.2.4", - "@aaa-backend-stack/utils": "^2.2.4", + "@aaa-backend-stack/build-tools": "^2.3.4", + "@aaa-backend-stack/file-storage": "^2.3.4", + "@aaa-backend-stack/logger": "^2.3.4", + "@aaa-backend-stack/utils": "^2.3.4", "@types/lodash": "4.14.144", "@types/url-join": "0.8.2", "lodash": "4.17.15", "url-join": "4.0.0" }, "devDependencies": { - "@aaa-backend-stack/test-environment": "^2.2.4", - "@aaa-backend-stack/tslint-rules": "^2.2.0", + "@aaa-backend-stack/test-environment": "^2.3.4", + "@aaa-backend-stack/tslint-rules": "^2.3.4", "tslint": "5.11.0", "typescript": "3.7.2" }, diff --git a/packages/aaa-file-storage-s3/package.json b/packages/aaa-file-storage-s3/package.json index 6c11c68..5fbee6e 100644 --- a/packages/aaa-file-storage-s3/package.json +++ b/packages/aaa-file-storage-s3/package.json @@ -1,6 +1,6 @@ { "name": "@aaa-backend-stack/file-storage-s3", - "version": "2.2.4", + "version": "2.3.4", "description": "File storage service implementation using Amazon S3 buckets (or compatible servers)", "license": "MIT", "author": "all about apps", @@ -16,10 +16,10 @@ "test": "exit 0" }, "dependencies": { - "@aaa-backend-stack/build-tools": "^2.2.0", - "@aaa-backend-stack/file-storage": "^2.2.0", - "@aaa-backend-stack/logger": "^2.2.4", - "@aaa-backend-stack/utils": "^2.2.4", + "@aaa-backend-stack/build-tools": "^2.3.4", + "@aaa-backend-stack/file-storage": "^2.3.4", + "@aaa-backend-stack/logger": "^2.3.4", + "@aaa-backend-stack/utils": "^2.3.4", "@types/lodash": "4.14.144", "@types/url-join": "0.8.2", "aws-sdk": "2.311.0", @@ -27,8 +27,8 @@ "url-join": "4.0.0" }, "devDependencies": { - "@aaa-backend-stack/test-environment": "^2.2.4", - "@aaa-backend-stack/tslint-rules": "^2.2.0", + "@aaa-backend-stack/test-environment": "^2.3.4", + "@aaa-backend-stack/tslint-rules": "^2.3.4", "tslint": "5.11.0", "typescript": "3.7.2" }, diff --git a/packages/aaa-file-storage/package.json b/packages/aaa-file-storage/package.json index 8e935d8..0e01bfe 100644 --- a/packages/aaa-file-storage/package.json +++ b/packages/aaa-file-storage/package.json @@ -1,6 +1,6 @@ { "name": "@aaa-backend-stack/file-storage", - "version": "2.2.0", + "version": "2.3.4", "description": "High level API for a file storage service, actual implementation provided in separate packages", "license": "MIT", "author": "all about apps", @@ -16,10 +16,10 @@ "test": "exit 0" }, "dependencies": { - "@aaa-backend-stack/build-tools": "^2.2.0" + "@aaa-backend-stack/build-tools": "^2.3.4" }, "devDependencies": { - "@aaa-backend-stack/tslint-rules": "^2.2.0", + "@aaa-backend-stack/tslint-rules": "^2.3.4", "tslint": "5.11.0", "typescript": "3.7.2" }, diff --git a/packages/aaa-git-info/package.json b/packages/aaa-git-info/package.json index 7e3f2a0..4a93d22 100644 --- a/packages/aaa-git-info/package.json +++ b/packages/aaa-git-info/package.json @@ -1,6 +1,6 @@ { "name": "@aaa-backend-stack/git-info", - "version": "2.2.4", + "version": "2.3.4", "description": "Reads base directory to get current git commit information", "license": "MIT", "author": "all about apps", @@ -16,12 +16,12 @@ "test": "exit 0" }, "dependencies": { - "@aaa-backend-stack/build-tools": "^2.2.0", + "@aaa-backend-stack/build-tools": "^2.3.4", "git-rev-sync": "1.9.1" }, "devDependencies": { - "@aaa-backend-stack/test-environment": "^2.2.4", - "@aaa-backend-stack/tslint-rules": "^2.2.0", + "@aaa-backend-stack/test-environment": "^2.3.4", + "@aaa-backend-stack/tslint-rules": "^2.3.4", "tslint": "5.11.0", "typescript": "3.7.2" }, diff --git a/packages/aaa-graphql-rest-bindings/package.json b/packages/aaa-graphql-rest-bindings/package.json index ed84a32..3163c6d 100644 --- a/packages/aaa-graphql-rest-bindings/package.json +++ b/packages/aaa-graphql-rest-bindings/package.json @@ -1,6 +1,6 @@ { "name": "@aaa-backend-stack/graphql-rest-bindings", - "version": "2.2.4", + "version": "2.3.4", "description": "Provides utils for graphql introspection and devtools in combination with rest layer", "license": "MIT", "author": "all about apps", @@ -16,11 +16,11 @@ "test": "exit 0" }, "dependencies": { - "@aaa-backend-stack/build-tools": "^2.2.0", - "@aaa-backend-stack/graphql": "^2.2.4", - "@aaa-backend-stack/logger": "^2.2.4", - "@aaa-backend-stack/rest": "^2.2.4", - "@aaa-backend-stack/utils": "^2.2.4", + "@aaa-backend-stack/build-tools": "^2.3.4", + "@aaa-backend-stack/graphql": "^2.3.4", + "@aaa-backend-stack/logger": "^2.3.4", + "@aaa-backend-stack/rest": "^2.3.4", + "@aaa-backend-stack/utils": "^2.3.4", "@types/bluebird": "3.5.8", "@types/bluebird-global": "3.5.3", "@types/lodash": "4.14.144", @@ -30,8 +30,8 @@ "lodash": "4.17.15" }, "devDependencies": { - "@aaa-backend-stack/test-environment": "^2.2.4", - "@aaa-backend-stack/tslint-rules": "^2.2.0", + "@aaa-backend-stack/test-environment": "^2.3.4", + "@aaa-backend-stack/tslint-rules": "^2.3.4", "tslint": "5.11.0", "typescript": "3.7.2" }, diff --git a/packages/aaa-graphql/package.json b/packages/aaa-graphql/package.json index 920f182..3f39d9d 100644 --- a/packages/aaa-graphql/package.json +++ b/packages/aaa-graphql/package.json @@ -1,6 +1,6 @@ { "name": "@aaa-backend-stack/graphql", - "version": "2.2.4", + "version": "2.3.4", "description": "GraphQL Layer", "license": "MIT", "author": "all about apps", @@ -19,9 +19,9 @@ "test": "exit 0" }, "dependencies": { - "@aaa-backend-stack/build-tools": "^2.2.0", - "@aaa-backend-stack/logger": "^2.2.4", - "@aaa-backend-stack/utils": "^2.2.4", + "@aaa-backend-stack/build-tools": "^2.3.4", + "@aaa-backend-stack/logger": "^2.3.4", + "@aaa-backend-stack/utils": "^2.3.4", "@types/bluebird": "3.5.8", "@types/bluebird-global": "3.5.3", "@types/graphql": "0.9.4", @@ -41,8 +41,8 @@ "sequelize": "3.31.0" }, "devDependencies": { - "@aaa-backend-stack/test-environment": "^2.2.4", - "@aaa-backend-stack/tslint-rules": "^2.2.0", + "@aaa-backend-stack/test-environment": "^2.3.4", + "@aaa-backend-stack/tslint-rules": "^2.3.4", "tslint": "5.11.0", "typescript": "3.7.2" }, diff --git a/packages/aaa-image-service/package.json b/packages/aaa-image-service/package.json index 08820c3..570ebdf 100644 --- a/packages/aaa-image-service/package.json +++ b/packages/aaa-image-service/package.json @@ -1,6 +1,6 @@ { "name": "@aaa-backend-stack/image-service", - "version": "2.2.4", + "version": "2.3.4", "description": "Image service for handling image uploads", "license": "MIT", "author": "all about apps", @@ -16,12 +16,12 @@ "test": "exit 0" }, "dependencies": { - "@aaa-backend-stack/build-tools": "^2.2.0", - "@aaa-backend-stack/file-storage": "^2.2.0", - "@aaa-backend-stack/logger": "^2.2.4", - "@aaa-backend-stack/rest": "^2.2.4", - "@aaa-backend-stack/storage": "^2.2.4", - "@aaa-backend-stack/utils": "^2.2.4", + "@aaa-backend-stack/build-tools": "^2.3.4", + "@aaa-backend-stack/file-storage": "^2.3.4", + "@aaa-backend-stack/logger": "^2.3.4", + "@aaa-backend-stack/rest": "^2.3.4", + "@aaa-backend-stack/storage": "^2.3.4", + "@aaa-backend-stack/utils": "^2.3.4", "@types/gm": "1.18.0", "@types/lodash": "4.14.144", "command-exists": "1.2.7", @@ -29,8 +29,8 @@ "lodash": "4.17.15" }, "devDependencies": { - "@aaa-backend-stack/test-environment": "^2.2.4", - "@aaa-backend-stack/tslint-rules": "^2.2.0", + "@aaa-backend-stack/test-environment": "^2.3.4", + "@aaa-backend-stack/tslint-rules": "^2.3.4", "tslint": "5.11.0", "typescript": "3.7.2" }, diff --git a/packages/aaa-logger/package.json b/packages/aaa-logger/package.json index 046e0e4..6df5a79 100644 --- a/packages/aaa-logger/package.json +++ b/packages/aaa-logger/package.json @@ -1,6 +1,6 @@ { "name": "@aaa-backend-stack/logger", - "version": "2.2.4", + "version": "2.3.4", "description": "Bunyan logger interface implementation, hapi plugin, file rotation and email error reporting setup", "license": "MIT", "author": "all about apps", @@ -19,9 +19,9 @@ "test": "exit 0" }, "dependencies": { - "@aaa-backend-stack/build-tools": "^2.2.0", - "@aaa-backend-stack/git-info": "^2.2.4", - "@aaa-backend-stack/serverdate": "^2.2.4", + "@aaa-backend-stack/build-tools": "^2.3.4", + "@aaa-backend-stack/git-info": "^2.3.4", + "@aaa-backend-stack/serverdate": "^2.3.4", "@types/bunyan": "0.0.30", "@types/lodash": "4.14.144", "@types/nodemailer": "6.2.1", @@ -35,8 +35,8 @@ "safe-json-stringify": "1.1.0" }, "devDependencies": { - "@aaa-backend-stack/test-environment": "^2.2.4", - "@aaa-backend-stack/tslint-rules": "^2.2.0", + "@aaa-backend-stack/test-environment": "^2.3.4", + "@aaa-backend-stack/tslint-rules": "^2.3.4", "tslint": "5.11.0", "typescript": "3.7.2" }, diff --git a/packages/aaa-mailer/package.json b/packages/aaa-mailer/package.json index 2b580c8..b1fb054 100644 --- a/packages/aaa-mailer/package.json +++ b/packages/aaa-mailer/package.json @@ -1,6 +1,6 @@ { "name": "@aaa-backend-stack/mailer", - "version": "2.2.4", + "version": "2.3.4", "description": "Example Lib", "license": "MIT", "author": "all about apps", @@ -16,9 +16,9 @@ "test": "exit 0" }, "dependencies": { - "@aaa-backend-stack/build-tools": "^2.2.0", - "@aaa-backend-stack/logger": "^2.2.4", - "@aaa-backend-stack/utils": "^2.2.4", + "@aaa-backend-stack/build-tools": "^2.3.4", + "@aaa-backend-stack/logger": "^2.3.4", + "@aaa-backend-stack/utils": "^2.3.4", "@types/lodash": "4.14.144", "@types/nodemailer": "6.2.1", "handlebars": "4.3.0", @@ -29,8 +29,8 @@ "nodemailer-stub-transport": "1.1.0" }, "devDependencies": { - "@aaa-backend-stack/test-environment": "^2.2.4", - "@aaa-backend-stack/tslint-rules": "^2.2.0", + "@aaa-backend-stack/test-environment": "^2.3.4", + "@aaa-backend-stack/tslint-rules": "^2.3.4", "tslint": "5.11.0", "typescript": "3.7.2" }, diff --git a/packages/aaa-polyfills/package.json b/packages/aaa-polyfills/package.json index 409101b..4db7278 100644 --- a/packages/aaa-polyfills/package.json +++ b/packages/aaa-polyfills/package.json @@ -1,6 +1,6 @@ { "name": "@aaa-backend-stack/polyfills", - "version": "2.2.4", + "version": "2.3.4", "description": "Unified core and polyfills injector for backend projects. This project explicitly maintains the cls patched sequelize, bluebird, fetch", "license": "MIT", "author": "all about apps", @@ -16,7 +16,7 @@ "test": "exit 0" }, "dependencies": { - "@aaa-backend-stack/build-tools": "^2.2.0", + "@aaa-backend-stack/build-tools": "^2.3.4", "@types/bluebird": "3.5.8", "@types/bluebird-global": "3.5.3", "@types/lodash": "4.14.144", @@ -34,8 +34,8 @@ "uuid": "3.1.0" }, "devDependencies": { - "@aaa-backend-stack/test-environment": "^2.2.4", - "@aaa-backend-stack/tslint-rules": "^2.2.0", + "@aaa-backend-stack/test-environment": "^2.3.4", + "@aaa-backend-stack/tslint-rules": "^2.3.4", "tslint": "5.11.0", "typescript": "3.7.2" }, diff --git a/packages/aaa-pushes/package.json b/packages/aaa-pushes/package.json index d6fa413..bffd1be 100644 --- a/packages/aaa-pushes/package.json +++ b/packages/aaa-pushes/package.json @@ -1,6 +1,6 @@ { "name": "@aaa-backend-stack/pushes", - "version": "2.2.5", + "version": "2.3.4", "description": "Push notification lib", "license": "MIT", "author": "all about apps", @@ -16,10 +16,10 @@ "test": "exit 0" }, "dependencies": { - "@aaa-backend-stack/build-tools": "^2.2.0", - "@aaa-backend-stack/logger": "^2.2.4", - "@aaa-backend-stack/serverdate": "^2.2.4", - "@aaa-backend-stack/utils": "^2.2.4", + "@aaa-backend-stack/build-tools": "^2.3.4", + "@aaa-backend-stack/logger": "^2.3.4", + "@aaa-backend-stack/serverdate": "^2.3.4", + "@aaa-backend-stack/utils": "^2.3.4", "@types/lodash": "4.14.144", "@types/node-fetch": "1.6.7", "apn": "2.2.0", @@ -29,8 +29,8 @@ "node-fetch": "1.7.2" }, "devDependencies": { - "@aaa-backend-stack/test-environment": "^2.2.4", - "@aaa-backend-stack/tslint-rules": "^2.2.0", + "@aaa-backend-stack/test-environment": "^2.3.4", + "@aaa-backend-stack/tslint-rules": "^2.3.4", "tslint": "5.11.0", "typescript": "3.7.2" }, diff --git a/packages/aaa-rest/package.json b/packages/aaa-rest/package.json index d994080..c6cb529 100644 --- a/packages/aaa-rest/package.json +++ b/packages/aaa-rest/package.json @@ -1,6 +1,6 @@ { "name": "@aaa-backend-stack/rest", - "version": "2.2.4", + "version": "2.3.4", "description": "Example Lib", "license": "MIT", "author": "all about apps", @@ -16,9 +16,9 @@ "test": "exit 0" }, "dependencies": { - "@aaa-backend-stack/build-tools": "^2.2.0", - "@aaa-backend-stack/logger": "^2.2.4", - "@aaa-backend-stack/utils": "^2.2.4", + "@aaa-backend-stack/build-tools": "^2.3.4", + "@aaa-backend-stack/logger": "^2.3.4", + "@aaa-backend-stack/utils": "^2.3.4", "@types/boom": "0.0.33", "@types/hapi": "16.1.6", "@types/hapi-decorators": "0.4.5", @@ -39,8 +39,8 @@ "vision": "4.1.1" }, "devDependencies": { - "@aaa-backend-stack/test-environment": "^2.2.4", - "@aaa-backend-stack/tslint-rules": "^2.2.0", + "@aaa-backend-stack/test-environment": "^2.3.4", + "@aaa-backend-stack/tslint-rules": "^2.3.4", "tslint": "5.11.0", "typescript": "3.7.2" }, diff --git a/packages/aaa-serverdate/package.json b/packages/aaa-serverdate/package.json index 4ea64d7..94ecde0 100644 --- a/packages/aaa-serverdate/package.json +++ b/packages/aaa-serverdate/package.json @@ -1,6 +1,6 @@ { "name": "@aaa-backend-stack/serverdate", - "version": "2.2.4", + "version": "2.3.4", "description": "Utility functions to work with date critical server operations", "license": "MIT", "author": "all about apps", @@ -16,7 +16,7 @@ "test": "exit 0" }, "dependencies": { - "@aaa-backend-stack/build-tools": "^2.2.0", + "@aaa-backend-stack/build-tools": "^2.3.4", "@types/lodash": "4.14.144", "@types/moment-timezone": "0.5.12", "lodash": "4.17.15", @@ -25,8 +25,8 @@ "receptacle": "1.3.0" }, "devDependencies": { - "@aaa-backend-stack/test-environment": "^2.2.4", - "@aaa-backend-stack/tslint-rules": "^2.2.0", + "@aaa-backend-stack/test-environment": "^2.3.4", + "@aaa-backend-stack/tslint-rules": "^2.3.4", "tslint": "5.11.0", "typescript": "3.7.2" }, diff --git a/packages/aaa-storage/package.json b/packages/aaa-storage/package.json index 9b0b5de..c7f6388 100644 --- a/packages/aaa-storage/package.json +++ b/packages/aaa-storage/package.json @@ -1,6 +1,6 @@ { "name": "@aaa-backend-stack/storage", - "version": "2.2.4", + "version": "2.3.4", "description": "Storage Package Abstraction", "license": "MIT", "author": "all about apps", @@ -16,9 +16,9 @@ "test": "exit 0" }, "dependencies": { - "@aaa-backend-stack/build-tools": "^2.2.0", - "@aaa-backend-stack/logger": "^2.2.4", - "@aaa-backend-stack/utils": "^2.2.4", + "@aaa-backend-stack/build-tools": "^2.3.4", + "@aaa-backend-stack/logger": "^2.3.4", + "@aaa-backend-stack/utils": "^2.3.4", "@types/bluebird": "3.5.8", "@types/bluebird-global": "3.5.3", "@types/bluebird-retry": "0.0.33", @@ -40,8 +40,8 @@ "uuid": "3.1.0" }, "devDependencies": { - "@aaa-backend-stack/test-environment": "^2.2.4", - "@aaa-backend-stack/tslint-rules": "^2.2.0", + "@aaa-backend-stack/test-environment": "^2.3.4", + "@aaa-backend-stack/tslint-rules": "^2.3.4", "tslint": "5.11.0", "typescript": "3.7.2" }, diff --git a/packages/aaa-storage/src/adapters/ConnectionAdapter.ts b/packages/aaa-storage/src/adapters/ConnectionAdapter.ts index c4517cc..d66a052 100644 --- a/packages/aaa-storage/src/adapters/ConnectionAdapter.ts +++ b/packages/aaa-storage/src/adapters/ConnectionAdapter.ts @@ -6,6 +6,7 @@ import * as _ from "lodash"; import * as Sequelize from "sequelize"; import dataloader, { resetCache as dataloaderResetCache } from "dataloader-sequelize"; import * as bluebirdRetry from "bluebird-retry"; +import * as os from "os"; const pg = require("pg").native; // Settings @@ -18,8 +19,29 @@ export interface IPGConnectionOptions { password: string; database: string; timezone: string; + pool?: Partial; } +export interface IPGConnectionPoolOptions { + max: number; + min: number; + idle: number; + handleDisconnects: boolean; +} + +const PG_CONNECTION_SEQ_POOL_DEFAULTS = { + max: process.env.SEQ_POOL_MAX + ? parseInt(process.env.SEQ_POOL_MAX, 10) + : os.cpus().length * 2, // cpu_cores * 2 is the default max for database connections + min: process.env.SEQ_POOL_MIN + ? parseInt(process.env.SEQ_POOL_MIN, 10) + : 1, // we try to keep at least one connection open all time + idle: process.env.SEQ_POOL_IDLE + ? parseInt(process.env.SEQ_POOL_IDLE, 10) + : 60000, + handleDisconnects: true +}; + export interface IConnectionAdapterConfig { pgConnection: IPGConnectionOptions; } @@ -73,7 +95,14 @@ export class ConnectionAdapter { throw new Error("ConnectionAdapter: tried to reset config while sequelize is still initialized."); } - this._CONFIG = config; + this._CONFIG = _.defaultsDeep(config, { + pgConnection: { + pool: { + ...PG_CONNECTION_SEQ_POOL_DEFAULTS, + ...(config.pgConnection.pool ? config.pgConnection.pool : {}) + } + } + }); } public get CONFIG(): TConfig { @@ -378,7 +407,8 @@ export class ConnectionAdapter { attempt, database, host: restPGConfig.host, - port: restPGConfig.port + port: restPGConfig.port, + pool: restPGConfig.pool }, "ConnectionAdapter.initConnectionAdapter: attempting to initialize sequelize..."); try { @@ -387,10 +417,10 @@ export class ConnectionAdapter { logger.trace(query); } }, { - ...restPGConfig, - dialect: "postgres", - native: true, - })); + ...restPGConfig, + dialect: "postgres", + native: true, + })); logger.debug({ ...CONNECTION_RETRY_CONFIG, @@ -407,7 +437,8 @@ export class ConnectionAdapter { attempt, database, host: restPGConfig.host, - port: restPGConfig.port + port: restPGConfig.port, + pool: restPGConfig.pool }, "ConnectionAdapter.initConnectionAdapter: initialized & authenticated"); return seq; diff --git a/packages/aaa-test-environment/package.json b/packages/aaa-test-environment/package.json index f382e51..40dc587 100644 --- a/packages/aaa-test-environment/package.json +++ b/packages/aaa-test-environment/package.json @@ -1,6 +1,6 @@ { "name": "@aaa-backend-stack/test-environment", - "version": "2.2.4", + "version": "2.3.4", "description": "Test environment (encapsulates mocha test stack)", "license": "MIT", "author": "all about apps", @@ -19,7 +19,7 @@ "test": "exit 0" }, "dependencies": { - "@aaa-backend-stack/build-tools": "^2.2.0", + "@aaa-backend-stack/build-tools": "^2.3.4", "@types/chai": "3.5.2", "@types/chai-as-promised": "0.0.29", "@types/chai-http": "0.0.29", @@ -36,7 +36,7 @@ "traverse": "0.6.6" }, "devDependencies": { - "@aaa-backend-stack/tslint-rules": "^2.2.0", + "@aaa-backend-stack/tslint-rules": "^2.3.4", "tslint": "5.11.0", "typescript": "3.7.2" }, diff --git a/packages/aaa-utils/package.json b/packages/aaa-utils/package.json index 71dfab7..d8f8bf8 100644 --- a/packages/aaa-utils/package.json +++ b/packages/aaa-utils/package.json @@ -1,6 +1,6 @@ { "name": "@aaa-backend-stack/utils", - "version": "2.2.4", + "version": "2.3.4", "description": "Utility belt for aaa backend projects", "license": "MIT", "author": "all about apps", @@ -16,8 +16,8 @@ "test": "exit 0" }, "dependencies": { - "@aaa-backend-stack/build-tools": "^2.2.0", - "@aaa-backend-stack/logger": "^2.2.4", + "@aaa-backend-stack/build-tools": "^2.3.4", + "@aaa-backend-stack/logger": "^2.3.4", "@types/bluebird": "3.5.8", "@types/bluebird-global": "3.5.3", "@types/bluebird-retry": "0.0.33", @@ -35,8 +35,8 @@ "zxcvbn": "4.4.2" }, "devDependencies": { - "@aaa-backend-stack/test-environment": "^2.2.4", - "@aaa-backend-stack/tslint-rules": "^2.2.0", + "@aaa-backend-stack/test-environment": "^2.3.4", + "@aaa-backend-stack/tslint-rules": "^2.3.4", "tslint": "5.11.0", "typescript": "3.7.2" }, diff --git a/packages/create-aaa-backend/package.json b/packages/create-aaa-backend/package.json index 63e8bc0..6ecebe9 100644 --- a/packages/create-aaa-backend/package.json +++ b/packages/create-aaa-backend/package.json @@ -1,6 +1,6 @@ { "name": "create-aaa-backend", - "version": "2.2.4", + "version": "2.3.4", "description": "create-aaa-backend global cli. Used for scaffolding new aaa backend projects", "license": "MIT", "author": "all about apps", @@ -20,9 +20,9 @@ "test": "exit 0" }, "dependencies": { - "@aaa-backend-stack/build-tools": "^2.2.0", - "@aaa-backend-stack/polyfills": "^2.2.4", - "@aaa-backend-stack/utils": "^2.2.4", + "@aaa-backend-stack/build-tools": "^2.3.4", + "@aaa-backend-stack/polyfills": "^2.3.4", + "@aaa-backend-stack/utils": "^2.3.4", "@types/inquirer": "0.0.35", "@types/lodash": "4.14.144", "generate-password": "1.3.0", @@ -33,7 +33,7 @@ "uuid": "3.1.0" }, "devDependencies": { - "@aaa-backend-stack/tslint-rules": "^2.2.0", + "@aaa-backend-stack/tslint-rules": "^2.3.4", "@types/uuid": "3.4.5", "tslint": "5.11.0", "typescript": "3.7.2" diff --git a/packages/template/.cabgen/docker-helper.sh.cabgen b/packages/template/.cabgen/docker-helper.sh.cabgen index bf04d1f..a009de6 100644 --- a/packages/template/.cabgen/docker-helper.sh.cabgen +++ b/packages/template/.cabgen/docker-helper.sh.cabgen @@ -1,19 +1,19 @@ #!/bin/bash -if [ $1 = "--up" ]; then +if [ "$1" = "--up" ]; then # --rm removes container after exit # --service-ports maps ports to outside when using run docker-compose run --rm --service-ports service bash fi -if [ $1 = "--halt" ]; then +if [ "$1" = "--halt" ]; then echo echo "Stopping db container ..." docker stop <%= CAB_PROJECT_NAME %>_postgres echo fi -if [ $1 = "--destroy" ]; then +if [ "$1" = "--destroy" ]; then echo echo "Stopping db container ..." docker stop <%= CAB_PROJECT_NAME %>_postgres diff --git a/packages/template/ansible/provision.yaml b/packages/template/ansible/provision.yaml index 4810b1c..e263159 100644 --- a/packages/template/ansible/provision.yaml +++ b/packages/template/ansible/provision.yaml @@ -33,7 +33,7 @@ register: pg_repo - name: Setup PostgreSQL yum repository - yum: name=https://download.postgresql.org/pub/repos/yum/11/redhat/rhel-7-x86_64/pgdg-centos11-11-2.noarch.rpm state=present + yum: name=https://download.postgresql.org/pub/repos/yum/reporpms/EL-7-x86_64/pgdg-redhat-repo-latest.noarch.rpm state=present when: not pg_repo.stat.exists # Install Packages @@ -75,8 +75,13 @@ gpgkey: https://dl.yarnpkg.com/rpm/pubkey.gpg gpgcheck: yes + + # eventually you need to use a specific version of yarn + # yum --showduplicate list yarn + # sudo yum remove yarn + # sudo yum install yarn-1.19.2-1.noarch - name: Install Yarn - yum: name=yarn state=present + yum: name=yarn-1.19.2-1.noarch state=present # Install global NodeJS modules - name: Install required global node modules @@ -90,6 +95,7 @@ line='export PATH="$PATH:/usr/pgsql-11/bin"' insertbefore=EOF create=yes + ignore_errors: true - name: Symlink 'pg_config' to /usr/bin/ file: src=/usr/pgsql-11/bin/pg_config dest=/usr/bin/pg_config state=link diff --git a/packages/template/ansible/tasks/provision-vm.yaml b/packages/template/ansible/tasks/provision-vm.yaml index ee1f821..c7ed86e 100644 --- a/packages/template/ansible/tasks/provision-vm.yaml +++ b/packages/template/ansible/tasks/provision-vm.yaml @@ -1,6 +1,7 @@ # Included by provision.yaml. Tasks only for the real server. - name: Link vagrant shared directory (VM only) file: src=/vagrant dest={{ code_root }} state=link owner={{ project_user }} + ignore_errors: true - name: Ensure the firewalld service is running service: name=firewalld state=started enabled=yes diff --git a/packages/template/package.json b/packages/template/package.json index 04cadb0..8ad06c5 100644 --- a/packages/template/package.json +++ b/packages/template/package.json @@ -1,6 +1,6 @@ { "name": "template-aaa-backend", - "version": "2.2.5", + "version": "2.3.4", "private": true, "description": "the all about apps template project for a node.js backend service", "author": "all about apps", @@ -58,19 +58,19 @@ "utils": "LOG_LVL=fatal env-cmd ./env/service.env --no-override node build/scripts/utils.js" }, "dependencies": { - "@aaa-backend-stack/build-tools": "^2.2.0", - "@aaa-backend-stack/devtools": "^2.2.4", - "@aaa-backend-stack/git-info": "^2.2.4", - "@aaa-backend-stack/graphql": "^2.2.4", - "@aaa-backend-stack/graphql-rest-bindings": "^2.2.4", - "@aaa-backend-stack/logger": "^2.2.4", - "@aaa-backend-stack/mailer": "^2.2.4", - "@aaa-backend-stack/polyfills": "^2.2.4", - "@aaa-backend-stack/pushes": "^2.2.5", - "@aaa-backend-stack/rest": "^2.2.4", - "@aaa-backend-stack/serverdate": "^2.2.4", - "@aaa-backend-stack/storage": "^2.2.4", - "@aaa-backend-stack/utils": "^2.2.4", + "@aaa-backend-stack/build-tools": "^2.3.4", + "@aaa-backend-stack/devtools": "^2.3.4", + "@aaa-backend-stack/git-info": "^2.3.4", + "@aaa-backend-stack/graphql": "^2.3.4", + "@aaa-backend-stack/graphql-rest-bindings": "^2.3.4", + "@aaa-backend-stack/logger": "^2.3.4", + "@aaa-backend-stack/mailer": "^2.3.4", + "@aaa-backend-stack/polyfills": "^2.3.4", + "@aaa-backend-stack/pushes": "^2.3.4", + "@aaa-backend-stack/rest": "^2.3.4", + "@aaa-backend-stack/serverdate": "^2.3.4", + "@aaa-backend-stack/storage": "^2.3.4", + "@aaa-backend-stack/utils": "^2.3.4", "accepts": "1.3.5", "fb": "2.0.0", "google-auth-library": "1.6.1", @@ -78,8 +78,8 @@ "url-join": "4.0.0" }, "devDependencies": { - "@aaa-backend-stack/test-environment": "^2.2.4", - "@aaa-backend-stack/tslint-rules": "^2.2.0", + "@aaa-backend-stack/test-environment": "^2.3.4", + "@aaa-backend-stack/tslint-rules": "^2.3.4", "@types/accepts": "1.3.5", "@types/lodash": "4.14.144", "@types/url-join": "0.8.2", diff --git a/packages/tests/package.json b/packages/tests/package.json index dccb6a5..d1f2ff6 100644 --- a/packages/tests/package.json +++ b/packages/tests/package.json @@ -1,6 +1,6 @@ { "name": "@aaa-backend-stack/tests", - "version": "2.2.5", + "version": "2.3.4", "private": true, "description": "Integration tests", "license": "MIT", @@ -17,26 +17,26 @@ "test": "exit 0" }, "dependencies": { - "@aaa-backend-stack/build-tools": "^2.2.0", - "@aaa-backend-stack/devtools": "^2.2.4", - "@aaa-backend-stack/git-info": "^2.2.4", - "@aaa-backend-stack/graphql": "^2.2.4", - "@aaa-backend-stack/graphql-rest-bindings": "^2.2.4", - "@aaa-backend-stack/logger": "^2.2.4", - "@aaa-backend-stack/mailer": "^2.2.4", - "@aaa-backend-stack/polyfills": "^2.2.4", - "@aaa-backend-stack/pushes": "^2.2.5", - "@aaa-backend-stack/rest": "^2.2.4", - "@aaa-backend-stack/serverdate": "^2.2.4", - "@aaa-backend-stack/storage": "^2.2.4", - "@aaa-backend-stack/utils": "^2.2.4", + "@aaa-backend-stack/build-tools": "^2.3.4", + "@aaa-backend-stack/devtools": "^2.3.4", + "@aaa-backend-stack/git-info": "^2.3.4", + "@aaa-backend-stack/graphql": "^2.3.4", + "@aaa-backend-stack/graphql-rest-bindings": "^2.3.4", + "@aaa-backend-stack/logger": "^2.3.4", + "@aaa-backend-stack/mailer": "^2.3.4", + "@aaa-backend-stack/polyfills": "^2.3.4", + "@aaa-backend-stack/pushes": "^2.3.4", + "@aaa-backend-stack/rest": "^2.3.4", + "@aaa-backend-stack/serverdate": "^2.3.4", + "@aaa-backend-stack/storage": "^2.3.4", + "@aaa-backend-stack/utils": "^2.3.4", "@types/lodash": "4.14.144", "lodash": "4.17.15", - "template-aaa-backend": "^2.2.5" + "template-aaa-backend": "^2.3.4" }, "devDependencies": { - "@aaa-backend-stack/test-environment": "^2.2.4", - "@aaa-backend-stack/tslint-rules": "^2.2.0", + "@aaa-backend-stack/test-environment": "^2.3.4", + "@aaa-backend-stack/tslint-rules": "^2.3.4", "tslint": "5.11.0", "typescript": "3.7.2" }, diff --git a/packages/tslint-rules/package.json b/packages/tslint-rules/package.json index 193d5fd..b52834c 100644 --- a/packages/tslint-rules/package.json +++ b/packages/tslint-rules/package.json @@ -1,6 +1,6 @@ { "name": "@aaa-backend-stack/tslint-rules", - "version": "2.2.0", + "version": "2.3.4", "description": "aaa internal tslint rules", "license": "MIT", "author": "all about apps",