infra: unificação de rede docker para sincronização de banco
This commit is contained in:
parent
10431ab9e8
commit
0e9a809cd7
|
|
@ -16,7 +16,7 @@ services:
|
|||
volumes:
|
||||
- pgdata:/var/lib/postgresql/data
|
||||
networks:
|
||||
- edumanager-internal
|
||||
- edumanager-network
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "pg_isready -U edumanager"]
|
||||
interval: 10s
|
||||
|
|
@ -36,7 +36,7 @@ services:
|
|||
volumes:
|
||||
- miniodata:/data
|
||||
networks:
|
||||
- edumanager-internal
|
||||
- edumanager-network
|
||||
- network_public
|
||||
deploy:
|
||||
labels:
|
||||
|
|
@ -71,7 +71,7 @@ services:
|
|||
- ASAAS_API_URL=${ASAAS_API_URL}
|
||||
- ASAAS_WEBHOOK_TOKEN=${ASAAS_WEBHOOK_TOKEN}
|
||||
networks:
|
||||
- edumanager-internal
|
||||
- edumanager-network
|
||||
- network_public
|
||||
deploy:
|
||||
labels:
|
||||
|
|
@ -102,7 +102,7 @@ services:
|
|||
- MINIO_SECRET_KEY=${MINIO_ROOT_PASSWORD:-MiniO2026!Seguro}
|
||||
- MINIO_PUBLIC_URL=${MINIO_PUBLIC_URL:-https://storageedu.microtecinformaticacurso.com.br}
|
||||
networks:
|
||||
- edumanager-internal
|
||||
- edumanager-network
|
||||
- network_public
|
||||
deploy:
|
||||
labels:
|
||||
|
|
@ -119,7 +119,7 @@ volumes:
|
|||
miniodata:
|
||||
|
||||
networks:
|
||||
edumanager-internal:
|
||||
driver: overlay
|
||||
edumanager-network:
|
||||
driver: bridge
|
||||
network_public:
|
||||
external: true
|
||||
|
|
|
|||
|
|
@ -0,0 +1,35 @@
|
|||
|
||||
import pkg from 'pg';
|
||||
const { Pool } = pkg;
|
||||
|
||||
const DATABASE_URL = 'postgresql://edumanager:EduManager2026!Seguro@postgres:5432/edumanager';
|
||||
const pool = new Pool({
|
||||
connectionString: DATABASE_URL
|
||||
});
|
||||
|
||||
async function test() {
|
||||
try {
|
||||
console.log('--- TESTANDO CONEXÃO ---');
|
||||
const { rows: tables } = await pool.query("SELECT table_name FROM information_schema.tables WHERE table_schema = 'public'");
|
||||
console.log('Tabelas encontradas:', tables.map(t => t.table_name).join(', '));
|
||||
|
||||
console.log('\n--- CONTAGEM DE REGISTROS ---');
|
||||
const { rows: countSub } = await pool.query('SELECT COUNT(*) FROM provas_submissoes');
|
||||
console.log('Total em provas_submissoes:', countSub[0].count);
|
||||
|
||||
const { rows: countNot } = await pool.query('SELECT COUNT(*) FROM notas_boletim');
|
||||
console.log('Total em notas_boletim:', countNot[0].count);
|
||||
|
||||
if (countSub[0].count > 0) {
|
||||
const { rows: samples } = await pool.query('SELECT * FROM provas_submissoes LIMIT 1');
|
||||
console.log('\nExemplo de submissão:', samples[0]);
|
||||
}
|
||||
|
||||
} catch (err) {
|
||||
console.error('ERRO NO TESTE:', err.message);
|
||||
} finally {
|
||||
await pool.end();
|
||||
}
|
||||
}
|
||||
|
||||
test();
|
||||
Loading…
Reference in New Issue