feat(prod): deploy web dashboard, migrate mongodb configuration, resolve server components render error and fix logo static asset paths
This commit is contained in:
1 parent
4882108068
commit
b2ea883601
119 files changed
+7123
-2011
No files matched your search
@@ -0,0 +1,43 @@
|
||||
// test/fix_blacklist_indexes.js
|
||||
const mongoose = require('mongoose');
|
||||
|
||||
async function run() {
|
||||
console.log("Connecting to MongoDB...");
|
||||
await mongoose.connect('mongodb://127.0.0.1:27017/backone_dpi');
|
||||
console.log("Connected successfully!");
|
||||
|
||||
const db = mongoose.connection.db;
|
||||
const collection = db.collection('blacklistrules');
|
||||
|
||||
console.log("Dropping all existing indexes on blacklistrules collection...");
|
||||
try {
|
||||
await collection.dropIndexes();
|
||||
console.log("✓ Indexes dropped successfully.");
|
||||
} catch (err) {
|
||||
console.warn("Could not drop indexes (probably collection doesn't exist yet):", err.message);
|
||||
}
|
||||
|
||||
console.log("Cleaning up old blacklist rules that don't have agent_uuid...");
|
||||
const deleteResult = await collection.deleteMany({
|
||||
$or: [
|
||||
{ agent_uuid: { $exists: false } },
|
||||
{ agent_uuid: null },
|
||||
{ agent_uuid: "" }
|
||||
]
|
||||
});
|
||||
console.log(`✓ Deleted ${deleteResult.deletedCount} legacy blacklist rules.`);
|
||||
|
||||
console.log("Rebuilding Mongoose model indexes...");
|
||||
const { BlacklistRule } = require('../backend/models/Schemas');
|
||||
await BlacklistRule.cleanIndexes();
|
||||
await BlacklistRule.createIndexes();
|
||||
console.log("✓ New compound indexes built successfully!");
|
||||
|
||||
await mongoose.disconnect();
|
||||
console.log("Disconnected from MongoDB.");
|
||||
}
|
||||
|
||||
run().catch(err => {
|
||||
console.error("Migration failed:", err);
|
||||
process.exit(1);
|
||||
});
|
||||
Reference in new issue
Block a user