diff --git a/App/FeatureSet/Workers/Jobs/StatusPageCerts/StatusPageCerts.ts b/App/FeatureSet/Workers/Jobs/StatusPageCerts/StatusPageCerts.ts index d25a32d245..5d468efe57 100644 --- a/App/FeatureSet/Workers/Jobs/StatusPageCerts/StatusPageCerts.ts +++ b/App/FeatureSet/Workers/Jobs/StatusPageCerts/StatusPageCerts.ts @@ -17,16 +17,11 @@ import Express, { ExpressRouter, NextFunction, } from 'CommonServer/Utils/Express'; -import JSONFunctions from 'Common/Types/JSONFunctions'; import ClusterKeyAuthorization from 'CommonServer/Middleware/ClusterKeyAuthorization'; import { JSONObject } from 'Common/Types/JSON'; import Response from 'CommonServer/Utils/Response'; import LIMIT_MAX from 'Common/Types/Database/LimitMax'; import axios, { AxiosResponse } from 'axios'; -import GreenlockCertificate from 'Model/Models/GreenlockCertificate'; -import GreenlockCertificateService from 'CommonServer/Services/GreenlockCertificateService'; -import SelfSignedSSL from '../../Utils/SelfSignedSSL'; -import LocalFile from 'CommonServer/Utils/LocalFile'; const router: ExpressRouter = Express.getRouter(); @@ -348,154 +343,7 @@ RunCron( } ); -RunCron( - 'StatusPageCerts:WriteSelfSignedCertsToDisk', - { - schedule: IsDevelopment ? EVERY_MINUTE : EVERY_FIVE_MINUTE, - runOnStartup: true, - }, - async () => { - // Fetch all domains where certs are added to greenlock. - const certs: Array = - await GreenlockCertificateService.findBy({ - query: {}, - select: { - key: true, - }, - limit: LIMIT_MAX, - skip: 0, - props: { - isRoot: true, - }, - }); - - const statusPageDomains: Array = - await StatusPageDomainService.findBy({ - query: { - isSelfSignedSslGenerated: false, - }, - select: { - fullDomain: true, - _id: true, - }, - limit: LIMIT_MAX, - skip: 0, - props: { - isRoot: true, - ignoreHooks: true, - }, - }); - - const greenlockCertDomains: Array = certs.map( - (cert: GreenlockCertificate) => { - return cert.key; - } - ); - - // Generate self signed certs - for (const domain of statusPageDomains) { - if (greenlockCertDomains.includes(domain.fullDomain)) { - continue; - } - - if (!domain.fullDomain) { - continue; - } - - await SelfSignedSSL.generate( - '/usr/src/Certs/StatusPageCerts', - domain.fullDomain - ); - - await StatusPageDomainService.updateOneById({ - id: domain.id!, - data: { - isSelfSignedSslGenerated: true, - }, - props: { - ignoreHooks: true, - isRoot: true, - }, - }); - } - } -); - -RunCron( - 'StatusPageCerts:WriteGreelockCertsToDisk', - { schedule: IsDevelopment ? EVERY_MINUTE : EVERY_HOUR, runOnStartup: true }, - async () => { - // Fetch all domains where certs are added to greenlock. - - const certs: Array = - await GreenlockCertificateService.findBy({ - query: {}, - select: { - isKeyPair: true, - key: true, - blob: true, - }, - limit: LIMIT_MAX, - skip: 0, - props: { - isRoot: true, - }, - }); - - for (const cert of certs) { - if (!cert.isKeyPair) { - continue; - } - - const certBlob: GreenlockCertificate | undefined = certs.find( - (i: GreenlockCertificate) => { - return i.key === cert.key && !i.isKeyPair; - } - ); - - if (!certBlob) { - continue; - } - - const key: string = JSONFunctions.parse(cert.blob || '{}')[ - 'privateKeyPem' - ] as string; - let crt: string = JSONFunctions.parse(certBlob.blob || '{}')[ - 'cert' - ] as string; - - if (JSONFunctions.parse(certBlob.blob || '{}')['chain'] as string) { - crt += ('\n' + - '\n' + - JSONFunctions.parse(certBlob.blob || '{}')[ - 'chain' - ]) as string; - } - - // Need to make sure StatusPageCerts dir exists. - - try { - await LocalFile.makeDirectory('/usr/src/Certs/StatusPageCerts'); - } catch (err) { - // directory already exists, ignore. - logger.error('Create directory err'); - logger.error(err); - } - - // Write to disk. - await LocalFile.write( - `/usr/src/Certs/StatusPageCerts/${cert.key}.crt`, - crt - ); - - await LocalFile.write( - `/usr/src/Certs/StatusPageCerts/${cert.key}.key`, - key - ); - } - } -); RunCron( 'StatusPageCerts:CheckSslProvisioningStatus', diff --git a/Probe/Utils/Cron.ts b/CommonServer/Utils/BasicCron.ts similarity index 84% rename from Probe/Utils/Cron.ts rename to CommonServer/Utils/BasicCron.ts index fdd75798a9..06cda7fa3c 100644 --- a/Probe/Utils/Cron.ts +++ b/CommonServer/Utils/BasicCron.ts @@ -1,7 +1,7 @@ -import logger from 'CommonServer/Utils/Logger'; +import logger from './Logger'; import cron from 'node-cron'; -const RunCron: Function = ( +const BasicCron: Function = ( jobName: string, options: { schedule: string; @@ -25,4 +25,4 @@ const RunCron: Function = ( } }; -export default RunCron; +export default BasicCron; diff --git a/CommonServer/package-lock.json b/CommonServer/package-lock.json index 213047548a..40d7736c4a 100644 --- a/CommonServer/package-lock.json +++ b/CommonServer/package-lock.json @@ -30,6 +30,7 @@ "jsonwebtoken": "^9.0.0", "markdown-it": "^13.0.1", "Model": "file:../Model", + "node-cron": "^3.0.3", "nodemailer": "^6.7.3", "pg": "^8.7.3", "socket.io": "^4.7.2", @@ -51,6 +52,7 @@ "@types/jsonwebtoken": "^8.5.9", "@types/markdown-it": "^12.2.3", "@types/node": "^17.0.22", + "@types/node-cron": "^3.0.7", "@types/nodemailer": "^6.4.7", "jest": "^27.5.1", "jest-mock-extended": "^3.0.5", @@ -67,10 +69,10 @@ "axios": "^1.6.4", "crypto-js": "^4.1.1", "json5": "^2.2.3", - "moment": "^2.29.2", - "moment-timezone": "^0.5.40", - "posthog-js": "^1.77.0", - "reflect-metadata": "^0.1.13", + "moment": "^2.30.1", + "moment-timezone": "^0.5.44", + "posthog-js": "^1.96.1", + "reflect-metadata": "^0.2.1", "slugify": "^1.6.5", "typeorm": "^0.3.18", "uuid": "^8.3.2" @@ -4460,7 +4462,7 @@ "license": "ISC", "dependencies": { "Common": "file:../Common", - "typeorm": "^0.3.18" + "typeorm": "^0.3.19" }, "devDependencies": { "@types/jest": "^27.4.1", @@ -11308,6 +11310,12 @@ "version": "17.0.45", "license": "MIT" }, + "node_modules/@types/node-cron": { + "version": "3.0.11", + "resolved": "https://registry.npmjs.org/@types/node-cron/-/node-cron-3.0.11.tgz", + "integrity": "sha512-0ikrnug3/IyneSHqCBeslAhlK2aBfYek1fGo4bP4QnZPmiqSGRK+Oy7ZMisLWkesffJvQ1cqAcBnJC+8+nxIAg==", + "dev": true + }, "node_modules/@types/nodemailer": { "version": "6.4.14", "dev": true, @@ -14689,6 +14697,25 @@ "tslib": "^2.0.3" } }, + "node_modules/node-cron": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/node-cron/-/node-cron-3.0.3.tgz", + "integrity": "sha512-dOal67//nohNgYWb+nWmg5dkFdIwDm8EpeGYMekPMrngV3637lqnX0lbUcCtgibHTz6SEz7DAIjKvKDFYCnO1A==", + "dependencies": { + "uuid": "8.3.2" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/node-cron/node_modules/uuid": { + "version": "8.3.2", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz", + "integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==", + "bin": { + "uuid": "dist/bin/uuid" + } + }, "node_modules/node-fetch": { "version": "2.7.0", "license": "MIT", diff --git a/CommonServer/package.json b/CommonServer/package.json index 68da57e317..8c087da23f 100644 --- a/CommonServer/package.json +++ b/CommonServer/package.json @@ -36,6 +36,7 @@ "markdown-it": "^13.0.1", "Model": "file:../Model", "nodemailer": "^6.7.3", + "node-cron": "^3.0.3", "pg": "^8.7.3", "socket.io": "^4.7.2", "stripe": "^10.17.0", @@ -53,6 +54,7 @@ "@types/jest": "^27.4.1", "@types/jsonwebtoken": "^8.5.9", "@types/node": "^17.0.22", + "@types/node-cron": "^3.0.7", "jest": "^27.5.1", "ts-jest": "^27.1.4", "jest-mock-extended": "^3.0.5", diff --git a/Nginx/.dockerignore b/Nginx/.dockerignore new file mode 100755 index 0000000000..3ff05dd7b8 --- /dev/null +++ b/Nginx/.dockerignore @@ -0,0 +1,56 @@ +.git + +node_modules +# See https://help.github.com/ignore-files/ for more about ignoring files. + +# dependencies +/node_modules +node_modules + +.idea +# testing +/coverage + +# production +/build + +# misc +.DS_Store + +env.js + +npm-debug.log* +yarn-debug.log* +yarn-error.log* + +yarn.lock +Untitled-1 +*.local.sh +*.local.yaml +run +stop + +nohup.out* + +encrypted-credentials.tar +encrypted-credentials/ + +_README.md + +# Important Add production values to gitignore. +values-saas-production.yaml +kubernetes/values-saas-production.yaml + +/private + +/tls_cert.pem +/tls_key.pem +/keys + +temp_readme.md + +tests/coverage + +settings.json + +GoSDK/tester/ \ No newline at end of file diff --git a/Nginx/.gitattributes b/Nginx/.gitattributes new file mode 100644 index 0000000000..30ddbbb6cb --- /dev/null +++ b/Nginx/.gitattributes @@ -0,0 +1 @@ +*.js text eol=lf \ No newline at end of file diff --git a/Nginx/.gitignore b/Nginx/.gitignore new file mode 100755 index 0000000000..d69202ec7a --- /dev/null +++ b/Nginx/.gitignore @@ -0,0 +1,30 @@ +# See https://help.github.com/ignore-files/ for more about ignoring files. + +# dependencies +#/backend/node_modules +/kubernetes +/node_modules +.idea + +# misc +.DS_Store + + +npm-debug.log* +yarn-debug.log* +yarn-error.log* +yarn.lock + +**/*/paymentService.test.js +apiTest.rest + +application_security_dir +container_security_dir + +# coverage +/coverage +/.nyc_output + +/greenlock.d/config.json +/greenlock.d/config.json.bak +/.greenlockrc \ No newline at end of file diff --git a/Nginx/Dockerfile.tpl b/Nginx/Dockerfile.tpl index b92f07c733..bb7c4ef0e7 100644 --- a/Nginx/Dockerfile.tpl +++ b/Nginx/Dockerfile.tpl @@ -1,4 +1,4 @@ -FROM nginx:1.25.3-alpine as nginx +FROM nginx:1.25.3-alpine USER root @@ -9,14 +9,51 @@ ENV GIT_SHA=${GIT_SHA} ENV APP_VERSION=${APP_VERSION} # Install bash. -RUN apk add bash && apk add curl +RUN apk add bash && apk add curl && apk add openssl # Install NJS module RUN apk add nginx-module-njs -COPY ./Nginx/customssl.js /etc/nginx/customssl.js COPY ./Nginx/default.conf.template /etc/nginx/templates/default.conf.template COPY ./Nginx/nginx.conf /etc/nginx/nginx.conf +# Now install nodejs + +RUN apk add nodejs npm + +RUN mkdir /usr/src + +WORKDIR /usr/src/Common +COPY ./Common/package*.json /usr/src/Common/ +RUN npm install +COPY ./Common /usr/src/Common + + +WORKDIR /usr/src/Model +COPY ./Model/package*.json /usr/src/Model/ +RUN npm install +COPY ./Model /usr/src/Model + + +WORKDIR /usr/src/CommonServer +COPY ./CommonServer/package*.json /usr/src/CommonServer/ +RUN npm install +COPY ./CommonServer /usr/src/CommonServer + +ENV PRODUCTION=true + +WORKDIR /usr/src/app + +# Install app dependencies +COPY ./Nginx/package*.json /usr/src/app/ +RUN npm install + +COPY ./Nginx /usr/src/app +# Bundle app source +RUN npm run compile + +RUN chmod +x ./run.sh + +CMD ./run.sh diff --git a/Nginx/Index.ts b/Nginx/Index.ts new file mode 100644 index 0000000000..76233f49f6 --- /dev/null +++ b/Nginx/Index.ts @@ -0,0 +1,30 @@ +import logger from 'CommonServer/Utils/Logger'; +import App from 'CommonServer/Utils/StartServer'; +import { PostgresAppInstance } from 'CommonServer/Infrastructure/PostgresDatabase'; + +process.env['PORT'] = "7845"; + +const APP_NAME: string = 'ingress'; + +const init: () => Promise = async (): Promise => { + try { + // init the app + await App(APP_NAME); + + // connect to the database. + await PostgresAppInstance.connect( + PostgresAppInstance.getDatasourceOptions() + ); + + } catch (err) { + logger.error('App Init Failed:'); + logger.error(err); + throw err; + } +}; + +init().catch((err: Error) => { + logger.error(err); + logger.info('Exiting node process'); + process.exit(1); +}); diff --git a/Nginx/Jobs/FetchCertificates.ts b/Nginx/Jobs/FetchCertificates.ts new file mode 100644 index 0000000000..1025cb00e9 --- /dev/null +++ b/Nginx/Jobs/FetchCertificates.ts @@ -0,0 +1,169 @@ +import { + EVERY_FIVE_MINUTE, + EVERY_HOUR, + EVERY_MINUTE, +} from 'Common/Utils/CronTime'; +import BasicCron from 'CommonServer/Utils/BasicCron'; +import { IsDevelopment } from 'CommonServer/EnvironmentConfig'; +// @ts-ignore +import Greenlock from 'greenlock'; +import logger from 'CommonServer/Utils/Logger'; +import JSONFunctions from 'Common/Types/JSONFunctions'; +import LIMIT_MAX from 'Common/Types/Database/LimitMax'; +import GreenlockCertificate from 'Model/Models/GreenlockCertificate'; +import GreenlockCertificateService from 'CommonServer/Services/GreenlockCertificateService'; +import LocalFile from 'CommonServer/Utils/LocalFile'; +import StatusPageDomain from 'Model/Models/StatusPageDomain'; +import StatusPageDomainService from 'CommonServer/Services/StatusPageDomainService'; +import SelfSignedSSL from '../Utils/SelfSignedSSL'; + +BasicCron( + 'StatusPageCerts:WriteGreelockCertsToDisk', + { schedule: IsDevelopment ? EVERY_MINUTE : EVERY_HOUR, runOnStartup: true }, + async () => { + // Fetch all domains where certs are added to greenlock. + + const certs: Array = + await GreenlockCertificateService.findBy({ + query: {}, + select: { + isKeyPair: true, + key: true, + blob: true, + }, + limit: LIMIT_MAX, + skip: 0, + props: { + isRoot: true, + }, + }); + + for (const cert of certs) { + if (!cert.isKeyPair) { + continue; + } + + const certBlob: GreenlockCertificate | undefined = certs.find( + (i: GreenlockCertificate) => { + return i.key === cert.key && !i.isKeyPair; + } + ); + + if (!certBlob) { + continue; + } + + const key: string = JSONFunctions.parse(cert.blob || '{}')[ + 'privateKeyPem' + ] as string; + let crt: string = JSONFunctions.parse(certBlob.blob || '{}')[ + 'cert' + ] as string; + + if (JSONFunctions.parse(certBlob.blob || '{}')['chain'] as string) { + crt += ('\n' + + '\n' + + JSONFunctions.parse(certBlob.blob || '{}')[ + 'chain' + ]) as string; + } + + // Need to make sure StatusPageCerts dir exists. + + try { + await LocalFile.makeDirectory('/etc/nginx/certs'); + } catch (err) { + // directory already exists, ignore. + logger.error('Create directory err'); + logger.error(err); + } + + // Write to disk. + await LocalFile.write( + `/etc/nginx/certs/${cert.key}.crt`, + crt + ); + + await LocalFile.write( + `/etc/nginx/certs/${cert.key}.key`, + key + ); + } + } +); + + + +BasicCron( + 'StatusPageCerts:WriteSelfSignedCertsToDisk', + { + schedule: IsDevelopment ? EVERY_MINUTE : EVERY_FIVE_MINUTE, + runOnStartup: true, + }, + async () => { + // Fetch all domains where certs are added to greenlock. + + const certs: Array = + await GreenlockCertificateService.findBy({ + query: {}, + select: { + key: true, + }, + limit: LIMIT_MAX, + skip: 0, + props: { + isRoot: true, + }, + }); + + const statusPageDomains: Array = + await StatusPageDomainService.findBy({ + query: { + isSelfSignedSslGenerated: false, + }, + select: { + fullDomain: true, + _id: true, + }, + limit: LIMIT_MAX, + skip: 0, + props: { + isRoot: true, + ignoreHooks: true, + }, + }); + + const greenlockCertDomains: Array = certs.map( + (cert: GreenlockCertificate) => { + return cert.key; + } + ); + + // Generate self signed certs + for (const domain of statusPageDomains) { + if (greenlockCertDomains.includes(domain.fullDomain)) { + continue; + } + + if (!domain.fullDomain) { + continue; + } + + await SelfSignedSSL.generate( + '/etc/nginx/certs', + domain.fullDomain + ); + + await StatusPageDomainService.updateOneById({ + id: domain.id!, + data: { + isSelfSignedSslGenerated: true, + }, + props: { + ignoreHooks: true, + isRoot: true, + }, + }); + } + } +); diff --git a/App/FeatureSet/Workers/Utils/SelfSignedSSL.ts b/Nginx/Utils/SelfSignedSSL.ts similarity index 100% rename from App/FeatureSet/Workers/Utils/SelfSignedSSL.ts rename to Nginx/Utils/SelfSignedSSL.ts diff --git a/Nginx/package-lock.json b/Nginx/package-lock.json index 08647f157e..601bb8eb62 100644 --- a/Nginx/package-lock.json +++ b/Nginx/package-lock.json @@ -9,98 +9,333 @@ "version": "1.0.0", "license": "ISC", "dependencies": { - "axios": "^1.6.7" + "Common": "file:../Common", + "CommonServer": "file:../CommonServer", + "ejs": "^3.1.9", + "handlebars": "^4.7.8", + "Model": "file:../Model" } }, - "node_modules/asynckit": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", - "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==" - }, - "node_modules/axios": { - "version": "1.6.7", - "resolved": "https://registry.npmjs.org/axios/-/axios-1.6.7.tgz", - "integrity": "sha512-/hDJGff6/c7u0hDkvkGxR/oy6CbCs8ziCsC7SqmhjfozqiJGc8Z11wrv9z9lYfY4K8l+H9TpjcMDX0xOZmx+RA==", - "dependencies": { - "follow-redirects": "^1.15.4", - "form-data": "^4.0.0", - "proxy-from-env": "^1.1.0" - } - }, - "node_modules/combined-stream": { - "version": "1.0.8", - "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", - "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", - "dependencies": { - "delayed-stream": "~1.0.0" - }, - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/delayed-stream": { + "../Common": { + "name": "common", "version": "1.0.0", - "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", - "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==", - "engines": { - "node": ">=0.4.0" - } - }, - "node_modules/follow-redirects": { - "version": "1.15.5", - "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.5.tgz", - "integrity": "sha512-vSFWUON1B+yAw1VN4xMfxgn5fTUiaOzAJCKBwIIgT/+7CuGy9+r+5gITvP62j3RmaD5Ph65UaERdOSRGUzZtgw==", - "funding": [ - { - "type": "individual", - "url": "https://github.com/sponsors/RubenVerborgh" - } - ], - "engines": { - "node": ">=4.0" + "license": "MIT", + "dependencies": { + "@types/crypto-js": "^4.1.1", + "@types/uuid": "^8.3.4", + "axios": "^1.6.4", + "crypto-js": "^4.1.1", + "json5": "^2.2.3", + "moment": "^2.30.1", + "moment-timezone": "^0.5.44", + "posthog-js": "^1.96.1", + "reflect-metadata": "^0.2.1", + "slugify": "^1.6.5", + "typeorm": "^0.3.18", + "uuid": "^8.3.2" }, - "peerDependenciesMeta": { - "debug": { - "optional": true - } + "devDependencies": { + "@faker-js/faker": "^8.0.2", + "@types/jest": "^27.5.2", + "@types/node": "^17.0.22", + "jest": "^27.5.1", + "ts-jest": "^27.1.4" } }, - "node_modules/form-data": { + "../CommonServer": { + "name": "common-server", + "version": "1.0.0", + "license": "MIT", + "dependencies": { + "@clickhouse/client": "^0.2.7", + "@elastic/elasticsearch": "^8.11.0", + "@opentelemetry/api": "^1.7.0", + "@opentelemetry/auto-instrumentations-node": "^0.40.1", + "@opentelemetry/sdk-node": "^0.45.1", + "@socket.io/redis-adapter": "^8.2.1", + "airtable": "^0.12.2", + "axios": "^1.6.4", + "bullmq": "^3.6.6", + "Common": "file:../Common", + "cookie-parser": "^1.4.6", + "cors": "^2.8.5", + "cron-parser": "^4.8.1", + "dotenv": "^16.0.0", + "ejs": "^3.1.8", + "express": "^4.17.3", + "ioredis": "^5.3.2", + "json2csv": "^5.0.7", + "jsonwebtoken": "^9.0.0", + "markdown-it": "^13.0.1", + "Model": "file:../Model", + "nodemailer": "^6.7.3", + "pg": "^8.7.3", + "socket.io": "^4.7.2", + "stripe": "^10.17.0", + "twilio": "^4.19.3", + "typeorm": "^0.3.18", + "typeorm-extension": "^2.2.13", + "vm2": "^3.9.14", + "winston": "^3.6.0" + }, + "devDependencies": { + "@faker-js/faker": "^6.3.1", + "@types/cookie-parser": "^1.4.4", + "@types/cors": "^2.8.12", + "@types/ejs": "^3.1.1", + "@types/express": "^4.17.13", + "@types/jest": "^27.4.1", + "@types/json2csv": "^5.0.3", + "@types/jsonwebtoken": "^8.5.9", + "@types/markdown-it": "^12.2.3", + "@types/node": "^17.0.22", + "@types/nodemailer": "^6.4.7", + "jest": "^27.5.1", + "jest-mock-extended": "^3.0.5", + "ts-jest": "^27.1.4" + } + }, + "../Model": { + "name": "model", + "version": "1.0.0", + "license": "ISC", + "dependencies": { + "Common": "file:../Common", + "typeorm": "^0.3.19" + }, + "devDependencies": { + "@types/jest": "^27.4.1", + "@types/node": "^17.0.22", + "jest": "^27.5.1", + "ts-jest": "^27.1.4" + } + }, + "node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/async": { + "version": "3.2.5", + "resolved": "https://registry.npmjs.org/async/-/async-3.2.5.tgz", + "integrity": "sha512-baNZyqaaLhyLVKm/DlvdW051MSgO6b8eVfIezl9E5PqWxFgzLm/wQntEW4zOytVburDEr0JlALEpdOFwvErLsg==" + }, + "node_modules/balanced-match": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==" + }, + "node_modules/brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==" + }, + "node_modules/Common": { + "resolved": "../Common", + "link": true + }, + "node_modules/CommonServer": { + "resolved": "../CommonServer", + "link": true + }, + "node_modules/concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==" + }, + "node_modules/ejs": { + "version": "3.1.9", + "resolved": "https://registry.npmjs.org/ejs/-/ejs-3.1.9.tgz", + "integrity": "sha512-rC+QVNMJWv+MtPgkt0y+0rVEIdbtxVADApW9JXrUVlzHetgcyczP/E7DJmWJ4fJCZF2cPcBk0laWO9ZHMG3DmQ==", + "dependencies": { + "jake": "^10.8.5" + }, + "bin": { + "ejs": "bin/cli.js" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/filelist": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/filelist/-/filelist-1.0.4.tgz", + "integrity": "sha512-w1cEuf3S+DrLCQL7ET6kz+gmlJdbq9J7yXCSjK/OZCPA+qEN1WyF4ZAf0YYJa4/shHJra2t/d/r8SV4Ji+x+8Q==", + "dependencies": { + "minimatch": "^5.0.1" + } + }, + "node_modules/filelist/node_modules/brace-expansion": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", + "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "dependencies": { + "balanced-match": "^1.0.0" + } + }, + "node_modules/filelist/node_modules/minimatch": { + "version": "5.1.6", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.6.tgz", + "integrity": "sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g==", + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/handlebars": { + "version": "4.7.8", + "resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.7.8.tgz", + "integrity": "sha512-vafaFqs8MZkRrSX7sFVUdo3ap/eNiLnb4IakshzvP56X5Nr1iGKAIqdX6tMlm6HcNRIkr6AxO5jFEoJzzpT8aQ==", + "dependencies": { + "minimist": "^1.2.5", + "neo-async": "^2.6.2", + "source-map": "^0.6.1", + "wordwrap": "^1.0.0" + }, + "bin": { + "handlebars": "bin/handlebars" + }, + "engines": { + "node": ">=0.4.7" + }, + "optionalDependencies": { + "uglify-js": "^3.1.4" + } + }, + "node_modules/has-flag": { "version": "4.0.0", - "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz", - "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "engines": { + "node": ">=8" + } + }, + "node_modules/jake": { + "version": "10.8.7", + "resolved": "https://registry.npmjs.org/jake/-/jake-10.8.7.tgz", + "integrity": "sha512-ZDi3aP+fG/LchyBzUM804VjddnwfSfsdeYkwt8NcbKRvo4rFkjhs456iLFn3k2ZUWvNe4i48WACDbza8fhq2+w==", "dependencies": { - "asynckit": "^0.4.0", - "combined-stream": "^1.0.8", - "mime-types": "^2.1.12" + "async": "^3.2.3", + "chalk": "^4.0.2", + "filelist": "^1.0.4", + "minimatch": "^3.1.2" + }, + "bin": { + "jake": "bin/cli.js" }, "engines": { - "node": ">= 6" + "node": ">=10" } }, - "node_modules/mime-db": { - "version": "1.52.0", - "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", - "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/mime-types": { - "version": "2.1.35", - "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", - "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", + "node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", "dependencies": { - "mime-db": "1.52.0" + "brace-expansion": "^1.1.7" }, "engines": { - "node": ">= 0.6" + "node": "*" } }, - "node_modules/proxy-from-env": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz", - "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==" + "node_modules/minimist": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz", + "integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/Model": { + "resolved": "../Model", + "link": true + }, + "node_modules/neo-async": { + "version": "2.6.2", + "resolved": "https://registry.npmjs.org/neo-async/-/neo-async-2.6.2.tgz", + "integrity": "sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==" + }, + "node_modules/source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/uglify-js": { + "version": "3.17.4", + "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.17.4.tgz", + "integrity": "sha512-T9q82TJI9e/C1TAxYvfb16xO120tMVFZrGA3f9/P4424DNu6ypK103y0GPFVa17yotwSyZW5iYXgjYHkGrJW/g==", + "optional": true, + "bin": { + "uglifyjs": "bin/uglifyjs" + }, + "engines": { + "node": ">=0.8.0" + } + }, + "node_modules/wordwrap": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-1.0.0.tgz", + "integrity": "sha512-gvVzJFlPycKc5dZN4yPkP8w7Dc37BtP1yczEneOb4uq34pXZcvrtRTmWV8W+Ume+XCxKgbjM+nevkyFPMybd4Q==" } } } diff --git a/Nginx/package.json b/Nginx/package.json index 3bc346a679..8544dbbf7f 100644 --- a/Nginx/package.json +++ b/Nginx/package.json @@ -4,11 +4,23 @@ "description": "", "main": "index.js", "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" + "test": "echo \"Error: no test specified\" && exit 1", + "start": "node --require ts-node/register Index.ts", + "compile": "tsc" }, "author": "", "license": "ISC", "dependencies": { - "axios": "^1.6.7" + "Common": "file:../Common", + "CommonServer": "file:../CommonServer", + "ejs": "^3.1.9", + "handlebars": "^4.7.8", + "Model": "file:../Model", + "ts-node": "^10.9.1" + }, + "devDependencies": { + "@types/jest": "^29.5.11", + "@types/node": "^17.0.31", + "jest": "^28.1.0" } } diff --git a/Nginx/run.sh b/Nginx/run.sh new file mode 100644 index 0000000000..df40f62268 --- /dev/null +++ b/Nginx/run.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +# Start the first process +nginx -g "daemon off;" & + +# Start the second process +npm start & + +# Wait for any process to exit +wait -n + +# Exit with status of process that exited first +exit $? \ No newline at end of file diff --git a/Nginx/tsconfig.json b/Nginx/tsconfig.json new file mode 100644 index 0000000000..fc24bb33b1 --- /dev/null +++ b/Nginx/tsconfig.json @@ -0,0 +1,110 @@ +{ + "ts-node": { + // these options are overrides used only by ts-node + // same as the --compilerOptions flag and the TS_NODE_COMPILER_OPTIONS environment variable + "compilerOptions": { + "module": "commonjs" + } + }, + "compilerOptions": { + /* Visit https://aka.ms/tsconfig.json to read more about this file */ + + /* Projects */ + // "incremental": true, /* Enable incremental compilation */ + // "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */ + // "tsBuildInfoFile": "./", /* Specify the folder for .tsbuildinfo incremental compilation files. */ + // "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects */ + // "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */ + // "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */ + + /* Language and Environment */ + "target": "es2017" /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */, + // "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */ + "jsx": "react" /* Specify what JSX code is generated. */, + "experimentalDecorators": true, /* Enable experimental support for TC39 stage 2 draft decorators. */ + "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */ + // "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h' */ + // "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */ + // "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using `jsx: react-jsx*`.` */ + // "reactNamespace": "", /* Specify the object invoked for `createElement`. This only applies when targeting `react` JSX emit. */ + // "noLib": true, /* Disable including any library files, including the default lib.d.ts. */ + // "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */ + + /* Modules */ + // "module": "es2022" /* Specify what module code is generated. */, + // "rootDir": "./", /* Specify the root folder within your source files. */ + "moduleResolution": "node", /* Specify how TypeScript looks up a file from a given module specifier. */ + // "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */ + // "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */ + // "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */ + "typeRoots": [ + "./node_modules/@types" + ], /* Specify multiple folders that act like `./node_modules/@types`. */ + "types": ["node", "jest"], /* Specify type package names to be included without being referenced in a source file. */ + // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */ + // "resolveJsonModule": true, /* Enable importing .json files */ + // "noResolve": true, /* Disallow `import`s, `require`s or ``s from expanding the number of files TypeScript should add to a project. */ + + /* JavaScript Support */ + // "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the `checkJS` option to get errors from these files. */ + // "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */ + // "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from `node_modules`. Only applicable with `allowJs`. */ + + /* Emit */ + // "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */ + // "declarationMap": true, /* Create sourcemaps for d.ts files. */ + // "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */ + "sourceMap": true, /* Create source map files for emitted JavaScript files. */ + // "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If `declaration` is true, also designates a file that bundles all .d.ts output. */ + "outDir": "./build/dist", /* Specify an output folder for all emitted files. */ + // "removeComments": true, /* Disable emitting comments. */ + // "noEmit": true, /* Disable emitting files from a compilation. */ + // "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */ + // "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types */ + // "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */ + // "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */ + // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */ + // "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */ + // "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */ + // "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */ + // "newLine": "crlf", /* Set the newline character for emitting files. */ + // "stripInternal": true, /* Disable emitting declarations that have `@internal` in their JSDoc comments. */ + // "noEmitHelpers": true, /* Disable generating custom helper functions like `__extends` in compiled output. */ + // "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */ + // "preserveConstEnums": true, /* Disable erasing `const enum` declarations in generated code. */ + // "declarationDir": "./", /* Specify the output directory for generated declaration files. */ + // "preserveValueImports": true, /* Preserve unused imported values in the JavaScript output that would otherwise be removed. */ + + /* Interop Constraints */ + // "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */ + // "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */ + "esModuleInterop": true /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables `allowSyntheticDefaultImports` for type compatibility. */, + // "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */ + "forceConsistentCasingInFileNames": true /* Ensure that casing is correct in imports. */, + + /* Type Checking */ + "strict": true /* Enable all strict type-checking options. */, + "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied `any` type.. */ + "strictNullChecks": true, /* When type checking, take into account `null` and `undefined`. */ + "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */ + "strictBindCallApply": true, /* Check that the arguments for `bind`, `call`, and `apply` methods match the original function. */ + "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */ + "noImplicitThis": true, /* Enable error reporting when `this` is given the type `any`. */ + "useUnknownInCatchVariables": true, /* Type catch clause variables as 'unknown' instead of 'any'. */ + "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */ + "noUnusedLocals": true, /* Enable error reporting when a local variables aren't read. */ + "noUnusedParameters": true, /* Raise an error when a function parameter isn't read */ + "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */ + "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */ + "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */ + "noUncheckedIndexedAccess": true, /* Include 'undefined' in index signature results */ + "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */ + "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type */ + // "allowUnusedLabels": true, /* Disable error reporting for unused labels. */ + // "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */ + + /* Completeness */ + // "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */ + "skipLibCheck": true /* Skip type checking all .d.ts files. */ + } +} diff --git a/Probe/Jobs/Alive.ts b/Probe/Jobs/Alive.ts index e0674b6d04..7321a0ab67 100644 --- a/Probe/Jobs/Alive.ts +++ b/Probe/Jobs/Alive.ts @@ -1,5 +1,4 @@ import API from 'Common/Utils/API'; -import RunCron from '../Utils/Cron'; import { EVERY_MINUTE } from 'Common/Utils/CronTime'; import { INGESTOR_URL } from '../Config'; import LocalCache from 'CommonServer/Infrastructure/LocalCache'; @@ -7,8 +6,9 @@ import URL from 'Common/Types/API/URL'; import logger from 'CommonServer/Utils/Logger'; import ProbeAPIRequest from '../Utils/ProbeAPIRequest'; import Register from '../Services/Register'; +import BasicCron from 'CommonServer/Utils/BasicCron'; -RunCron( +BasicCron( 'Basic:Alive', { schedule: EVERY_MINUTE, diff --git a/Probe/package-lock.json b/Probe/package-lock.json index 104d349d37..a6828f8ac7 100644 --- a/Probe/package-lock.json +++ b/Probe/package-lock.json @@ -15,14 +15,12 @@ "CommonServer": "file:../CommonServer", "ejs": "^3.1.8", "Model": "file:../Model", - "node-cron": "^3.0.3", "ping": "^0.4.4", "ts-node": "^10.9.1" }, "devDependencies": { "@types/jest": "^27.5.2", "@types/node": "^17.0.31", - "@types/node-cron": "^3.0.7", "jest": "^28.1.0", "nodemon": "^2.0.20", "ts-jest": "^28.0.2" @@ -35,15 +33,15 @@ "dependencies": { "@types/crypto-js": "^4.1.1", "@types/uuid": "^8.3.4", - "axios": "^1.6.2", + "axios": "^1.6.4", "crypto-js": "^4.1.1", "json5": "^2.2.3", - "moment": "^2.29.2", - "moment-timezone": "^0.5.40", - "posthog-js": "^1.77.0", - "reflect-metadata": "^0.1.13", + "moment": "^2.30.1", + "moment-timezone": "^0.5.44", + "posthog-js": "^1.96.1", + "reflect-metadata": "^0.2.1", "slugify": "^1.6.5", - "typeorm": "^0.3.6", + "typeorm": "^0.3.18", "uuid": "^8.3.2" }, "devDependencies": { @@ -59,14 +57,14 @@ "version": "1.0.0", "license": "MIT", "dependencies": { - "@clickhouse/client": "^0.2.1", - "@elastic/elasticsearch": "^8.1.0", + "@clickhouse/client": "^0.2.7", + "@elastic/elasticsearch": "^8.11.0", "@opentelemetry/api": "^1.7.0", "@opentelemetry/auto-instrumentations-node": "^0.40.1", "@opentelemetry/sdk-node": "^0.45.1", "@socket.io/redis-adapter": "^8.2.1", "airtable": "^0.12.2", - "axios": "^1.6.2", + "axios": "^1.6.4", "bullmq": "^3.6.6", "Common": "file:../Common", "cookie-parser": "^1.4.6", @@ -80,12 +78,13 @@ "jsonwebtoken": "^9.0.0", "markdown-it": "^13.0.1", "Model": "file:../Model", + "node-cron": "^3.0.3", "nodemailer": "^6.7.3", "pg": "^8.7.3", "socket.io": "^4.7.2", "stripe": "^10.17.0", "twilio": "^4.19.3", - "typeorm": "^0.3.10", + "typeorm": "^0.3.18", "typeorm-extension": "^2.2.13", "vm2": "^3.9.14", "winston": "^3.6.0" @@ -101,6 +100,7 @@ "@types/jsonwebtoken": "^8.5.9", "@types/markdown-it": "^12.2.3", "@types/node": "^17.0.22", + "@types/node-cron": "^3.0.7", "@types/nodemailer": "^6.4.7", "jest": "^27.5.1", "jest-mock-extended": "^3.0.5", @@ -113,7 +113,7 @@ "license": "ISC", "dependencies": { "Common": "file:../Common", - "typeorm": "^0.3.17" + "typeorm": "^0.3.19" }, "devDependencies": { "@types/jest": "^27.4.1", @@ -1284,12 +1284,6 @@ "resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.45.tgz", "integrity": "sha512-w+tIMs3rq2afQdsPJlODhoUEKzFP1ayaoyl1CcnwtIlsVe7K7bA1NGm4s3PraqTLlXnbIN84zuBlxBWo1u9BLw==" }, - "node_modules/@types/node-cron": { - "version": "3.0.11", - "resolved": "https://registry.npmjs.org/@types/node-cron/-/node-cron-3.0.11.tgz", - "integrity": "sha512-0ikrnug3/IyneSHqCBeslAhlK2aBfYek1fGo4bP4QnZPmiqSGRK+Oy7ZMisLWkesffJvQ1cqAcBnJC+8+nxIAg==", - "dev": true - }, "node_modules/@types/ping": { "version": "0.4.4", "resolved": "https://registry.npmjs.org/@types/ping/-/ping-0.4.4.tgz", @@ -3715,17 +3709,6 @@ "integrity": "sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==", "dev": true }, - "node_modules/node-cron": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/node-cron/-/node-cron-3.0.3.tgz", - "integrity": "sha512-dOal67//nohNgYWb+nWmg5dkFdIwDm8EpeGYMekPMrngV3637lqnX0lbUcCtgibHTz6SEz7DAIjKvKDFYCnO1A==", - "dependencies": { - "uuid": "8.3.2" - }, - "engines": { - "node": ">=6.0.0" - } - }, "node_modules/node-int64": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/node-int64/-/node-int64-0.4.0.tgz", @@ -4624,14 +4607,6 @@ "browserslist": ">= 4.21.0" } }, - "node_modules/uuid": { - "version": "8.3.2", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz", - "integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==", - "bin": { - "uuid": "dist/bin/uuid" - } - }, "node_modules/v8-compile-cache-lib": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz", diff --git a/Probe/package.json b/Probe/package.json index 1f75a8a055..3c47fd5518 100644 --- a/Probe/package.json +++ b/Probe/package.json @@ -23,14 +23,12 @@ "CommonServer": "file:../CommonServer", "ejs": "^3.1.8", "Model": "file:../Model", - "node-cron": "^3.0.3", "ping": "^0.4.4", "ts-node": "^10.9.1" }, "devDependencies": { "@types/jest": "^27.5.2", "@types/node": "^17.0.31", - "@types/node-cron": "^3.0.7", "jest": "^28.1.0", "nodemon": "^2.0.20", "ts-jest": "^28.0.2" diff --git a/docker-compose.base.yml b/docker-compose.base.yml index 7575fd373a..fc1eb087fd 100644 --- a/docker-compose.base.yml +++ b/docker-compose.base.yml @@ -238,8 +238,6 @@ services: links: - redis - postgres - volumes: - - ./Certs:/usr/src/Certs logging: driver: "local" options: @@ -334,12 +332,10 @@ services: networks: - oneuptime environment: - <<: *common-variables + <<: *common-server-variables ports: - '${ONEUPTIME_HTTP_PORT}:80' - '${ONEUPTIME_HTTPS_PORT}:443' - volumes: - - ./Certs:/etc/nginx/certs logging: driver: "local" options: