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:
|
volumes:
|
||||||
- pgdata:/var/lib/postgresql/data
|
- pgdata:/var/lib/postgresql/data
|
||||||
networks:
|
networks:
|
||||||
- edumanager-internal
|
- edumanager-network
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test: ["CMD-SHELL", "pg_isready -U edumanager"]
|
test: ["CMD-SHELL", "pg_isready -U edumanager"]
|
||||||
interval: 10s
|
interval: 10s
|
||||||
|
|
@ -36,7 +36,7 @@ services:
|
||||||
volumes:
|
volumes:
|
||||||
- miniodata:/data
|
- miniodata:/data
|
||||||
networks:
|
networks:
|
||||||
- edumanager-internal
|
- edumanager-network
|
||||||
- network_public
|
- network_public
|
||||||
deploy:
|
deploy:
|
||||||
labels:
|
labels:
|
||||||
|
|
@ -71,7 +71,7 @@ services:
|
||||||
- ASAAS_API_URL=${ASAAS_API_URL}
|
- ASAAS_API_URL=${ASAAS_API_URL}
|
||||||
- ASAAS_WEBHOOK_TOKEN=${ASAAS_WEBHOOK_TOKEN}
|
- ASAAS_WEBHOOK_TOKEN=${ASAAS_WEBHOOK_TOKEN}
|
||||||
networks:
|
networks:
|
||||||
- edumanager-internal
|
- edumanager-network
|
||||||
- network_public
|
- network_public
|
||||||
deploy:
|
deploy:
|
||||||
labels:
|
labels:
|
||||||
|
|
@ -102,7 +102,7 @@ services:
|
||||||
- MINIO_SECRET_KEY=${MINIO_ROOT_PASSWORD:-MiniO2026!Seguro}
|
- MINIO_SECRET_KEY=${MINIO_ROOT_PASSWORD:-MiniO2026!Seguro}
|
||||||
- MINIO_PUBLIC_URL=${MINIO_PUBLIC_URL:-https://storageedu.microtecinformaticacurso.com.br}
|
- MINIO_PUBLIC_URL=${MINIO_PUBLIC_URL:-https://storageedu.microtecinformaticacurso.com.br}
|
||||||
networks:
|
networks:
|
||||||
- edumanager-internal
|
- edumanager-network
|
||||||
- network_public
|
- network_public
|
||||||
deploy:
|
deploy:
|
||||||
labels:
|
labels:
|
||||||
|
|
@ -119,7 +119,7 @@ volumes:
|
||||||
miniodata:
|
miniodata:
|
||||||
|
|
||||||
networks:
|
networks:
|
||||||
edumanager-internal:
|
edumanager-network:
|
||||||
driver: overlay
|
driver: bridge
|
||||||
network_public:
|
network_public:
|
||||||
external: true
|
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