add probe docker file

This commit is contained in:
Simon Larsen
2023-05-02 15:29:22 +01:00
parent d873bafedb
commit 27420261a0
24 changed files with 367 additions and 25818 deletions

14
.vscode/launch.json vendored
View File

@@ -41,6 +41,20 @@
"restart": true,
"autoAttachChildProcesses": true
},
{
"address": "127.0.0.1",
"localRoot": "${workspaceFolder}/Probe",
"name": "Dashboard API: Debug with Docker",
"port": 9655,
"remoteRoot": "/usr/src/app",
"request": "attach",
"skipFiles": [
"<node_internals>/**"
],
"type": "node",
"restart": true,
"autoAttachChildProcesses": true
},
{
"address": "127.0.0.1",
"localRoot": "${workspaceFolder}/ProbeAPI",

View File

@@ -22,6 +22,10 @@ upstream api-reference {
server api-reference:1445 weight=10 max_fails=3 fail_timeout=30s;
}
upstream probe-api {
server api-reference:3400 weight=10 max_fails=3 fail_timeout=30s;
}
upstream alert {
server alert:3088 weight=10 max_fails=3 fail_timeout=30s;
}
@@ -207,6 +211,21 @@ server {
proxy_pass http://mail;
}
location /probe-api {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
# enable WebSockets (for ws://sockjs not connected error in the accounts source: https://stackoverflow.com/questions/41381444/websocket-connection-failed-error-during-websocket-handshake-unexpected-respon)
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_pass http://probe-api;
client_max_body_size 50M;
}
location /dashboard {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;

View File

@@ -1,56 +0,0 @@
.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/

View File

@@ -1,7 +1 @@
ONEUPTIME_SECRET=f414c23b4cdf4e84a6a66ecfd528eff2
PROBE_NAME=US
PROBE_KEY=33b674ca-9fdd-11e9-a2a3-2a2ae2dbccez
SERVER_URL=http://localhost:3002
DATA_INGESTOR_URL=http://localhost:3200
RESOURCES_LIMIT=10
PROBE_API_URL=http://localhost:3400
PORT=3087

1
Probe/.env.tpl Normal file
View File

@@ -0,0 +1 @@
PORT={{ .Env.PROBE_PORT }}

View File

@@ -1 +0,0 @@
*.js text eol=lf

3
Probe/.gitignore vendored
View File

@@ -1,3 +0,0 @@
node_modules
kubernetes
debug.log

View File

@@ -1,17 +0,0 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Launch Program",
"skipFiles": [
"<node_internals>/**"
],
"program": "${workspaceFolder}/index.js"
}
]
}

View File

@@ -1,46 +0,0 @@
import ObjectID from 'Common/Types/ObjectID';
import PositiveNumber from 'Common/Types/PositiveNumber';
export const COMMAND: $TSFixMe = {
linux: {
load: "top -b -n 2 | egrep --color 'load average|%Cpu'",
cpu: "egrep --color 'processor|cores' /proc/cpuinfo",
mem: "egrep --color 'Mem|Swap' /proc/meminfo",
disk: "df -h | egrep --color '/dev/xvda1|/dev/sda7|/dev/nvme0n1p1'",
temp: "sensors | egrep --color 'CPU'",
},
darwin: {
load: "top -l 1 | egrep --color 'Load Avg|CPU usage'",
cpu: 'sysctl -n machdep.cpu.core_count',
mem: {
used: "top -l 1 | egrep --color 'PhysMem'",
total: 'sysctl -n hw.memsize',
swap: 'sysctl -n vm.swapusage',
},
disk: "df -h | egrep --color '/dev/disk1s2'",
temp: 'sysctl -n machdep.xcpm.cpu_thermal_level',
},
win: {
load: 'wmic cpu get loadpercentage',
cpu: 'wmic cpu get numberofcores',
mem: {
free: 'wmic os get freephysicalmemory',
total: 'wmic computersystem get totalphysicalmemory',
totalSwap: 'wmic os get totalvirtualmemorySize',
freeSwap: 'wmic os get freevirtualmemory',
},
disk: {
total: 'wmic logicaldisk get size',
free: 'wmic logicaldisk get freespace',
},
temp: 'wmic computersystem get thermalstate',
},
};
export const ProbeName: string = process.env['PROBE_NAME'] || '';
export const ProbeKey: ObjectID = new ObjectID(process.env['PROBE_KEY'] || '');
export const ResourcesLimit: PositiveNumber = new PositiveNumber(
process.env['RESOURCES_LIMIT'] || ''
);

