Repository navigation
Expand file tree
/
Copy pathvalidate-database-setup.sh
More file actions
executable file
·95 lines (77 loc) · 3.27 KB
/
Copy pathvalidate-database-setup.sh
File metadata and controls
executable file
·95 lines (77 loc) · 3.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
#!/bin/bash
# Database Setup Validation Script
# Validates that both PostgreSQL and MongoDB contain expected test data
echo "🔍 Validating Database Setup..."
echo "================================"
# Test PostgreSQL connection and data
echo "📊 PostgreSQL Validation:"
echo "-------------------------"
if docker exec aq-devsuite-postgres psql -U pocuser -d poc_db -c "SELECT version();" > /dev/null 2>&1; then
echo "✅ PostgreSQL connection: SUCCESS"
# Check table counts
PG_RESULTS=$(docker exec aq-devsuite-postgres psql -U pocuser -d poc_db -t -c "
SELECT
(SELECT COUNT(*) FROM users) as users,
(SELECT COUNT(*) FROM stories) as stories,
(SELECT COUNT(*) FROM world_elements) as world_elements,
(SELECT COUNT(*) FROM ai_test_logs) as ai_logs;
" | xargs)
echo "📈 PostgreSQL Data Counts: $PG_RESULTS"
# Verify pgvector extension
if docker exec aq-devsuite-postgres psql -U pocuser -d poc_db -c "SELECT extname FROM pg_extension WHERE extname='vector';" | grep -q vector; then
echo "✅ pgvector extension: LOADED"
else
echo "❌ pgvector extension: MISSING"
fi
else
echo "❌ PostgreSQL connection: FAILED"
fi
echo ""
# Test MongoDB connection and data
echo "🍃 MongoDB Validation:"
echo "---------------------"
if docker exec aq-devsuite-mongodb mongosh -u mongoadmin -p mongopass123 --authenticationDatabase admin --eval "db.runCommand('ping')" --quiet > /dev/null 2>&1; then
echo "✅ MongoDB connection: SUCCESS"
# Check collection counts
MONGO_RESULTS=$(docker exec aq-devsuite-mongodb mongosh -u mongoadmin -p mongopass123 --authenticationDatabase admin --eval "
db = db.getSiblingDB('poc_mongo_db');
print(db.users.countDocuments() + ' users, ' +
db.documents.countDocuments() + ' docs, ' +
db.world_building.countDocuments() + ' world, ' +
db.ai_conversations.countDocuments() + ' convos, ' +
db.sessions.countDocuments() + ' sessions');
" --quiet 2>/dev/null)
echo "📈 MongoDB Data Counts: $MONGO_RESULTS"
# Test sample query
if docker exec aq-devsuite-mongodb mongosh -u mongoadmin -p mongopass123 --authenticationDatabase admin --eval "db.getSiblingDB('poc_mongo_db').users.findOne({username: 'alice_writer'})" --quiet > /dev/null 2>&1; then
echo "✅ MongoDB queries: WORKING"
else
echo "❌ MongoDB queries: FAILED"
fi
else
echo "❌ MongoDB connection: FAILED"
fi
echo ""
# Test Management Tools
echo "🛠️ Management Tools:"
echo "-------------------"
if curl -s http://localhost:5050 | grep -q "Redirecting"; then
echo "✅ pgAdmin: ACCESSIBLE (http://localhost:5050)"
else
echo "❌ pgAdmin: NOT ACCESSIBLE"
fi
if docker ps | grep -q aq-devsuite-mongo-express; then
echo "✅ Mongo Express: RUNNING"
else
echo "❌ Mongo Express: NOT RUNNING"
fi
echo ""
echo "🏁 Validation Complete!"
echo "======================"
# Summary
TOTAL_CONTAINERS=$(docker ps | wc -l)
echo "📦 Total running containers: $((TOTAL_CONTAINERS-1))"
echo "🌐 Access URLs:"
echo " • pgAdmin: http://localhost:5050 (admin@example.com / admin)"
echo " • System Monitor: http://localhost:8085"
echo " • Database Credentials: http://localhost:8085/database-credentials.html"