Skip to content

Commit

Permalink
Merge pull request #1712 from OriginTrail/v6/prerelease/testnet
Browse files Browse the repository at this point in the history
Hotfix 1.21 - Update telemetry publishing frequency and key rotation
  • Loading branch information
kotlarmilos authored Jan 28, 2022
2 parents e21337c + e8fa110 commit a303e97
Show file tree
Hide file tree
Showing 5 changed files with 89 additions and 8 deletions.
56 changes: 56 additions & 0 deletions Debian.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
#base image
FROM node:14.18.3-bullseye

MAINTAINER OriginTrail
LABEL maintainer="OriginTrail"
ENV NODE_ENV=testnet


#Mysql-server installation
ARG DEBIAN_FRONTEND=noninteractive
ARG PASSWORD=password
RUN apt-get update
RUN apt-get install -y lsb-release
RUN apt-get install -y wget gnupg curl
RUN curl -LO https://dev.mysql.com/get/mysql-apt-config_0.8.20-1_all.deb
RUN dpkg -i ./mysql-apt-config_0.8.20-1_all.deb
RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 467B942D3A79BD29


RUN { \
echo mysql-server mysql-server/root_password password $PASSWORD ''; \
echo mysql-server mysql-server/root_password_again password $PASSWORD ''; \
} | debconf-set-selections \
&& apt-get update && apt-get install -y default-mysql-server default-mysql-server-core



RUN apt-get -qq -y install git
RUN apt-get -qq -y install make python

#Install Papertrail
RUN wget https://github.com/papertrail/remote_syslog2/releases/download/v0.20/remote_syslog_linux_amd64.tar.gz
RUN tar xzf ./remote_syslog_linux_amd64.tar.gz && cd remote_syslog && cp ./remote_syslog /usr/local/bin
COPY config/papertrail.yml /etc/log_files.yml






#Install nodemon & forever
RUN npm install forever -g




WORKDIR /ot-node

COPY . .

#Install nppm
RUN npm install

#Mysql intialization
RUN service mariadb start && mysql -u root -e "CREATE DATABASE operationaldb /*\!40100 DEFAULT CHARACTER SET utf8 */; SET PASSWORD FOR root@localhost = PASSWORD(''); FLUSH PRIVILEGES;" && npx sequelize --config=./config/sequelizeConfig.js db:migrate

25 changes: 25 additions & 0 deletions docker/docker-compose-debian.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
version: '3.8'
services:
graphdb:
container_name: graphdb
image: khaller/graphdb-free:latest
network_mode: host

ot-node:
container_name: ot-node
image: origintrail/ot-node:v6.0.0-beta.1-debian
depends_on:
- graphdb
expose:
- 8900
- 9000
command: >
bash -c "
/bin/sleep 30
service mariadb start &&
forever index.js
"
volumes:
- ${PWD}/.origintrail_noderc:/ot-node/.origintrail_noderc
- ~/certs/:/root/certs/
network_mode: host
4 changes: 2 additions & 2 deletions modules/command/common/send-telemetry-command.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class SendTelemetryCommand extends Command {
Models.handler_ids.create({
status: 'PENDING',
}).then((insertedObject) => {
this.publishService.publish(JSON.stringify(jsonld), '.json', [], [`ot-telemetry-${Math.floor(new Date() / (60 * 60 * 1000))}`], true, insertedObject.dataValues.handler_id);
this.publishService.publish(JSON.stringify(jsonld), '.json', [], [`ot-telemetry-${Math.floor(new Date() / (60 * 1000))}`], true, insertedObject.dataValues.handler_id);
});
}
})
Expand Down Expand Up @@ -62,7 +62,7 @@ class SendTelemetryCommand extends Command {
data: {
message: '',
},
period: 20 * 60 * 1000, // 5 * 60 * 1000
period: 60 * 60 * 1000, // 5 * 60 * 1000
transactional: false,
};
Object.assign(command, map);
Expand Down
10 changes: 5 additions & 5 deletions modules/controller/rpc-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -510,9 +510,10 @@ class RpcController {
let response = await this.dataService.runQuery(req.body.query, req.query.type.toUpperCase());

const handlerIdCachePath = this.fileService.getHandlerIdCachePath();

await this.fileService
.writeContentsToFile(handlerIdCachePath, handlerId, JSON.stringify(response));
if(response) {
await this.fileService
.writeContentsToFile(handlerIdCachePath, handlerId, JSON.stringify(response));
}

await Models.handler_ids.update(
{
Expand All @@ -534,11 +535,10 @@ class RpcController {
},
},
);
throw e;
}
} catch (e) {
this.logger.error({
msg: `Unexpected error at query route:: ${e.message}. ${e.stack}`,
msg: `Unexpected error at query route: ${e.message}. ${e.stack}`,
Event_name: constants.ERROR_TYPE.QUERY_ROUTE_ERROR,
Event_value1: e.message,
Id_operation: operationId
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "origintrail_node",
"version": "6.0.0-beta.1.20",
"version": "6.0.0-beta.1.21",
"description": "OTNode v6 Beta 1",
"main": "index.js",
"scripts": {
Expand Down

0 comments on commit a303e97

Please sign in to comment.