Docker and stat script changes

This commit is contained in:
mrfry 2021-09-22 14:41:09 +02:00
parent 25963566ca
commit e17760a8db
5 changed files with 165 additions and 148 deletions

View file

@ -4,5 +4,6 @@ dist
stats
data
publicDirs
nextStatic
devel
.git

View file

@ -1,7 +1,9 @@
#!/bin/bash
hr() {
if [ -t 0 ]; then
printf '\033[0;32m%*s\033[0m\n' "$(tput cols)" '' | tr ' ' '='
fi
}
log() {
@ -75,16 +77,14 @@ touch publicDirs/qminingPublic/version
touch publicDirs/qminingPublic/motd
if [ -z "$(ls -A ./data/dbs)" ]; then
log "Making DB-s"
pushd src/standaloneUtils
NS_LOGLEVEL=2 node dbSetup.js
mv *.db ../../data/dbs
popd
fi
log "Disabling next telemetry"
npx --yes next telemetry disable
hr
echo "Done!"
echo "npm start {loglevel}"
echo "To start server"
hr
log "Done!"

View file

@ -22,12 +22,12 @@ elif [ "$1" == "stop" ]; then
elif [ "$1" == "start" ]; then
# --entrypoint bash \
scripts/setup.sh
docker start -i $(getContainerId)
docker start $(getContainerId)
elif [ "$1" == "run" ]; then
# --entrypoint bash \
scripts/setup.sh
docker run -it \
docker run \
--network host \
--mount src="$(pwd)/stats",target="/server/stats",type=bind \
--mount src="$(pwd)/data",target="/server/data",type=bind \

View file

@ -74,7 +74,8 @@ const filterFromDailyStats = [
'.xml',
'.aspx',
'/questionDbs/',
'/chatFiles/'
'/chatFiles/',
'rss'
]
// -----------------------------------------------------------------
@ -291,7 +292,7 @@ function pCols(cols, rowTitles, colorNames, firstRowColor) {
// ------------------------------------------------------------------------------
printHeader('Daily stats')
try {
const dailyStats = readJSON(`${dir}stats/vstats`)
function preProcessDailyStats(obj) {
const formatted = Object.keys(obj).reduce((acc, key) => {
@ -349,9 +350,13 @@ pCols(
null,
true
)
} catch (e) {
console.error(e)
}
// ------------------------------------------------------------------------------
printHeader('User id test solving')
try {
const userIdTestSolving = readJSON(`${dir}stats/idvstats`)
function preProcessUIdTestSolving(obj, minLength) {
if (!obj) {
@ -384,9 +389,13 @@ pCols(
false,
'green'
)
} catch(e) {
console.error(e)
}
// ------------------------------------------------------------------------------
printHeader('User id requests')
try {
const clientIdTestSolving = readJSON(`${dir}stats/uvstats`)
function getUserIdRequests(day) {
return [
@ -430,8 +439,12 @@ function printLastDataCount(data) {
pCols(res, ['', 'Users', 'Subjects', 'Questions'], false, 'green')
}
} catch(e) {
console.error(e)
}
// ------------------------------------------------------------------------------
printHeader('Daily script install / update check count')
try {
function getDailyScriptStat(day) {
const log =
!day || day === 0
@ -453,3 +466,6 @@ const installs = [...Array(colsToPrint).keys()].map((x) => {
})
pCols(installs, ['', 'Installs', 'Updates'], false, 'green')
} catch(e) {
console.error(e)
}

View file

@ -1,4 +1,4 @@
#!/bin/bash
scripts/make.sh
npm run start
npm run start > /dev/null