Commit 0c3c6c9a authored by Riegel's avatar Riegel
Browse files

Add server status checking script

parent a067234c
...@@ -11,10 +11,15 @@ ...@@ -11,10 +11,15 @@
"dependencies": { "dependencies": {
"three": "^0.169.0" "three": "^0.169.0"
}, },
"bin": {
"status": "bin/server-check.js"
},
"devDependencies": { "devDependencies": {
"@vcmap/plugin-cli": "^4.1.1", "@vcmap/plugin-cli": "^4.1.1",
"@vcsuite/eslint-config": "^4.0.0", "@vcsuite/eslint-config": "^4.0.0",
"@vitest/coverage-v8": "^3.1.4", "@vitest/coverage-v8": "^3.1.4",
"axios": "^1.6.7",
"commander": "^11.0.0",
"jest-canvas-mock": "^2.5.2", "jest-canvas-mock": "^2.5.2",
"jsdom": "^26.1.0", "jsdom": "^26.1.0",
"resize-observer-polyfill": "^1.5.1", "resize-observer-polyfill": "^1.5.1",
...@@ -2497,6 +2502,16 @@ ...@@ -2497,6 +2502,16 @@
} }
} }
}, },
"node_modules/@vcmap/plugin-cli/node_modules/commander": {
"version": "10.0.1",
"resolved": "https://registry.npmjs.org/commander/-/commander-10.0.1.tgz",
"integrity": "sha512-y4Mg2tXshplEbSGzx7amzPwKKOCGuoSRP/CjEdwwk0FOGlUbq6lKuoyDZTNZkmxHdJtp54hdfY/JUrdL7Xfdug==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">=14"
}
},
"node_modules/@vcmap/rollup-plugin-vcs-ol": { "node_modules/@vcmap/rollup-plugin-vcs-ol": {
"version": "1.0.5", "version": "1.0.5",
"resolved": "https://registry.npmjs.org/@vcmap/rollup-plugin-vcs-ol/-/rollup-plugin-vcs-ol-1.0.5.tgz", "resolved": "https://registry.npmjs.org/@vcmap/rollup-plugin-vcs-ol/-/rollup-plugin-vcs-ol-1.0.5.tgz",
...@@ -3204,6 +3219,13 @@ ...@@ -3204,6 +3219,13 @@
"node": ">= 0.4" "node": ">= 0.4"
} }
}, },
"node_modules/asynckit": {
"version": "0.4.0",
"resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz",
"integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==",
"dev": true,
"license": "MIT"
},
"node_modules/autolinker": { "node_modules/autolinker": {
"version": "4.1.5", "version": "4.1.5",
"resolved": "https://registry.npmjs.org/autolinker/-/autolinker-4.1.5.tgz", "resolved": "https://registry.npmjs.org/autolinker/-/autolinker-4.1.5.tgz",
...@@ -3233,6 +3255,18 @@ ...@@ -3233,6 +3255,18 @@
"url": "https://github.com/sponsors/ljharb" "url": "https://github.com/sponsors/ljharb"
} }
}, },
"node_modules/axios": {
"version": "1.10.0",
"resolved": "https://registry.npmjs.org/axios/-/axios-1.10.0.tgz",
"integrity": "sha512-/1xYAC4MP/HEG+3duIhFr4ZQXR4sQXOIe+o6sdqzeykGLx6Upp/1p8MHqhINOvGeP7xyNHe7tsiJByc4SSVUxw==",
"dev": true,
"license": "MIT",
"dependencies": {
"follow-redirects": "^1.15.6",
"form-data": "^4.0.0",
"proxy-from-env": "^1.1.0"
}
},
"node_modules/balanced-match": { "node_modules/balanced-match": {
"version": "1.0.2", "version": "1.0.2",
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz",
...@@ -3584,14 +3618,27 @@ ...@@ -3584,14 +3618,27 @@
"dev": true, "dev": true,
"license": "MIT" "license": "MIT"
}, },
"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==",
"dev": true,
"license": "MIT",
"dependencies": {
"delayed-stream": "~1.0.0"
},
"engines": {
"node": ">= 0.8"
}
},
"node_modules/commander": { "node_modules/commander": {
"version": "10.0.1", "version": "11.1.0",
"resolved": "https://registry.npmjs.org/commander/-/commander-10.0.1.tgz", "resolved": "https://registry.npmjs.org/commander/-/commander-11.1.0.tgz",
"integrity": "sha512-y4Mg2tXshplEbSGzx7amzPwKKOCGuoSRP/CjEdwwk0FOGlUbq6lKuoyDZTNZkmxHdJtp54hdfY/JUrdL7Xfdug==", "integrity": "sha512-yPVavfyCcRhmorC7rWlkHn15b4wDVgVmBA7kV4QVBsF7kv/9TKJAbAXVTxvTnwP8HHKjRCJDClKbciiYS7p0DQ==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"engines": { "engines": {
"node": ">=14" "node": ">=16"
} }
}, },
"node_modules/comment-parser": { "node_modules/comment-parser": {
...@@ -3867,6 +3914,16 @@ ...@@ -3867,6 +3914,16 @@
"url": "https://github.com/sponsors/ljharb" "url": "https://github.com/sponsors/ljharb"
} }
}, },
"node_modules/delayed-stream": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz",
"integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">=0.4.0"
}
},
"node_modules/depd": { "node_modules/depd": {
"version": "2.0.0", "version": "2.0.0",
"resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz", "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz",
...@@ -5165,6 +5222,27 @@ ...@@ -5165,6 +5222,27 @@
"license": "ISC", "license": "ISC",
"peer": true "peer": true
}, },
"node_modules/follow-redirects": {
"version": "1.15.9",
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.9.tgz",
"integrity": "sha512-gew4GsXizNgdoRyqmyfMHyAmXsZDk6mHkSxZFCzW9gwlbtOW44CDtYavM+y+72qD/Vq2l550kMF52DT8fOLJqQ==",
"dev": true,
"funding": [
{
"type": "individual",
"url": "https://github.com/sponsors/RubenVerborgh"
}
],
"license": "MIT",
"engines": {
"node": ">=4.0"
},
"peerDependenciesMeta": {
"debug": {
"optional": true
}
}
},
"node_modules/for-each": { "node_modules/for-each": {
"version": "0.3.5", "version": "0.3.5",
"resolved": "https://registry.npmjs.org/for-each/-/for-each-0.3.5.tgz", "resolved": "https://registry.npmjs.org/for-each/-/for-each-0.3.5.tgz",
...@@ -5211,6 +5289,23 @@ ...@@ -5211,6 +5289,23 @@
"url": "https://github.com/sponsors/isaacs" "url": "https://github.com/sponsors/isaacs"
} }
}, },
"node_modules/form-data": {
"version": "4.0.3",
"resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.3.tgz",
"integrity": "sha512-qsITQPfmvMOSAdeyZ+12I1c+CKSstAFAwu+97zrnWAbIr5u8wfsExUzCesVLC8NgHuRUqNN4Zy6UPWUTRGslcA==",
"dev": true,
"license": "MIT",
"dependencies": {
"asynckit": "^0.4.0",
"combined-stream": "^1.0.8",
"es-set-tostringtag": "^2.1.0",
"hasown": "^2.0.2",
"mime-types": "^2.1.12"
},
"engines": {
"node": ">= 6"
}
},
"node_modules/forwarded": { "node_modules/forwarded": {
"version": "0.2.0", "version": "0.2.0",
"resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz", "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz",
...@@ -7441,6 +7536,13 @@ ...@@ -7441,6 +7536,13 @@
"node": ">= 0.10" "node": ">= 0.10"
} }
}, },
"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==",
"dev": true,
"license": "MIT"
},
"node_modules/punycode": { "node_modules/punycode": {
"version": "2.3.1", "version": "2.3.1",
"resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz", "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz",
......
...@@ -16,7 +16,11 @@ ...@@ -16,7 +16,11 @@
"lint": "npm run lint:js && npm run lint:prettier", "lint": "npm run lint:js && npm run lint:prettier",
"format": "prettier --write --list-different . && npm run lint:js -- --fix", "format": "prettier --write --list-different . && npm run lint:js -- --fix",
"test": "vitest", "test": "vitest",
"coverage": "vitest run --coverage" "coverage": "vitest run --coverage",
"checkServer": "npx status"
},
"bin": {
"status": "./src/bin/server-check.js"
}, },
"author": "Matthias Betz <matthias.betz@hft-stuttgart.de>", "author": "Matthias Betz <matthias.betz@hft-stuttgart.de>",
"license": "AGPLv3", "license": "AGPLv3",
...@@ -64,7 +68,9 @@ ...@@ -64,7 +68,9 @@
"jest-canvas-mock": "^2.5.2", "jest-canvas-mock": "^2.5.2",
"jsdom": "^26.1.0", "jsdom": "^26.1.0",
"resize-observer-polyfill": "^1.5.1", "resize-observer-polyfill": "^1.5.1",
"vitest": "^3.1.4" "vitest": "^3.1.4",
"axios": "^1.6.7",
"commander": "^11.0.0"
}, },
"mapVersion": "^6.1" "mapVersion": "^6.1"
} }
#!/usr/bin/env node
import { Command } from 'commander';
import axios from 'axios';
const program = new Command();
program
.name('server-check')
.description('Checks if the plugin server is running and responsive')
.option('-u, --url <url>', 'Full server URL', 'http://localhost:5005')
.action(async ({ url }) => {
try {
const res = await axios.get(url, { timeout: 5000 });
console.log(`Server responded: HTTP ${res.status} ${res.statusText}`);
process.exit(0);
} catch (err) {
console.error(`Server did not respond: ${err.message}`);
process.exit(1);
}
});
program.parse(process.argv);
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment