Merge branch 'develop' into feature/rooms-access-rights

This commit is contained in:
TimofeyBoyko 2022-11-01 16:32:55 +05:00
commit b9955ce1d1
4 changed files with 76 additions and 10 deletions

View File

@ -34,6 +34,7 @@ RUN apt-get -y update && \
apt-get install -y nodejs && \
rm -rf /var/lib/apt/lists/*
ADD https://api.github.com/repos/ONLYOFFICE/DocSpace/git/refs/heads/${GIT_BRANCH} version.json
RUN echo ${GIT_BRANCH} && \
git clone --recurse-submodules -b ${GIT_BRANCH} https://github.com/ONLYOFFICE/DocSpace.git ${SRC_PATH}
@ -196,7 +197,7 @@ WORKDIR ${BUILD_PATH}/services/ASC.ApiSystem/
COPY --chown=onlyoffice:onlyoffice docker-entrypoint.py ./docker-entrypoint.py
COPY --from=base --chown=onlyoffice:onlyoffice ${BUILD_PATH}/services/ASC.ApiSystem/service/ .
CMD [" ASC.ApiSystem.dll", " ASC.ApiSystem"]
CMD ["ASC.ApiSystem.dll", "ASC.ApiSystem"]
## ASC.ClearEvents ##
FROM dotnetrun AS clear-events

View File

@ -1,9 +1,14 @@
const winston = require("winston");
const winston = require("winston"),
WinstonCloudWatch = require('winston-cloudwatch');
require("winston-daily-rotate-file");
const path = require("path");
const config = require("../config");
const fs = require("fs");
const os = require("os");
const { randomUUID } = require('crypto');
const date = require('date-and-time');
let logpath = config.get("logPath");
if(logpath != null)
@ -17,6 +22,14 @@ if(logpath != null)
const fileName = logpath ? path.join(logpath, "socket-io.%DATE%.log") : path.join(__dirname, "..", "..", "..", "Logs", "socket-io.%DATE%.log");
const dirName = path.dirname(fileName);
const aws = config.get("aws");
const accessKeyId = aws.accessKeyId;
const secretAccessKey = aws.secretAccessKey;
const awsRegion = aws.region;
const logGroupName = aws.logGroupName;
const logStreamName = aws.logStreamName;
if (!fs.existsSync(dirName)) {
fs.mkdirSync(dirName);
}
@ -38,23 +51,65 @@ var options = {
json: false,
colorize: true,
},
cloudWatch: {
name: 'aws',
level: "debug",
logGroupName: () => {
const hostname = os.hostname();
return logGroupName.replace("${instance-id}", hostname);
},
logStreamName: () => {
const now = new Date();
const guid = randomUUID();
const dateAsString = date.format(now, 'YYYY/MM/DDTHH.mm.ss');
return logStreamName.replace("${guid}", guid)
.replace("${date}", dateAsString);
},
awsRegion: awsRegion,
jsonMessage: true,
awsOptions: {
credentials: {
accessKeyId: accessKeyId,
secretAccessKey: secretAccessKey
}
}
}
};
//const fileTransport = new winston.transports.DailyRotateFile(options.file);
const transports = [
var transports = [
new winston.transports.Console(options.console),
new winston.transports.DailyRotateFile(options.file),
new winston.transports.DailyRotateFile(options.file)
];
if (aws != null && aws.accessKeyId !== '')
{
transports.push(new WinstonCloudWatch(options.cloudWatch));
}
//winston.exceptions.handle(fileTransport);
const customFormat = winston.format(info => {
const now = new Date();
info.date = date.format(now, 'YYYY-MM-DD HH:mm:ss');
info.applicationContext = "SocketIO";
info.level = info.level.toUpperCase();
const hostname = os.hostname();
info["instance-id"] = hostname;
return info;
})();
module.exports = new winston.createLogger({
//defaultMeta: { component: "socket.io-server" },
format: winston.format.combine(
winston.format.timestamp({
format: "YYYY-MM-DD HH:mm:ss",
}),
customFormat,
winston.format.json()
),
transports: transports,

View File

@ -3,5 +3,12 @@
"port": 9899,
"appsettings": "../../../config",
"environment": "Development"
},
"aws":{
"accessKeyId": "",
"secretAccessKey": "",
"region": "",
"logGroupName": "/docspace/ASC.SocketIO/instance/${instance-id}/general",
"logStreamName": "${guid} - ${date}"
}
}

View File

@ -7,9 +7,11 @@
"start:dev": "nodemon server.js"
},
"dependencies": {
"@aws-sdk/client-cloudwatch-logs": "^3.199.0",
"axios": "0.24.0",
"connect-redis": "~6.0.0",
"cookie-parser": "~1.4.6",
"date-and-time": "^2.4.1",
"express": "~4.17.2",
"express-session": "~1.17.2",
"express-socket.io-session": "~1.3.5",
@ -20,7 +22,8 @@
"nodemon": "^2.0.15",
"redis": "^3.1.2",
"socket.io": "^4.4.0",
"winston": "^3.3.3",
"winston": "^3.8.2",
"winston-cloudwatch": "^6.1.1",
"winston-daily-rotate-file": "^4.5.5"
}
}