35
Probe/Dockerfile.tpl Executable file → Normal file
View File

@@ -1,5 +1,5 @@
#
# probe Dockerfile
# OneUptime-identity Dockerfile
#
# Pull base image nodejs image.
@@ -11,13 +11,14 @@ RUN mkdir /tmp/npm && chmod 2777 /tmp/npm && chown 1000:1000 /tmp/npm && npm co
# Install bash.
RUN apk update && apk add bash && apk add curl
# Install python
RUN apk update && apk add --no-cache --virtual .gyp python3 make g++
#Use bash shell by default
SHELL ["/bin/bash", "-c"]
#SET ENV Variables
ENV PRODUCTION=true
RUN mkdir /usr/src
# Install common
@@ -46,39 +47,27 @@ COPY ./CommonServer /usr/src/CommonServer
#SET ENV Variables
ENV PRODUCTION=true
# Install app
RUN mkdir /usr/src/app
WORKDIR /usr/src/app
# Install kubectl for kubernetes monitor scanning
RUN OS_ARCHITECTURE="amd64"
RUN if [[ "$(uname -m)" -eq "aarch64" ]] ; then OS_ARCHITECTURE="arm64" ; fi
RUN if [[ "$(uname -m)" -eq "arm64" ]] ; then OS_ARCHITECTURE="arm64" ; fi
RUN curl -LO "https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/$(OS_ARCHITECTURE)/kubectl"
RUN chmod +x ./kubectl
RUN mv ./kubectl /usr/local/bin/kubectl && \
chown root: /usr/local/bin/kubectl
# Install app dependencies
COPY ./Probe/package*.json /usr/src/app/
COPY ./Identity/package*.json /usr/src/app/
RUN npm install
# Expose ports.
# - 3008: probe
EXPOSE 3008
# - 3087: OneUptime-backend
EXPOSE 3087
{{ if eq .Env.ENVIRONMENT "development" }}
#Run the app
CMD [ "npm", "run", "dev" ]
{{ else }}
# Copy app source
COPY ./Probe /usr/src/app
COPY ./Identity /usr/src/app
# Bundle app source
RUN npm run compile
#Run the app

37
Probe/Index.ts Executable file → Normal file
View File

