From 8694ced81d431e882f942d7033509702c641ae9e Mon Sep 17 00:00:00 2001 From: lucaspalomodevelop Date: Wed, 1 Jun 2022 21:20:41 +0200 Subject: [PATCH] add docker stuff | edit something --- .jssteconfig_basic | 2 +- docker-compose.yml | 8 ++++++++ dockerfile | 10 ++++++++++ src/helper/logger.js | 4 +--- src/helper/states.js | 2 +- src/index.js | 2 +- src/jsste/index.js | 6 +++++- src/websrv/index.js | 4 ++-- 8 files changed, 29 insertions(+), 9 deletions(-) create mode 100644 docker-compose.yml create mode 100644 dockerfile diff --git a/.jssteconfig_basic b/.jssteconfig_basic index d2605c6..844cb16 100644 --- a/.jssteconfig_basic +++ b/.jssteconfig_basic @@ -1,7 +1,7 @@ { "webserver":{ "port":8080, - "host":"localhost", + "host":"127.0.0.1", "caching":false }, "jsste":{ diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..fee56ee --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,8 @@ +version: '3' +services: + jsste: + build: . + volumes: + - ./:/app + ports: + - "8080:8080" \ No newline at end of file diff --git a/dockerfile b/dockerfile new file mode 100644 index 0000000..7798322 --- /dev/null +++ b/dockerfile @@ -0,0 +1,10 @@ +FROM node:18 +COPY . /app +WORKDIR /app +RUN npm install +WORKDIR /app/dashboard +RUN npm install +RUN npm run build +WORKDIR /app +EXPOSE 8080 +CMD ["npm", "start"] \ No newline at end of file diff --git a/src/helper/logger.js b/src/helper/logger.js index fdb0789..6c156d8 100644 --- a/src/helper/logger.js +++ b/src/helper/logger.js @@ -25,9 +25,7 @@ function updateData() { console.log = function (d) { name = "log_" + moment().format("YYYY-MM-DD") + ".log"; - d = `[ ${moment().format( - "YYYY-MM-DD HH:mm:ss" - )}] [${currentuuid}] ${util.format(d)} \n`; + d = `[ ${moment().format("YYYY-MM-DD HH:mm:ss")}] ${util.format(d)} \n`; log_file.write(d); log_stdout.write(d); }; diff --git a/src/helper/states.js b/src/helper/states.js index b55f695..ac1da05 100644 --- a/src/helper/states.js +++ b/src/helper/states.js @@ -1,4 +1,4 @@ -let JssteState = { statusMSG: "could not started JSSTE", status: 1 }; +let JssteState = { statusMSG: "could not started JSSTE", status: 1, pageStatus:[] }; let WebsrvState = { port: undefined, status: undefined }; module.exports = { diff --git a/src/index.js b/src/index.js index 59880ac..c06e84c 100644 --- a/src/index.js +++ b/src/index.js @@ -5,7 +5,7 @@ let jobs = require("./helper/cronjobs"); let open = require("open"); let os = require("os"); -os.setPriority(os.constants.priority.PRIORITY_HIGHEST); +//os.setPriority(os.constants.priority.PRIORITY_HIGHEST); /** * @description diff --git a/src/jsste/index.js b/src/jsste/index.js index 2239399..dae9c56 100644 --- a/src/jsste/index.js +++ b/src/jsste/index.js @@ -8,6 +8,10 @@ app.specialvars = function (variable_regex, cb, instance = app.instance) {}; * @param {*} pagecode * @param {*} templatecode */ -app.render = function (pagecode, templatecode) {}; +app.render = function (pagecode, templatecode) { + + + +}; module.exports = app; diff --git a/src/websrv/index.js b/src/websrv/index.js index fc8084f..be596b3 100644 --- a/src/websrv/index.js +++ b/src/websrv/index.js @@ -26,9 +26,9 @@ module.exports = function (conf) { app.use(bodyParser.json()); app.use(cookieParser()); app.use("/api", internalRouter); - app.use("/dashboard", express.static(__dirname + "/../../dashboard")); + app.use("/dashboard", express.static(__dirname + "/../../dashboard/build")); app.get("/dashboard/*", (req, res) => { - let indexPath = path.join(__dirname + "/../../dashboard/index.html"); + let indexPath = path.join(__dirname + "/../../dashboard/build/index.html"); res.sendFile(indexPath); });