feat(prod): deploy web dashboard, migrate mongodb configuration, resolve server components render error and fix logo static asset paths

This commit is contained in:
Rafif-Riqullah-Siregar committed 2026-07-15 00:27:55 +07:00
1 parent 4882108068
commit b2ea883601
119 files changed
+7123 -2011

No files matched your search

+5 -80
View File
@@ -78,7 +78,7 @@ const FlowSchema = new mongoose.Schema({
site_uuid: { type: String, index: true },
flow_id: String,
src_ip: { type: String, index: true },
src_mac: String,
src_mac: { type: String, index: true }, // indexed for MAC-to-IP resolution in events
dst_ip: { type: String, index: true },
dst_port: Number,
protocol: String,
@@ -131,52 +131,6 @@ const EventSchema = new mongoose.Schema({
event_at: Date,
}, baseOptions);
// ─── Compound indexes for common dashboard queries ─────────────────────────────
// ─── TLS Versions (per agent) ──────────────────────────────────────────────────
const TlsVersionStatSchema = new mongoose.Schema({
timestamp: { type: Date, required: true, index: true, expires: '7d' },
agent_uuid: { type: String, index: true },
site_uuid: { type: String, index: true },
tls_version: { type: String, required: true },
download: Number,
upload: Number,
flows: Number,
}, baseOptions);
// ─── TLS Ciphers (per agent) ───────────────────────────────────────────────────
const TlsCipherStatSchema = new mongoose.Schema({
timestamp: { type: Date, required: true, index: true, expires: '7d' },
agent_uuid: { type: String, index: true },
site_uuid: { type: String, index: true },
tls_cipher: { type: String, required: true },
download: Number,
upload: Number,
flows: Number,
}, baseOptions);
// ─── TLS Security (per agent) ──────────────────────────────────────────────────
const TlsSecurityStatSchema = new mongoose.Schema({
timestamp: { type: Date, required: true, index: true, expires: '7d' },
agent_uuid: { type: String, index: true },
site_uuid: { type: String, index: true },
tls_security: { type: String, required: true },
download: Number,
upload: Number,
flows: Number,
}, baseOptions);
// ─── Country Traffic Stats (per agent) ────────────────────────────────────────
const CountryStatSchema = new mongoose.Schema({
timestamp: { type: Date, required: true, index: true, expires: '7d' },
agent_uuid: { type: String, index: true },
site_uuid: { type: String, index: true },
country_code: { type: String, required: true },
country_name: { type: String, default: '' },
download: Number,
upload: Number,
flows: Number,
}, baseOptions);
// ─── Compound indexes for common dashboard queries ─────────────────────────────
SummarySchema.index({ agent_uuid: 1, timestamp: -1 });
AppStatSchema.index({ agent_uuid: 1, timestamp: -1, download: -1 });
@@ -187,15 +141,7 @@ FlowSchema.index({ site_uuid: 1, app_label: 1, timestamp: -1 });
ThreatSchema.index({ agent_uuid: 1, timestamp: -1 });
AppCategoryStatSchema.index({ agent_uuid: 1, timestamp: -1 });
EventSchema.index({ agent_uuid: 1, timestamp: -1 });
TlsVersionStatSchema.index({ agent_uuid: 1, timestamp: -1 });
TlsCipherStatSchema.index({ agent_uuid: 1, timestamp: -1 });
TlsSecurityStatSchema.index({ agent_uuid: 1, timestamp: -1 });
CountryStatSchema.index({ agent_uuid: 1, timestamp: -1 });
const CustomDeviceLabelSchema = new mongoose.Schema({
mac_address: { type: String, required: true, unique: true, index: true },
device_label: { type: String, required: true },
}, baseOptions);
FlowSchema.index({ site_uuid: 1, src_mac: 1, timestamp: -1 }); // for MAC-to-IP resolution
// ── Per-Device Per-Application Stats ────────────────────────────────────────
// Collected from DPI API: /data/stats/top/application/download with filter_local_ips
@@ -216,25 +162,8 @@ DeviceAppStatSchema.index({ agent_uuid: 1, ip_address: 1, timestamp: -1 });
DeviceAppStatSchema.index({ ip_address: 1, app_label: 1, timestamp: -1 });
DeviceAppStatSchema.index({ site_uuid: 1, app_label: 1, timestamp: -1 });
// ─── Lookup App Dictionary ────────────────────────────────────────────────────
const LookupAppSchema = new mongoose.Schema({
id: { type: Number, required: true, unique: true, index: true },
tag: String,
label: { type: String, index: true },
name: String,
full_name: String,
description: String,
favicon: String,
icon: String,
logo: String,
application_category: Object
}, baseOptions);
LookupAppSchema.index({ label: 1, tag: 1 });
// ─── DPI Telemetry Property Schemas (SNI, SSL, QUIC, SSH, mDNS, DHCP, UA, BT)
// Split into SchemasTelemetry.js to keep this file under 256 lines.
const telemetrySchemas = require('./SchemasTelemetry');
const auxSchemas = require('./SchemasAux');
module.exports = {
Summary: mongoose.model('Summary', SummarySchema),
@@ -244,14 +173,10 @@ module.exports = {
DeviceAppStat: mongoose.model('DeviceAppStat', DeviceAppStatSchema),
Flow: mongoose.model('Flow', FlowSchema),
Threat: mongoose.model('Threat', ThreatSchema),
CustomDeviceLabel: mongoose.model('CustomDeviceLabel', CustomDeviceLabelSchema),
AppCategoryStat: mongoose.model('AppCategoryStat', AppCategoryStatSchema),
Event: mongoose.model('Event', EventSchema),
TlsVersionStat: mongoose.model('TlsVersionStat', TlsVersionStatSchema),
TlsCipherStat: mongoose.model('TlsCipherStat', TlsCipherStatSchema),
TlsSecurityStat: mongoose.model('TlsSecurityStat', TlsSecurityStatSchema),
CountryStat: mongoose.model('CountryStat', CountryStatSchema),
LookupApp: mongoose.model('LookupApp', LookupAppSchema),
...auxSchemas,
...telemetrySchemas,
};