-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit ad388a2
Showing
23 changed files
with
20,262 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
LOGGER_LEVEL=debug | ||
MONITORING_INTERVAL=60000 # 1 minute | ||
DATABASE_TYPE=sqlite | ||
|
||
# DATABASE_HOST= | ||
# DATABASE_PORT= | ||
# DATABASE_USER= | ||
# DATABASE_PASSWORD= | ||
# DATABASE_NAME= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
node_modules | ||
data/* | ||
public/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
v16.13 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
FROM node:16 | ||
|
||
WORKDIR /app | ||
RUN chown node:node /app | ||
USER node | ||
|
||
RUN apt-get install curl && \ | ||
curl -s https://install.speedtest.net/app/cli/install.deb.sh | sudo bash && \ | ||
apt-get install speedtest | ||
|
||
COPY ./package*.json ./ | ||
|
||
ENV NODE_ENV=production | ||
|
||
RUN npm ci | ||
|
||
COPY . . | ||
|
||
CMD ["npm", "start"] |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<template> | ||
<div> | ||
Hello world! | ||
</div> | ||
</template> | ||
|
||
<script setup> | ||
console.log('Hello world!') | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import { createApp } from "vue"; | ||
|
||
import App from './App.vue'; | ||
|
||
createApp(App).mount("#app"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<title>Document</title> | ||
</head> | ||
<body> | ||
<div id="app"></div> | ||
<script src="{{baseURL}}/js/app.js"></script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
require('dotenv').config(); | ||
|
||
const convict = require('convict'); | ||
|
||
const LOGGER_LEVELS = Object.keys(require('pino')()?.levels?.values); | ||
|
||
convict.addFormat(require('convict-format-with-validator').ipaddress); | ||
|
||
const config = convict({ | ||
env: { | ||
doc: 'The application environment.', | ||
format: ['production', 'development'], | ||
default: 'development', | ||
env: 'NODE_ENV' | ||
}, | ||
logger: { | ||
level: { | ||
doc: 'The minimum logger level to be logged', | ||
format: LOGGER_LEVELS, | ||
default: 'debug', | ||
env: 'LOGGER_LEVEL', | ||
}, | ||
}, | ||
monitoring: { | ||
interval: { | ||
doc: 'The time between two speedtests in milliseconds.', | ||
format: Number, | ||
default: 30000, // 30 seconds | ||
env: 'MONITORING_INTERVAL', | ||
}, | ||
}, | ||
database: { | ||
type: { | ||
default: 'sqlite', | ||
doc: 'The database type.', | ||
format: ['mysql', 'postgresql', 'sqlite'], | ||
env: 'DATABASE_TYPE', | ||
}, | ||
host: { | ||
format: 'ipaddress', | ||
env: 'DATABASE_HOST', | ||
}, | ||
port: { | ||
format: 'port', | ||
env: 'DATABASE_PORT', | ||
}, | ||
user: { | ||
env: 'DATABASE_USER', | ||
format: '*', | ||
}, | ||
password: { | ||
env: 'DATABASE_PASSWORD', | ||
format: '*', | ||
sensitive: true, | ||
}, | ||
database: { | ||
default: 'network_stats', | ||
env: 'DATABASE_NAME', | ||
format: '*', | ||
}, | ||
}, | ||
}); | ||
|
||
config.validate({ allowed: 'strict' }); | ||
|
||
module.exports = config; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// Update with your config settings. | ||
|
||
module.exports = { | ||
development: { | ||
migrations: { | ||
tableName: 'knex_migrations' | ||
} | ||
}, | ||
production: { | ||
migrations: { | ||
tableName: 'knex_migrations' | ||
} | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
|
||
module.exports = { | ||
up: async (knex) => { | ||
const exists = await knex.schema.hasTable('network_stats'); | ||
|
||
if (exists) { | ||
return; | ||
} | ||
|
||
return knex.schema.createTable('network_stats', (t) => { | ||
t.increments('id').primary(); | ||
t.float('upload').notNullable(); | ||
t.float('download').notNullable(); | ||
t.float('ping').notNullable(); | ||
t.datetime('created_at').defaultTo(knex.fn.now()); | ||
}); | ||
}, | ||
down: (knex) =>{ | ||
return knex.schema.dropTableIfExists('network_stats'); | ||
}, | ||
}; |
Oops, something went wrong.