forked from jchomaz/Vulture
Compare commits
10 Commits
8baf0cbdd7
...
5401f416e7
| Author | SHA1 | Date | |
|---|---|---|---|
| 5401f416e7 | |||
| 856b90567d | |||
| bb791ed2f4 | |||
| 768f42dff4 | |||
| bc807f9c7b | |||
| 8d980a90c8 | |||
| e8607c78e9 | |||
| 1ff31e0991 | |||
| 3e29bfca18 | |||
| 56c6a744c7 |
142
.gitignore
vendored
Normal file
142
.gitignore
vendored
Normal file
@@ -0,0 +1,142 @@
|
||||
# Score files
|
||||
/VNode/services/game/score/*.json
|
||||
|
||||
# Logs
|
||||
logs
|
||||
*.log
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
lerna-debug.log*
|
||||
|
||||
# Diagnostic reports (https://nodejs.org/api/report.html)
|
||||
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
|
||||
|
||||
# Runtime data
|
||||
pids
|
||||
*.pid
|
||||
*.seed
|
||||
*.pid.lock
|
||||
|
||||
# Directory for instrumented libs generated by jscoverage/JSCover
|
||||
lib-cov
|
||||
|
||||
# Coverage directory used by tools like istanbul
|
||||
coverage
|
||||
*.lcov
|
||||
|
||||
# nyc test coverage
|
||||
.nyc_output
|
||||
|
||||
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
|
||||
.grunt
|
||||
|
||||
# Bower dependency directory (https://bower.io/)
|
||||
bower_components
|
||||
|
||||
# node-waf configuration
|
||||
.lock-wscript
|
||||
|
||||
# Compiled binary addons (https://nodejs.org/api/addons.html)
|
||||
build/Release
|
||||
|
||||
# Dependency directories
|
||||
node_modules/
|
||||
jspm_packages/
|
||||
|
||||
# Snowpack dependency directory (https://snowpack.dev/)
|
||||
web_modules/
|
||||
|
||||
# TypeScript cache
|
||||
*.tsbuildinfo
|
||||
|
||||
# Optional npm cache directory
|
||||
.npm
|
||||
|
||||
# Optional eslint cache
|
||||
.eslintcache
|
||||
|
||||
# Optional stylelint cache
|
||||
.stylelintcache
|
||||
|
||||
# Optional REPL history
|
||||
.node_repl_history
|
||||
|
||||
# Output of 'npm pack'
|
||||
*.tgz
|
||||
|
||||
# Yarn Integrity file
|
||||
.yarn-integrity
|
||||
|
||||
# dotenv environment variable files
|
||||
.env
|
||||
.env.*
|
||||
!.env.example
|
||||
|
||||
# parcel-bundler cache (https://parceljs.org/)
|
||||
.cache
|
||||
.parcel-cache
|
||||
|
||||
# Next.js build output
|
||||
.next
|
||||
out
|
||||
|
||||
# Nuxt.js build / generate output
|
||||
.nuxt
|
||||
dist
|
||||
|
||||
# Gatsby files
|
||||
.cache/
|
||||
# Comment in the public line in if your project uses Gatsby and not Next.js
|
||||
# https://nextjs.org/blog/next-9-1#public-directory-support
|
||||
# public
|
||||
|
||||
# vuepress build output
|
||||
.vuepress/dist
|
||||
|
||||
# vuepress v2.x temp and cache directory
|
||||
.temp
|
||||
.cache
|
||||
|
||||
# Sveltekit cache directory
|
||||
.svelte-kit/
|
||||
|
||||
# vitepress build output
|
||||
**/.vitepress/dist
|
||||
|
||||
# vitepress cache directory
|
||||
**/.vitepress/cache
|
||||
|
||||
# Docusaurus cache and generated files
|
||||
.docusaurus
|
||||
|
||||
# Serverless directories
|
||||
.serverless/
|
||||
|
||||
# FuseBox cache
|
||||
.fusebox/
|
||||
|
||||
# DynamoDB Local files
|
||||
.dynamodb/
|
||||
|
||||
# Firebase cache directory
|
||||
.firebase/
|
||||
|
||||
# TernJS port file
|
||||
.tern-port
|
||||
|
||||
# Stores VSCode versions used for testing VSCode extensions
|
||||
.vscode-test
|
||||
|
||||
# yarn v3
|
||||
.pnp.*
|
||||
.yarn/*
|
||||
!.yarn/patches
|
||||
!.yarn/plugins
|
||||
!.yarn/releases
|
||||
!.yarn/sdks
|
||||
!.yarn/versions
|
||||
|
||||
# Vite logs files
|
||||
vite.config.js.timestamp-*
|
||||
vite.config.ts.timestamp-*
|
||||
3590
VApp/package-lock.json
generated
3590
VApp/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -12,27 +12,27 @@
|
||||
"format": "prettier --write src/"
|
||||
},
|
||||
"dependencies": {
|
||||
"@mdi/font": "^7.4.47",
|
||||
"@videojs-player/vue": "^1.0.0",
|
||||
"express": "^5.0.0",
|
||||
"mqtt": "^5.3.5",
|
||||
"ping": "^0.4.4",
|
||||
"roboto-fontface": "^0.10.0",
|
||||
"video.js": "^8.22.0",
|
||||
"vue": "^3.4.19",
|
||||
"vue-router": "^4.2.5",
|
||||
"vuex": "^4.1.0"
|
||||
"@mdi/font": "latest",
|
||||
"@videojs-player/vue": "latest",
|
||||
"express": "latest",
|
||||
"mqtt": "latest",
|
||||
"ping": "latest",
|
||||
"roboto-fontface": "latest",
|
||||
"video.js": "latest",
|
||||
"vue": "latest",
|
||||
"vue-router": "latest",
|
||||
"vuex": "latest"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@rushstack/eslint-patch": "^1.3.3",
|
||||
"@vitejs/plugin-vue": "^5.0.3",
|
||||
"@vue/eslint-config-prettier": "^8.0.0",
|
||||
"concurrently": "^8.2.2",
|
||||
"eslint": "^8.49.0",
|
||||
"eslint-plugin-vue": "^9.17.0",
|
||||
"prettier": "^3.0.3",
|
||||
"unplugin-fonts": "^1.1.1",
|
||||
"vite": "^5.1.6",
|
||||
"vite-plugin-vuetify": "^2.0.1"
|
||||
"@rushstack/eslint-patch": "latest",
|
||||
"@vitejs/plugin-vue": "latest",
|
||||
"@vue/eslint-config-prettier": "latest",
|
||||
"concurrently": "latest",
|
||||
"eslint": "latest",
|
||||
"eslint-plugin-vue": "latest",
|
||||
"prettier": "latest",
|
||||
"unplugin-fonts": "latest",
|
||||
"vite": "latest",
|
||||
"vite-plugin-vuetify": "latest"
|
||||
}
|
||||
}
|
||||
|
||||
|
Before Width: | Height: | Size: 766 KiB After Width: | Height: | Size: 766 KiB |
60
VContainers/MQTT/config/nanomq.conf
Normal file
60
VContainers/MQTT/config/nanomq.conf
Normal file
@@ -0,0 +1,60 @@
|
||||
# NanoMQ Configuration 0.18.0
|
||||
|
||||
# #============================================================
|
||||
# # NanoMQ Broker
|
||||
# #============================================================
|
||||
|
||||
mqtt {
|
||||
property_size = 32
|
||||
max_packet_size = 260MB
|
||||
max_mqueue_len = 2048
|
||||
retry_interval = 10s
|
||||
keepalive_multiplier = 1.25
|
||||
|
||||
# Three of below, unsupported now
|
||||
max_inflight_window = 2048
|
||||
max_awaiting_rel = 10s
|
||||
await_rel_timeout = 10s
|
||||
}
|
||||
|
||||
listeners.tcp {
|
||||
bind = "127.0.0.1:1883"
|
||||
}
|
||||
|
||||
listeners.ws {
|
||||
bind = "127.0.0.1:9001"
|
||||
}
|
||||
|
||||
http_server {
|
||||
port = 8081
|
||||
limit_conn = 2
|
||||
username = admin
|
||||
password = public
|
||||
auth_type = basic
|
||||
jwt {
|
||||
public.keyfile = "/etc/certs/jwt/jwtRS256.key.pub"
|
||||
}
|
||||
}
|
||||
|
||||
log {
|
||||
# to = [file, console]
|
||||
to = [console]
|
||||
level = warn
|
||||
dir = "/tmp"
|
||||
file = "nanomq.log"
|
||||
rotation {
|
||||
size = 10MB
|
||||
count = 5
|
||||
}
|
||||
}
|
||||
|
||||
auth {
|
||||
allow_anonymous = true
|
||||
no_match = allow
|
||||
deny_action = ignore
|
||||
|
||||
cache = {
|
||||
max_size = 32
|
||||
ttl = 1m
|
||||
}
|
||||
}
|
||||
31
VContainers/README.md
Normal file
31
VContainers/README.md
Normal file
@@ -0,0 +1,31 @@
|
||||
# VContainer - Vulture build script
|
||||
|
||||
Construction et lancements des containers.
|
||||
Toutes les commandes sont a tapper depuis la racine du dépot.
|
||||
|
||||
## Build
|
||||
|
||||
|
||||
podman build . -f ./VContainers/VNode/Containerfile -t vnode
|
||||
podman build . -f ./VContainers/VApp/Containerfile -t vapp
|
||||
|
||||
|
||||
## Run
|
||||
|
||||
Lancement des trois containers dans le même pod, ils partagent le réseau, les différents services sont disponibles sur localhost.
|
||||
|
||||
podman pod create --name vulture -p 8080:80 -p 1883:1883 -p 8083:8083 -p 8883:8883
|
||||
podman run -dt --rm --pod vulture --name nanomq -v ./VContainers/MQTT/config/nanomq.conf:/etc/nanomq.conf docker.io/emqx/nanomq:latest
|
||||
podman run -dt --rm --pod vulture --name vnode vnode:latest
|
||||
podman run -dt --rm --pod vulture --name vapp vapp:latest
|
||||
|
||||
## Stop
|
||||
|
||||
podman stop vapp
|
||||
podman stop vnode
|
||||
podman stop nanomq
|
||||
podman pod rm vulture
|
||||
|
||||
## Tip
|
||||
|
||||
sudo sysctl -w net.ipv4.ip_unprivileged_port_start=80
|
||||
18
VContainers/VApp/Containerfile
Normal file
18
VContainers/VApp/Containerfile
Normal file
@@ -0,0 +1,18 @@
|
||||
#FROM docker.io/nginx:stable-alpine
|
||||
FROM docker.io/node:lts-alpine AS builder
|
||||
## Bundle APP files
|
||||
WORKDIR /app
|
||||
COPY VApp ./
|
||||
RUN npm install
|
||||
RUN npm run build
|
||||
|
||||
FROM docker.io/nginx:stable-alpine
|
||||
RUN rm /etc/nginx/conf.d/default.conf
|
||||
COPY ./VContainers/VApp/nginx.conf /etc/nginx/conf.d/default.conf
|
||||
COPY --from=builder /app/dist /usr/share/nginx/html
|
||||
|
||||
|
||||
EXPOSE 80
|
||||
|
||||
# CMD ["npm","run","dev"]
|
||||
#CMD ["sleep", "1000"]
|
||||
24
VContainers/VApp/nginx.conf
Normal file
24
VContainers/VApp/nginx.conf
Normal file
@@ -0,0 +1,24 @@
|
||||
server {
|
||||
listen 80;
|
||||
root /usr/share/nginx/html; # Chemin où les fichiers statiques sont copiés
|
||||
|
||||
index index.html index.htm; # Fichier par défaut à servir
|
||||
|
||||
location / {
|
||||
try_files $uri $uri/ /index.html; # Pour les applications SPA (Single Page Applications)
|
||||
# cela redirige toutes les requêtes non trouvées vers index.html
|
||||
}
|
||||
|
||||
# Cache Control pour les fichiers statiques (optionnel mais bonne pratique)
|
||||
location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg)$ {
|
||||
expires 30d;
|
||||
add_header Cache-Control "public, no-transform";
|
||||
}
|
||||
|
||||
# Gzip compression (optionnel, améliore la performance)
|
||||
gzip on;
|
||||
gzip_vary on;
|
||||
gzip_proxied any;
|
||||
gzip_comp_level 6;
|
||||
gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;
|
||||
}
|
||||
12
VContainers/VNode/Containerfile
Normal file
12
VContainers/VNode/Containerfile
Normal file
@@ -0,0 +1,12 @@
|
||||
FROM docker.io/keymetrics/pm2:latest-alpine
|
||||
|
||||
## Bundle APP files
|
||||
COPY VNode src
|
||||
#COPY package.json .
|
||||
COPY VContainers/VNode/pm2.json .
|
||||
#
|
||||
## Install app dependencies
|
||||
RUN cd /src && npm install
|
||||
|
||||
CMD [ "pm2-runtime", "start", "pm2.json" ]
|
||||
#CMD [ "sh"]
|
||||
44
VContainers/VNode/pm2.json
Normal file
44
VContainers/VNode/pm2.json
Normal file
@@ -0,0 +1,44 @@
|
||||
[
|
||||
{
|
||||
"name": "buzzer-manager",
|
||||
"script": "services/buzzer/buzzer-manager.js",
|
||||
"cwd": "/src",
|
||||
"watch": false,
|
||||
"env": {
|
||||
"NODE_ENV": "production"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "buzzer-watcher",
|
||||
"script": "services/buzzer/buzzer-watcher.js",
|
||||
"cwd": "/src",
|
||||
"watch": false,
|
||||
"env": {
|
||||
"NODE_ENV": "production"
|
||||
} },
|
||||
{
|
||||
"name": "quizz-collector",
|
||||
"script": "services/game/quizz-collector.js",
|
||||
"cwd": "/src",
|
||||
"watch": false,
|
||||
"env": {
|
||||
"NODE_ENV": "production"
|
||||
} },
|
||||
{
|
||||
"name": "score-manager",
|
||||
"script": "services/game/score-manager.js",
|
||||
"cwd": "src",
|
||||
"env": {
|
||||
"NODE_ENV": "production"
|
||||
},
|
||||
"watch": false
|
||||
},
|
||||
{
|
||||
"name": "light-manager",
|
||||
"script": "services/light/light-manager.js",
|
||||
"cwd": "/src",
|
||||
"watch": false,
|
||||
"env": {
|
||||
"NODE_ENV": "production"
|
||||
} }
|
||||
]
|
||||
@@ -1,9 +1,10 @@
|
||||
const path = require('path');
|
||||
const ping = require('ping');
|
||||
const mqtt = require('mqtt');
|
||||
const fs = require('fs');
|
||||
|
||||
// Lecture du fichier de configuration
|
||||
const config = JSON.parse(fs.readFileSync('\services\\config\\config_network.json', 'utf8'));
|
||||
const config = JSON.parse(fs.readFileSync(path.join('services','config','config_network.json'), 'utf8'));
|
||||
|
||||
// Extraction des informations de config
|
||||
const { hosts: { buzzers: { IP: buzzerIPs, MQTTconfig: { mqttHost, mqttTopic } } } } = config;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"services": {
|
||||
"mqttHost": "mqtt://192.168.1.30",
|
||||
"mqttHost": "mqtt://localhost",
|
||||
"score":{
|
||||
"MQTTconfig":{
|
||||
"mqttScoreTopic": "game/score",
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
"yellowBuzzerIP": "8.8.8.8"
|
||||
},
|
||||
"MQTTconfig":{
|
||||
"mqttHost": "mqtt://192.168.1.28",
|
||||
"mqttHost": "mqtt://localhost",
|
||||
"mqttTopic": "buzzer/watcher"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
const fs = require('fs');
|
||||
const mqtt = require('mqtt');
|
||||
const path = require('path');
|
||||
|
||||
// Lecture du fichier de configuration
|
||||
const config = JSON.parse(fs.readFileSync('\services\\config\\config_game.json', 'utf8'));
|
||||
const config = JSON.parse(fs.readFileSync(path.join('services','config','config_game.json'), 'utf8'));
|
||||
|
||||
// Extraction des informations de config
|
||||
const { services: { mqttHost, quizzcollector: { MQTTconfig: { mqttQuizzCollectorListTopic, mqttQuizzCollectorCmdTopic } } } } = config;
|
||||
|
||||
@@ -132,7 +132,7 @@ function updateTeamTotalScore(teamColor, points) {
|
||||
|
||||
|
||||
// Lecture du fichier de configuration
|
||||
const config = JSON.parse(fs.readFileSync('\services\\config\\config_game.json', 'utf8'));
|
||||
const config = JSON.parse(fs.readFileSync(path.join('services','config','config_game.json'), 'utf8'));
|
||||
|
||||
// Extraction des informations de config
|
||||
const { services: { mqttHost, score: { MQTTconfig: { mqttScoreTopic, mqttScoreChangeTopic } } } } = config;
|
||||
|
||||
Reference in New Issue
Block a user