auf aktuelle esprimo-Version updated
This commit is contained in:
@@ -6,4 +6,5 @@ docker-compose.yml
|
||||
Dockerfile*
|
||||
INFLUXSERVER
|
||||
TRANSFERE
|
||||
data
|
||||
|
||||
|
||||
2
.gitignore
vendored
2
.gitignore
vendored
@@ -3,5 +3,7 @@ node_modules
|
||||
.idea
|
||||
.env
|
||||
log
|
||||
docs/Readme.md_x
|
||||
docs/Readme_tmp.html
|
||||
|
||||
|
||||
|
||||
27
Dockerfile_readin
Normal file
27
Dockerfile_readin
Normal file
@@ -0,0 +1,27 @@
|
||||
FROM node:18-alpine
|
||||
|
||||
ADD package.json /tmp/package.json
|
||||
RUN cd /tmp && npm install
|
||||
RUN mkdir -p /opt/app && cp -a /tmp/node_modules /tmp/package.json /opt/app/
|
||||
|
||||
WORKDIR /opt/app
|
||||
ADD . /opt/app
|
||||
ADD crontab.tmp /opt/app
|
||||
|
||||
RUN mkdir -p data
|
||||
|
||||
#RUN apk add busybox-initscripts
|
||||
#RUN apk add --no-cache tzdata
|
||||
#ENV TZ Europe/Berlin
|
||||
#RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
|
||||
|
||||
RUN crontab crontab.tmp
|
||||
RUN deluser --remove-home node
|
||||
|
||||
RUN touch cmds.sh \
|
||||
&& echo 'crond -f' >>cmds.sh
|
||||
|
||||
CMD sh ./cmds.sh
|
||||
|
||||
|
||||
|
||||
@@ -14,8 +14,8 @@
|
||||
|
||||
set -x
|
||||
port=""
|
||||
orgName=timeseries
|
||||
name=timeseries
|
||||
orgName=readin
|
||||
name=readin
|
||||
|
||||
usage()
|
||||
{
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
1-59/5 * * * * cd /opt/app && npm start
|
||||
3-59/5 * * * * cd /opt/app && npm start
|
||||
|
||||
|
||||
19
deploy.sh
Executable file
19
deploy.sh
Executable file
@@ -0,0 +1,19 @@
|
||||
# Deploy Sensor-Files via esprimo und docker.citysensor.de
|
||||
# 2023-12-17 rxf
|
||||
#
|
||||
|
||||
# set -x
|
||||
|
||||
LINUX='esprimo'
|
||||
path="/home/rxf/Projekte/Sensors"
|
||||
name=readin
|
||||
|
||||
rsync -avn --exclude=node_modules --exclude=.git --exclude=deploy.sh --exclude=TRANSFERE --exclude=INFLUXSERVER --exclude=data --exclude=log --exclude=.idea --exclude=.vscode --exclude=docs ./ $LINUX:$path/$name
|
||||
exit 0
|
||||
|
||||
ssh $LINUX "cd $path/$name;
|
||||
./build_and_copy.sh localhost;
|
||||
docker tag $name docker.citysensor.de/$name;
|
||||
docker push docker.citysensor.de/$name;"
|
||||
|
||||
exit 0
|
||||
@@ -1,45 +1,54 @@
|
||||
version: '3.9'
|
||||
|
||||
volumes:
|
||||
mongo_data_1:
|
||||
mongo_vol:
|
||||
influx_vol:
|
||||
|
||||
services:
|
||||
node:
|
||||
timeseries:
|
||||
image: timeseries
|
||||
environment:
|
||||
DEVELOP: "true"
|
||||
MONGOHOST: mongodb
|
||||
MONGOUSRP: "rexfue:noise4mongo"
|
||||
MONGOAUTH: "true"
|
||||
INFLUXHOST: influxdb
|
||||
INFLUXTOKEN: "q35XUBaElzcy8dDd9HF2_mpeHvYCampZg_9mJNP5jeBQRopq3EWIzNTZ555QLSIXhZC05RXCoFgjiaT7VzyNkQ=="
|
||||
TYP: "[\"noise\", \"thp\"]"
|
||||
volumes:
|
||||
- ${PWD}/log:/var/log
|
||||
container_name: timeseries
|
||||
restart: unless-stopped
|
||||
|
||||
influx:
|
||||
image: influxdb:latest
|
||||
container_name: influxdb
|
||||
mongodb:
|
||||
image: mongo:6
|
||||
volumes:
|
||||
- ${PWD}/INFLUXSERVER/data:/var/lib/influxdb2
|
||||
- ${PWD}/INFLUXSERVER/config:/etc/influxdb2
|
||||
- ${PWD}/entries:/docker-entrypoint-initdb.d
|
||||
- mongo_vol:/data/db
|
||||
ports:
|
||||
- "27017:27017"
|
||||
container_name: mongodb
|
||||
environment:
|
||||
- MONGO_INITDB_DATABASE=sensor_data
|
||||
- MONGO_INITDB_ROOT_USERNAME=${MONGO_ROOT_USERNAME}
|
||||
- MONGO_INITDB_ROOT_PASSWORD=${MONGO_ROOT_PASSWORD}
|
||||
restart: unless-stopped
|
||||
|
||||
influxdb:
|
||||
image: influxdb:2.0
|
||||
ports:
|
||||
- '8086:8086'
|
||||
volumes:
|
||||
- influx_vol:/var/lib/influxdb2
|
||||
environment:
|
||||
DOCKER_INFLUXDB_INIT_MODE: ${DOCKER_INFLUXDB_INIT_MODE}
|
||||
DOCKER_INFLUXDB_INIT_MODE: setup
|
||||
DOCKER_INFLUXDB_INIT_USERNAME: ${DOCKER_INFLUXDB_INIT_USERNAME}
|
||||
DOCKER_INFLUXDB_INIT_PASSWORD: ${DOCKER_INFLUXDB_INIT_PASSWORD}
|
||||
DOCKER_INFLUXDB_INIT_ORG: ${DOCKER_INFLUXDB_INIT_ORG}
|
||||
DOCKER_INFLUXDB_INIT_BUCKET: ${DOCKER_INFLUXDB_INIT_BUCKET}
|
||||
restart: unless-stopped
|
||||
DOCKER_INFLUXDB_INIT_ORG: citysensor
|
||||
DOCKER_INFLUXDB_INIT_BUCKET: sensor_data
|
||||
DOCKER_INFLUXDB_INIT_ADMIN_TOKEN: ${DOCKER_INFLUXTOKEN}
|
||||
restart:
|
||||
unless-stopped
|
||||
container_name: influxdb
|
||||
|
||||
mongodb:
|
||||
image: mongo
|
||||
volumes:
|
||||
- mongo_data_1:/data/db
|
||||
- ${PWD}/TRANSFERE:/TRANSFERE
|
||||
ports:
|
||||
- "27098:27017"
|
||||
container_name: mongodb
|
||||
# command: '--auth'
|
||||
restart: unless-stopped
|
||||
|
||||
|
||||
BIN
docs/.DS_Store
vendored
Normal file
BIN
docs/.DS_Store
vendored
Normal file
Binary file not shown.
BIN
docs/Laerm_API.pdf
Normal file
BIN
docs/Laerm_API.pdf
Normal file
Binary file not shown.
2
mongo.js
2
mongo.js
@@ -11,7 +11,7 @@ let MONGOHOST = process.env.MONGOHOST || 'localhost'
|
||||
let MONGOPORT = process.env.MONGOPORT || 27017
|
||||
let MONGOAUTH = process.env.MONGOAUTH || 'false'
|
||||
let MONGOUSRP = process.env.MONGOUSRP || ''
|
||||
let MONGOBASE = process.env.MONGOBASE || 'allsensors'
|
||||
let MONGOBASE = process.env.MONGOBASE || 'sensor_data'
|
||||
|
||||
|
||||
let MONGO_URL = 'mongodb://' + MONGOHOST + ':' + MONGOPORT; // URL to mongo database
|
||||
|
||||
939
package-lock.json
generated
939
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -6,7 +6,7 @@
|
||||
"main": "main.js",
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1",
|
||||
"start": "node fetchnewdata.js -m >>/var/log/timeseries.log 2>&1"
|
||||
"start": "node fetchnewdata.js -m >>/var/log/readin.log 2>&1"
|
||||
},
|
||||
"type": "module",
|
||||
"keywords": [],
|
||||
|
||||
7
parse.js
7
parse.js
@@ -146,7 +146,7 @@ const buildNewEntry = (item, typ, dt, now) => {
|
||||
const types = {
|
||||
P1: 'pm', P2: 'pm', P0: 'pm',
|
||||
temperature: 'thp', humidity: 'thp', pressure: 'thp',
|
||||
noise_LAeq: 'noise', noise_LA_max: 'noise',
|
||||
noise_LAeq: 'noise', noise_LA_max: 'noise', noise_LA_min: 'noise',
|
||||
counts_per_minute: 'radioactivity',
|
||||
lat: 'gps'
|
||||
};
|
||||
@@ -182,6 +182,9 @@ export const constructDBaseEntries = async (client, body, args) => {
|
||||
if (typ === 'unknown') { // extract measurement type
|
||||
typ = getType(vtyp)
|
||||
}
|
||||
if(typ === 'noise') {
|
||||
vtyp = vtyp.slice(6)
|
||||
}
|
||||
let val = v.value; // and value
|
||||
let x
|
||||
try {
|
||||
@@ -196,7 +199,7 @@ export const constructDBaseEntries = async (client, body, args) => {
|
||||
values[vtyp] = x
|
||||
ival += `${vtyp}=${x},`
|
||||
// if noise sensor precalculate pow10
|
||||
if (vtyp == 'noise_LAeq') {
|
||||
if (vtyp == 'LAeq') {
|
||||
let e10 = Math.pow(10, x / 10)
|
||||
values.E10tel_eq = e10
|
||||
ival += `E10tel_eq=${e10},`
|
||||
|
||||
@@ -49,4 +49,3 @@ function saveDatatoFile(fn, data) {
|
||||
function readDatafromFile(fn) {
|
||||
return JSON.parse(fs.readFileSync(fn))
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user