Put metrics on separate port
This commit is contained in:
parent
3aba7c4394
commit
71dcd62af4
8
Makefile
8
Makefile
|
@ -62,13 +62,17 @@ endif
|
|||
|
||||
VOLUME_MOUNT ?= $(PWD)
|
||||
|
||||
# http
|
||||
P1 ?= 6119
|
||||
# https
|
||||
P2 ?= 6120
|
||||
# metrics
|
||||
P3 ?= 6121
|
||||
|
||||
ifneq (,$(EE))
|
||||
SHELL_PORTS := -p 0.0.0.0:$(P1):6119 -p 0.0.0.0:$(P2):6120
|
||||
SHELL_PORTS := -p 0.0.0.0:$(P1):6119 -p 0.0.0.0:$(P2):6120 -p 0.0.0.0:$(P3):6121
|
||||
else ifneq (,$(E))
|
||||
SHELL_PORTS := -p 127.0.0.1:$(P1):6119 -p 127.0.0.1:$(P2):6120
|
||||
SHELL_PORTS := -p 127.0.0.1:$(P1):6119 -p 127.0.0.1:$(P2):6120 -p 127.0.0.1:$(P3):6121
|
||||
else
|
||||
SHELL_PORTS :=
|
||||
endif
|
||||
|
|
|
@ -15,6 +15,7 @@ import { log, privilegedTeardown } from "./util.js";
|
|||
const host = process.env.HOST || "localhost";
|
||||
const port = parseInt(process.env.PORT || "") || 6119;
|
||||
const tlsPort = parseInt(process.env.TLS_PORT || "") || 6120;
|
||||
const metricsPort = parseInt(process.env.METRICS_PORT || "") || 6121;
|
||||
const useTLS = process.env.TLS ? true : false;
|
||||
const analyticsTag = (process.env.ANALYTICS_TAG || "").replace(
|
||||
/^'(.+)'$/,
|
||||
|
@ -23,17 +24,18 @@ const analyticsTag = (process.env.ANALYTICS_TAG || "").replace(
|
|||
|
||||
promClient.collectDefaultMetrics();
|
||||
|
||||
const metricsApp = express();
|
||||
metricsApp.get("/metrics", async (_, res) => {
|
||||
res.contentType("text/plain; version=0.0.4");
|
||||
res.send(await promClient.register.metrics());
|
||||
});
|
||||
|
||||
const langs = await langsPromise;
|
||||
const app = express();
|
||||
|
||||
app.set("query parser", (qs) => new URLSearchParams(qs));
|
||||
app.set("view engine", "ejs");
|
||||
|
||||
app.get("/metrics", async (_, res) => {
|
||||
res.contentType("text/plain; version=0.0.4");
|
||||
res.send(await promClient.register.metrics());
|
||||
});
|
||||
|
||||
app.get("/", (_, res) => {
|
||||
if (Object.keys(langs).length > 0) {
|
||||
res.render(path.resolve("frontend/pages/index"), {
|
||||
|
@ -148,3 +150,7 @@ if (useTLS) {
|
|||
console.log(`Listening on http://${host}:${port}`)
|
||||
);
|
||||
}
|
||||
|
||||
metricsApp.listen(metricsPort, host, () =>
|
||||
console.log(`Listening on http://${host}:${metricsPort}/metrics`)
|
||||
);
|
||||
|
|
|
@ -10,4 +10,5 @@ WORKDIR /src
|
|||
CMD ["bash"]
|
||||
EXPOSE 6119
|
||||
EXPOSE 6120
|
||||
EXPOSE 6121
|
||||
ENV HOST=0.0.0.0
|
||||
|
|
Loading…
Reference in New Issue