@@ -1,29 +1,18 @@
import 'CommonServer/utils/env';
import 'CommonServer/utils/process';
import asyncSleep from 'await-sleep';
import Main from './Workers/Index';
import config from './Config';
import 'ejs';
import logger from 'CommonServer/Utils/Logger';
import App from 'CommonServer/Utils/StartServer';
const cronMinuteStartTime: $TSFixMe = Math.floor(Math.random() * 50);
const APP_NAME: string = 'probe';
setTimeout(async () => {
// Keep monitoring in an infinate loop.
//eslint-disable-next-line no-constant-condition
while (true) {
try {
await Main.runJob();
} catch (error) {
logger.error(error);
logger.info('Sleeping for 30 seconds...');
await asyncSleep(30 * 1000);
}
const init: Function = async (): Promise<void> => {
try {
// init the app
await App(APP_NAME);
} catch (err) {
logger.error('App Init Failed:');
logger.error(err);
}
}, cronMinuteStartTime * 1000);
};
logger.info(
`Probe with Probe Name ${config.probeName} and Probe Key ${config.probeKey}. OneUptime Probe API URL: ${config.probeApiUrl}`
);
init();

View File

@@ -1 +0,0 @@
# probe

View File

@@ -1,27 +0,0 @@
{
"preset": "ts-jest",
"verbose": true,
"globals": {
"ts-jest": {
"tsconfig": "tsconfig.json",
"babelConfig": false
}
},
"moduleFileExtensions": ["ts", "js", "json"],
"transform": {
".(ts|tsx)": "ts-jest"
},
"testEnvironment": "node",
"collectCoverage": false,
"coverageReporters": ["text"],
"testRegex": "./Tests/(.*).test.ts",
"collectCoverageFrom": ["./**/*.(tsx||ts)"],
"coverageThreshold": {
"global": {
"lines": 0,
"functions": 0,
"branches": 0,
"statements": 0
}
}
}

View File

@@ -1,5 +1,5 @@
{
"watch": ["./","../Common", "../CommonServer"],
"watch": ["./","../Common", "../CommonServer", "../Model"],
"ext": "ts,json,tsx,env,js,jsx,hbs",
"exec": "node --inspect=0.0.0.0:9229 --require ts-node/register Index.ts"
}

13274
Probe/package-lock.json generated

File diff suppressed because it is too large Load Diff

87
Probe/package.json Executable file → Normal file
View File

@@ -1,59 +1,32 @@
{
"name": "probe",
"version": "3.0.0",
"description": "",
"main": "index.ts",
"scripts": {
"preinstall": "npx npm-force-resolutions || echo 'No package-lock.json file. Skipping force resolutions'",
"start": "node --require ts-node/register Index.ts",
"compile": "tsc",
"dev": "ts-node-dev --inspect=0.0.0.0 --max-http-header-size=80000 index.ts",
"test": "jest",
"audit": "npm audit --audit-level=low",
"dep-check": "depcheck ./ --skip-missing=true"
},
"repository": {
"type": "git",
"url": "git+https://gitlab.com/oneuptime/probe.git"
},
"author": "Nilanshu",
"license": "MIT",
"bugs": {
"url": "https://gitlab.com/oneuptime/probe/issues"
},
"homepage": "https://gitlab.com/oneuptime/probe#readme",
"type": "module",
"dependencies": {
"await-sleep": "^0.0.1",
"axios": "^0.26.1",
"chrome-launcher": "^0.15.0",
"Common": "file:../Common",
"CommonServer": "file:../CommonServer",
"dotenv": "^16.0.0",
"get-ssl-certificate": "^2.3.3",
"Model": "file:../Model",
"moment": "^2.29.1",
"node-fetch-commonjs": "^3.1.1",
"node-ssh": "^12.0.4",
"ping": "^0.4.1",
"request": "^2.88.2",
"sleep-promise": "^9.1.0",
"ts-node": "^10.9.1",
"uuid": "^8.3.2",
"vm2": "^3.9.9",
"winston": "^3.6.0",
"winston-slack-transport": "^2.0.0"
},
"resolutions": {},
"devDependencies": {
"@types/jest": "^27.5.1",
"@types/node": "^17.0.35",
"depcheck": "^1.4.3",
"jest": "^28.1.0",
"nodemon": "^2.0.20",
"npm-force-resolutions": "0.0.10",
"ts-jest": "^28.0.2",
"ts-node-dev": "^1.1.8",
"typescript": "^4.6.4"
}
"name": "identity",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"start": "node --require ts-node/register Index.ts",
"compile": "tsc",
"dev": "npx nodemon",
"audit": "npm audit --audit-level=low",
"dep-check": "depcheck ./ --skip-missing=true",
"test": "jest"
},
"author": "",
"license": "ISC",
"dependencies": {
"Common": "file:../Common",
"CommonServer": "file:../CommonServer",
"ejs": "^3.1.8",
"jsrsasign": "^10.6.1",
"Model": "file:../Model",
"saml2-js": "^4.0.1",
"ts-node": "^10.9.1"
},
"devDependencies": {
"@types/jest": "^27.5.0",
"@types/node": "^17.0.31",
"jest": "^28.1.0",
"nodemon": "^2.0.20",
"ts-jest": "^28.0.2"
}
}

View File

@@ -21,8 +21,8 @@
"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. */,
"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*`.` */
@@ -32,18 +32,15 @@
/* 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. */,
"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. */,
], /* Specify multiple folders that act like `./node_modules/@types`. */
"types": ["node"], /* 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 `<reference>`s from expanding the number of files TypeScript should add to a project. */
@@ -57,9 +54,9 @@
// "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. */,
"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. */,
"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. */
@@ -87,27 +84,29 @@
/* 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 */,
"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. */
}
},
"include": ["/**/*.ts"],
"exclude": ["node_modules"]
}

72
ProbeAPI/API/Alive.ts Normal file
View File

