Monorepo for Aesthetic.Computer
aesthetic.computer
1#!/bin/bash
2# Quick launcher for MongoDB benchmark
3# Usage: ./benchmark-run.sh [writes] [reads]
4
5# Colors
6GREEN='\033[0;32m'
7YELLOW='\033[1;33m'
8RED='\033[0;31m'
9NC='\033[0m' # No Color
10
11# Default values
12WRITES=${1:-100}
13READS=${2:-100}
14
15echo -e "${GREEN}MongoDB Performance Benchmark${NC}"
16echo "=============================="
17echo ""
18
19# Check if we're in the right directory
20if [ ! -f "utilities/benchmark-mongodb.mjs" ]; then
21 echo -e "${RED}Error: Must run from project root directory${NC}"
22 echo "Usage: ./utilities/benchmark-run.sh [writes] [reads]"
23 exit 1
24fi
25
26# Check for environment variables
27if [ -z "$MONGODB_CONNECTION_STRING" ]; then
28 echo -e "${YELLOW}⚠️ MONGODB_CONNECTION_STRING not set${NC}"
29 echo ""
30 echo "Please set your Atlas credentials:"
31 echo " export MONGODB_CONNECTION_STRING=\"mongodb+srv://...\""
32 echo " export MONGODB_NAME=\"aesthetic\""
33 echo ""
34 echo "Or source from a .env file:"
35 echo " export \$(grep -v '^#' system/.env | xargs)"
36 echo ""
37 exit 1
38fi
39
40# Show configuration
41echo "Configuration:"
42echo " Writes: $WRITES documents"
43echo " Reads: $READS operations"
44echo ""
45echo "Atlas: ${MONGODB_CONNECTION_STRING:0:30}..."
46echo "Silo: ${SILO_MONGODB_CONNECTION_STRING:-mongodb://silo.aesthetic.computer:27017/aesthetic}"
47echo ""
48echo -e "${YELLOW}Starting benchmark...${NC}"
49echo ""
50
51# Run the benchmark
52node utilities/benchmark-mongodb.mjs --writes "$WRITES" --reads "$READS"
53
54# Check exit code
55if [ $? -eq 0 ]; then
56 echo ""
57 echo -e "${GREEN}✅ Benchmark completed successfully${NC}"
58else
59 echo ""
60 echo -e "${RED}❌ Benchmark failed${NC}"
61 exit 1
62fi