mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-03-15 05:41:51 +00:00
wip debug/clinic js
This commit is contained in:
parent
025e67d6b6
commit
501b80f4a4
6 changed files with 50 additions and 6 deletions
1
backend/package-lock.json
generated
1
backend/package-lock.json
generated
|
@ -8,6 +8,7 @@
|
||||||
"name": "@zeppelin/backend",
|
"name": "@zeppelin/backend",
|
||||||
"version": "0.0.1",
|
"version": "0.0.1",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"@clinic/heap-profiler": "^4.1.0",
|
||||||
"@silvia-odwyer/photon-node": "^0.3.1",
|
"@silvia-odwyer/photon-node": "^0.3.1",
|
||||||
"bufferutil": "^4.0.3",
|
"bufferutil": "^4.0.3",
|
||||||
"clinic": "^12.1.0",
|
"clinic": "^12.1.0",
|
||||||
|
|
|
@ -8,14 +8,12 @@
|
||||||
"watch-yaml-parse-test": "cross-env NODE_ENV=development tsc-watch --onSuccess \"node dist/backend/src/yamlParseTest.js\"",
|
"watch-yaml-parse-test": "cross-env NODE_ENV=development tsc-watch --onSuccess \"node dist/backend/src/yamlParseTest.js\"",
|
||||||
"build": "rimraf dist && tsc",
|
"build": "rimraf dist && tsc",
|
||||||
"start-bot-dev": "cross-env NODE_ENV=development node -r ./register-tsconfig-paths.js --unhandled-rejections=strict --enable-source-maps --stack-trace-limit=30 --inspect=0.0.0.0:9229 dist/backend/src/index.js",
|
"start-bot-dev": "cross-env NODE_ENV=development node -r ./register-tsconfig-paths.js --unhandled-rejections=strict --enable-source-maps --stack-trace-limit=30 --inspect=0.0.0.0:9229 dist/backend/src/index.js",
|
||||||
"start-bot-dev-debug": "NODE_ENV=development clinic heapprofiler --collect-only --dest .clinic-bot -- node -r ./register-tsconfig-paths.js --unhandled-rejections=strict --enable-source-maps --stack-trace-limit=30 --inspect=0.0.0.0:9229 dist/backend/src/index.js",
|
|
||||||
"start-bot-prod": "cross-env NODE_ENV=production node -r ./register-tsconfig-paths.js --unhandled-rejections=strict --enable-source-maps --stack-trace-limit=30 dist/backend/src/index.js",
|
"start-bot-prod": "cross-env NODE_ENV=production node -r ./register-tsconfig-paths.js --unhandled-rejections=strict --enable-source-maps --stack-trace-limit=30 dist/backend/src/index.js",
|
||||||
"start-bot-prod-debug": "NODE_ENV=production clinic heapprofiler --collect-only --dest .clinic-bot -- node -r ./register-tsconfig-paths.js --unhandled-rejections=strict --enable-source-maps --stack-trace-limit=30 dist/backend/src/index.js",
|
"start-bot-prod-debug": "cross-env NODE_ENV=production node start-bot-prod-debug.js",
|
||||||
"watch-bot": "cross-env NODE_ENV=development tsc-watch --onSuccess \"npm run start-bot-dev\"",
|
"watch-bot": "cross-env NODE_ENV=development tsc-watch --onSuccess \"npm run start-bot-dev\"",
|
||||||
"start-api-dev": "cross-env NODE_ENV=development node -r ./register-tsconfig-paths.js --unhandled-rejections=strict --enable-source-maps --stack-trace-limit=30 --inspect=0.0.0.0:9239 dist/backend/src/api/index.js",
|
"start-api-dev": "cross-env NODE_ENV=development node -r ./register-tsconfig-paths.js --unhandled-rejections=strict --enable-source-maps --stack-trace-limit=30 --inspect=0.0.0.0:9239 dist/backend/src/api/index.js",
|
||||||
"start-api-dev-debug": "NODE_ENV=development clinic heapprofiler --collect-only --dest .clinic-api -- node -r ./register-tsconfig-paths.js --unhandled-rejections=strict --enable-source-maps --stack-trace-limit=30 --inspect=0.0.0.0:9239 dist/backend/src/api/index.js",
|
|
||||||
"start-api-prod": "cross-env NODE_ENV=production node -r ./register-tsconfig-paths.js --unhandled-rejections=strict --enable-source-maps --stack-trace-limit=30 dist/backend/src/api/index.js",
|
"start-api-prod": "cross-env NODE_ENV=production node -r ./register-tsconfig-paths.js --unhandled-rejections=strict --enable-source-maps --stack-trace-limit=30 dist/backend/src/api/index.js",
|
||||||
"start-api-prod-debug": "NODE_ENV=production clinic heapprofiler --collect-only --dest .clinic-api -- node -r ./register-tsconfig-paths.js --unhandled-rejections=strict --enable-source-maps --stack-trace-limit=30 dist/backend/src/api/index.js",
|
"start-api-prod-debug": "cross-env NODE_ENV=production node start-api-prod-debug.js",
|
||||||
"watch-api": "cross-env NODE_ENV=development tsc-watch --onSuccess \"npm run start-api-dev\"",
|
"watch-api": "cross-env NODE_ENV=development tsc-watch --onSuccess \"npm run start-api-dev\"",
|
||||||
"typeorm": "node -r ./register-tsconfig-paths.js ./node_modules/typeorm/cli.js",
|
"typeorm": "node -r ./register-tsconfig-paths.js ./node_modules/typeorm/cli.js",
|
||||||
"migrate-prod": "cross-env NODE_ENV=production npm run typeorm -- migration:run",
|
"migrate-prod": "cross-env NODE_ENV=production npm run typeorm -- migration:run",
|
||||||
|
@ -27,6 +25,7 @@
|
||||||
"test-watch": "tsc-watch --onSuccess \"npx ava\""
|
"test-watch": "tsc-watch --onSuccess \"npx ava\""
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"@clinic/heap-profiler": "^4.1.0",
|
||||||
"@silvia-odwyer/photon-node": "^0.3.1",
|
"@silvia-odwyer/photon-node": "^0.3.1",
|
||||||
"bufferutil": "^4.0.3",
|
"bufferutil": "^4.0.3",
|
||||||
"clinic": "^12.1.0",
|
"clinic": "^12.1.0",
|
||||||
|
|
22
backend/start-api-prod-debug.js
Normal file
22
backend/start-api-prod-debug.js
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
const ClinicHeapProfiler = require('@clinic/heap-profiler');
|
||||||
|
|
||||||
|
const heapProfiler = new ClinicHeapProfiler({
|
||||||
|
name: `api-${Date.now()}`,
|
||||||
|
collectOnFailure: true,
|
||||||
|
});
|
||||||
|
|
||||||
|
console.log("Starting API with heap collection");
|
||||||
|
heapProfiler.collect([
|
||||||
|
"node",
|
||||||
|
"-r",
|
||||||
|
"./register-tsconfig-paths.js",
|
||||||
|
"--unhandled-rejections=strict",
|
||||||
|
"--enable-source-maps",
|
||||||
|
"--stack-trace-limit=30",
|
||||||
|
"dist/backend/src/api/index.js"
|
||||||
|
], function (err, filepath) {
|
||||||
|
if (err) {
|
||||||
|
throw err;
|
||||||
|
}
|
||||||
|
console.log(`Saved collected data in ${filepath}`);
|
||||||
|
});
|
22
backend/start-bot-prod-debug.js
Normal file
22
backend/start-bot-prod-debug.js
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
const ClinicHeapProfiler = require('@clinic/heap-profiler');
|
||||||
|
|
||||||
|
const heapProfiler = new ClinicHeapProfiler({
|
||||||
|
name: `bot-${Date.now()}`,
|
||||||
|
collectOnFailure: true,
|
||||||
|
});
|
||||||
|
|
||||||
|
console.log("Starting bot with heap collection");
|
||||||
|
heapProfiler.collect([
|
||||||
|
"node",
|
||||||
|
"-r",
|
||||||
|
"./register-tsconfig-paths.js",
|
||||||
|
"--unhandled-rejections=strict",
|
||||||
|
"--enable-source-maps",
|
||||||
|
"--stack-trace-limit=30",
|
||||||
|
"dist/backend/src/index.js"
|
||||||
|
], function (err, filepath) {
|
||||||
|
if (err) {
|
||||||
|
throw err;
|
||||||
|
}
|
||||||
|
console.log(`Saved collected data in ${filepath}`);
|
||||||
|
});
|
|
@ -11,7 +11,7 @@ while ping -c1 prepare_backend &>/dev/null; do sleep 1; done;
|
||||||
cd /zeppelin/backend
|
cd /zeppelin/backend
|
||||||
if [ -n "$DEBUG" ]; then
|
if [ -n "$DEBUG" ]; then
|
||||||
echo "Starting API in debug mode"
|
echo "Starting API in debug mode"
|
||||||
exec env NO_INSIGHT=true npm run start-api-prod-debug
|
exec npm run start-api-prod-debug
|
||||||
else
|
else
|
||||||
echo "Starting API"
|
echo "Starting API"
|
||||||
exec npm run start-api-prod
|
exec npm run start-api-prod
|
||||||
|
|
|
@ -11,7 +11,7 @@ while ping -c1 prepare_backend &>/dev/null; do sleep 1; done;
|
||||||
cd /zeppelin/backend
|
cd /zeppelin/backend
|
||||||
if [ -n "$DEBUG" ]; then
|
if [ -n "$DEBUG" ]; then
|
||||||
echo "Starting bot in debug mode"
|
echo "Starting bot in debug mode"
|
||||||
exec env NO_INSIGHT=true npm run start-bot-prod-debug
|
exec npm run start-bot-prod-debug
|
||||||
else
|
else
|
||||||
echo "Starting bot"
|
echo "Starting bot"
|
||||||
exec npm run start-bot-prod
|
exec npm run start-bot-prod
|
||||||
|
|
Loading…
Add table
Reference in a new issue