@@ -0,0 +1,72 @@
import Express, {
ExpressRequest,
ExpressResponse,
ExpressRouter,
NextFunction,
} from 'CommonServer/Utils/Express';
import ObjectID from 'Common/Types/ObjectID';
import Response from 'CommonServer/Utils/Response';
import BadDataException from 'Common/Types/Exception/BadDataException';
import ProbeService from 'CommonServer/Services/ProbeService';
import OneUptimeDate from 'Common/Types/Date';
const router: ExpressRouter = Express.getRouter();
router.post(
'/alive',
async (
req: ExpressRequest,
res: ExpressResponse,
next: NextFunction
): Promise<void> => {
try {
const data = req.body;
if(!data.probeId || !data.probeKey) {
return Response.sendErrorResponse(req, res, new BadDataException("ProbeId or ProbeKey is missing"));
}
const probeId = new ObjectID(data.probeId);
const probeKey = new ObjectID(data.probeKey);
const probe = await ProbeService.findOneBy({
query: {
_id: probeId.toString(),
key: probeKey
},
select: {
_id: true,
},
props: {
isRoot: true,
}
})
if(!probe){
return Response.sendErrorResponse(req, res, new BadDataException("Invalid Probe ID or Probe Key"));
}
await ProbeService.updateOneById({
id: probeId,
data: {
lastAlive: OneUptimeDate.getCurrentDate()
},
props: {
isRoot: true
}
});
return Response.sendEmptyResponse(req, res);
} catch (err) {
return next(err);
}
}
);
export default router;

80
ProbeAPI/API/Register.ts Normal file
View File

@@ -0,0 +1,80 @@
import Express, {
ExpressRequest,
ExpressResponse,
ExpressRouter,
NextFunction,
} from 'CommonServer/Utils/Express';
import ObjectID from 'Common/Types/ObjectID';
import Response from 'CommonServer/Utils/Response';
import BadDataException from 'Common/Types/Exception/BadDataException';
import ProbeService from 'CommonServer/Services/ProbeService';
import OneUptimeDate from 'Common/Types/Date';
import ClusterKeyAuthorization from 'CommonServer/Middleware/ClusterKeyAuthorization';
import Probe from "Model/Models/Probe";
const router: ExpressRouter = Express.getRouter();
// Register Global Probe. Custom Probe can be registered via dashboard.
router.post(
'/register',
ClusterKeyAuthorization.isAuthorizedServiceMiddleware,
async (
req: ExpressRequest,
res: ExpressResponse,
next: NextFunction
): Promise<void> => {
try {
const data = req.body;
if(!data.probeKey) {
return Response.sendErrorResponse(req, res, new BadDataException("ProbeId or ProbeKey is missing"));
}
const probeKey = new ObjectID(data.probeKey);
const probe: Probe | null = await ProbeService.findOneBy({
query: {
key: probeKey,
isGlobalProbe: true
},
select: {
_id: true,
},
props: {
isRoot: true,
}
})
if(probe){
return Response.sendTextResponse(req, res, "Probe already registered");
}
let newProbe: Probe = new Probe();
newProbe.isGlobalProbe = true;
newProbe.key = probeKey;
newProbe.lastAlive = OneUptimeDate.getCurrentDate();
newProbe = await ProbeService.create({
data: newProbe,
props: {
isRoot: true
}
});
return Response.sendJsonObjectResponse(req, res, {
_id: newProbe._id?.toString(),
"message": "Probe registered successfully"
});
} catch (err) {
return next(err);
}
}
);
export default router;

View File

@@ -1,13 +1,35 @@
import { ExpressApplication } from 'CommonServer/Utils/Express';
import 'ejs';
import { PostgresAppInstance } from 'CommonServer/Infrastructure/PostgresDatabase';
import Express, { ExpressApplication } from 'CommonServer/Utils/Express';
import logger from 'CommonServer/Utils/Logger';
import App from 'CommonServer/Utils/StartServer';
import AliveAPI from './API/Alive';
import RegisterAPI from './API/Register';
export const APP_NAME: string = 'data-ingestor';
const app: ExpressApplication = App(APP_NAME);
import Redis from 'CommonServer/Infrastructure/Redis';
// API
import ProbeAPI from './API/Probe';
const app: ExpressApplication = Express.getExpressApp();
// Attach to the app.
app.use([`/${APP_NAME}/probe`, '/probe'], ProbeAPI);
const APP_NAME: string = 'probe-api';
export default app;
app.use([`/${APP_NAME}`, '/'], AliveAPI);
app.use([`/${APP_NAME}`, '/'], RegisterAPI);
const init: Function = async (): Promise<void> => {
try {
// init the app
await App(APP_NAME);
// connect to the database.
await PostgresAppInstance.connect(
PostgresAppInstance.getDatasourceOptions()
);
// connect redis
await Redis.connect();
} catch (err) {
logger.error('App Init Failed:');
logger.error(err);
}
};
init();

