feat(source2): push all latest files - device labeling, help system, proxy docs, database isolation fix
- Added DOKUMENTASI-FILTER-PER-SITE.md (site isolation docs) - Fixed start-with-env.js to force-load .env.production - Fixed MONGODB_URI hostname from mongodb-netify to mongodb.prod.proit.id - Updated .gitignore to exclude sensitive scripts and credential files - Minor UI and labeling improvements
This commit is contained in:
1 parent
a403f752f3
commit
dd4c8f6876
385 files changed
+31016
-8268
No files matched your search
@@ -0,0 +1,90 @@
|
||||
const { Client } = require('ssh2');
|
||||
|
||||
const SSH = {
|
||||
host: '103.185.47.52',
|
||||
port: 2222,
|
||||
username: 'adminbackend',
|
||||
password: 'htEo7x6LsBQiEHHH',
|
||||
readyTimeout: 60000
|
||||
};
|
||||
|
||||
const remoteJs = `
|
||||
const mongoose = require('/home/adminbackend/web/demoplace.my.id/public_html/backend/node_modules/mongoose');
|
||||
|
||||
async function main() {
|
||||
console.log('Remote: Requiring mongoose succeeded. Connecting...');
|
||||
const URI = 'mongodb://backone_user:SusuKudaLiar@103.80.237.29:27017/backone_dpi?authSource=backone_dpi';
|
||||
try {
|
||||
await mongoose.connect(URI, {
|
||||
serverSelectionTimeoutMS: 10000,
|
||||
connectTimeoutMS: 10000,
|
||||
});
|
||||
console.log('Remote: Connected to DB.');
|
||||
const db = mongoose.connection.db;
|
||||
const collections = await db.listCollections().toArray();
|
||||
console.log('Remote: Listed collections.');
|
||||
const result = {};
|
||||
for (const col of collections) {
|
||||
const name = col.name;
|
||||
console.log('Remote: Querying collection ' + name);
|
||||
const count = await db.collection(name).countDocuments({});
|
||||
if (['users', 'tenantconfigs', 'customagentlocations', 'blacklistrules', 'summaries'].includes(name)) {
|
||||
const docs = await db.collection(name).find({}).toArray();
|
||||
result[name] = { count, docs };
|
||||
} else {
|
||||
result[name] = { count };
|
||||
}
|
||||
}
|
||||
console.log('--- JSON_START ---');
|
||||
console.log(JSON.stringify(result));
|
||||
console.log('--- JSON_END ---');
|
||||
} catch (err) {
|
||||
console.error('Remote Error:', err.message);
|
||||
} finally {
|
||||
await mongoose.disconnect();
|
||||
console.log('Remote: Mongoose disconnected.');
|
||||
}
|
||||
}
|
||||
main();
|
||||
`;
|
||||
|
||||
const conn = new Client();
|
||||
conn.on('ready', () => {
|
||||
const b64 = Buffer.from(remoteJs).toString('base64');
|
||||
conn.exec(`echo "${b64}" | base64 -d | node`, (err, stream) => {
|
||||
if (err) {
|
||||
console.error(err);
|
||||
conn.end();
|
||||
return;
|
||||
}
|
||||
let out = '';
|
||||
stream.on('data', d => {
|
||||
const chunk = d.toString();
|
||||
process.stdout.write(chunk);
|
||||
out += chunk;
|
||||
});
|
||||
stream.stderr.on('data', d => {
|
||||
process.stderr.write(d.toString());
|
||||
});
|
||||
stream.on('close', () => {
|
||||
const startIdx = out.indexOf('--- JSON_START ---');
|
||||
const endIdx = out.indexOf('--- JSON_END ---');
|
||||
if (startIdx !== -1 && endIdx !== -1) {
|
||||
const jsonStr = out.substring(startIdx + '--- JSON_START ---'.length, endIdx).trim();
|
||||
try {
|
||||
const parsed = JSON.parse(jsonStr);
|
||||
console.log('\n--- REMOTE COLLECTIONS INFO ---');
|
||||
for (const [name, info] of Object.entries(parsed)) {
|
||||
console.log(`- ${name}: ${info.count} documents`);
|
||||
}
|
||||
const fs = require('fs');
|
||||
fs.writeFileSync('C:\\Users\\demo\\.gemini\\antigravity-ide\\scratch\\remote_db_dump.json', jsonStr);
|
||||
console.log('\n✓ Saved full DB dump locally to scratch/remote_db_dump.json');
|
||||
} catch (e) {
|
||||
console.error('\nFailed to parse JSON segment:', e.message);
|
||||
}
|
||||
}
|
||||
conn.end();
|
||||
});
|
||||
});
|
||||
}).on('error', console.error).connect(SSH);
|
||||
Reference in new issue
Block a user