View File

@@ -1,5 +1,5 @@
{
"watch": ["./","../Common", "../CommonServer", "../Model"],
"ext": "ts,json,tsx,env,js,jsx,hbs",
"exec": "node --inspect=0.0.0.0:9229 --require ts-node/register Index.ts"
}
"watch": ["./","../Common", "../CommonServer", "../Model"],
"ext": "ts,json,tsx,env,js,jsx,hbs",
"exec": "node --inspect=0.0.0.0:9229 --require ts-node/register Index.ts"
}

12202
ProbeAPI/package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,45 +1,31 @@
{
"name": "probe-api",
"version": "3.0.0",
"description": "A project to handle all resource fetching or update for probes",
"main": "index.ts",
"name": "identity",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"start": "node --require ts-node/register Index.ts",
"compile": "tsc",
"dev": "npx nodemon",
"audit": "npm audit --audit-level=low",
"dep-check": "depcheck ./ --skip-missing=true",
"test": "jest"
"start": "node --require ts-node/register Index.ts",
"compile": "tsc",
"dev": "npx nodemon",
"audit": "npm audit --audit-level=low",
"dep-check": "depcheck ./ --skip-missing=true",
"test": "jest"
},
"keywords": [],
"author": "OneUptime Limited. ",
"license": "MIT",
"type": "module",
"author": "",
"license": "ISC",
"dependencies": {
"axios": "^0.26.1",
"Common": "file:../Common",
"CommonServer": "file:../CommonServer",
"cors": "^2.8.5",
"cross-env": "^7.0.3",
"dotenv": "^16.0.0",
"express": "^4.17.3",
"lodash": "^4.17.21",
"Model": "file:../Model",
"moment": "^2.29.1",
"mongodb": "^4.4.1",
"ts-node": "^10.9.1",
"uuid": "^8.3.2",
"winston": "^3.6.0",
"winston-slack-webhook-transport": "^2.1.0"
"Common": "file:../Common",
"CommonServer": "file:../CommonServer",
"ejs": "^3.1.8",
"Model": "file:../Model",
"ts-node": "^10.9.1"
},
"devDependencies": {
"@types/cors": "^2.8.12",
"@types/express": "^4.17.13",
"@types/jest": "^27.5.1",
"@types/node": "^17.0.22",
"jest": "^28.1.0",
"nodemon": "^2.0.20",
"ts-jest": "^28.0.2",
"ts-node-dev": "^1.1.8"
"@types/jest": "^27.5.0",
"@types/node": "^17.0.31",
"jest": "^28.1.0",
"nodemon": "^2.0.20",
"ts-jest": "^28.0.2"
}
}
}

View File

@@ -375,7 +375,45 @@ services:
{{ end }}
probe-1:
{{ if eq .Env.ENVIRONMENT "development" }}
ports:
- '9655:9229' # Debugging port.
{{ end }}
{{ if or (eq .Env.ENVIRONMENT "development") (eq .Env.ENVIRONMENT "ci") }}
build:
network: host
context: .
dockerfile: ./Probe/Dockerfile
{{ else }}
image: oneuptime/probe:{{ .Env.APP_TAG }}
{{ end }}
restart: always
env_file:
- ./Common/.env
- ./CommonServer/.env
- ./Probe/.env
depends_on:
- probe-api
links:
- probe-api
volumes:
- ./Certs:/usr/src/Certs
{{ if eq .Env.ENVIRONMENT "development" }}
- ./Probe:/usr/src/app
# Use node modules of the container and not host system.
# https://stackoverflow.com/questions/29181032/add-a-volume-to-docker-but-exclude-a-sub-folder
- /usr/src/app/node_modules/
- ./Common:/usr/src/Common
- ./Model:/usr/src/Model
- ./CommonServer:/usr/src/CommonServer
- ./CommonUI:/usr/src/CommonUI
- /usr/src/Common/node_modules/
- /usr/src/CommonUI/node_modules/
- /usr/src/CommonServer/node_modules/
- /usr/src/Model/node_modules/
{{ end }}
identity:
ports: