cohorta/backend/scripts/setup_mongodb.sh
Vadym Samoilenko 9d2f1f2c7d
Some checks failed
Deploy to Production / deploy (push) Failing after 0s
feat: complete AIMPRESS visual rebrand — warm palette, new landing, real dashboard
- Replace cyan/violet design tokens with warm dark slate + orange (#E89B3C) palette
- Add Space Grotesk display font; new utilities: .outline-display, .orange-band, .corner-card, .persona-orb
- New brand components: Logo (hexagonal SVG), Header (pill nav + glass blur), Footer (4-col), PublicLayout, AppLayout, UserDropdown
- Rewrite Index.tsx as full sales funnel: Hero → Stats → Orange band → How it works → Pricing (API) → FAQ → Final CTA
- Rewrite Dashboard.tsx with real API data: credits balance, MTD spend, personas count, focus groups count, active tasks, recent transactions
- Rewrite auth pages (Login, Register, VerifyEmail, NotFound, Billing) with two-column orange-panel layout
- Replace hardcoded mock numbers in Dashboard with billingApi / personasApi / focusGroupsApi / usageApi calls
- Delete legacy components: Navigation.tsx, Hero.tsx, FeatureCard.tsx
- Add nested layout routing in App.tsx: PublicLayout for guests, AppLayout for protected routes
- Color sweep inner pages: replace all purple-500/600 with primary token
- Purge all semblance / Oliver / optical-dev references; rename semblance_app_documentation.md → cohorta_app_documentation.md; update backend scripts to cohorta_db

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-23 19:44:02 +01:00

78 lines
2.5 KiB
Bash
Executable file

#!/bin/bash
# DEV-ONLY: MongoDB setup script for local development environments.
# DO NOT run in production.
# Define colors for readable output
GREEN="\033[0;32m"
RED="\033[0;31m"
YELLOW="\033[0;33m"
BLUE="\033[0;34m"
NC="\033[0m" # No Color
# S-C2: Block production environments
MONGO_HOST="${MONGO_HOST:-localhost}"
APP_ENV="${APP_ENV:-development}"
echo -e "${BLUE}===== MongoDB Setup Script (DEV ONLY) =====${NC}"
echo -e "This script sets up MongoDB for LOCAL DEVELOPMENT only."
echo ""
if [ "$APP_ENV" = "production" ]; then
echo -e "${RED}ERROR: This script must not be run in production (APP_ENV=production).${NC}"
exit 1
fi
if [ "$MONGO_HOST" != "localhost" ] && [ "$MONGO_HOST" != "127.0.0.1" ]; then
echo -e "${RED}ERROR: MONGO_HOST is set to '$MONGO_HOST'. This script only runs against localhost.${NC}"
exit 1
fi
echo -e "${YELLOW}WARNING: This script configures MongoDB for development (no authentication).${NC}"
echo -e "This is INSECURE and should NEVER be done on a production server."
echo ""
read -r -p "Continue? [y/N] " confirm
if [ "$confirm" != "y" ] && [ "$confirm" != "Y" ]; then
echo "Aborted."
exit 0
fi
# Check if MongoDB is running
if ! pgrep -x "mongod" > /dev/null; then
echo -e "${YELLOW}MongoDB is not running. Attempting to start MongoDB...${NC}"
if [[ "$OSTYPE" == "darwin"* ]]; then
# macOS
brew services start mongodb-community || mongod --config /usr/local/etc/mongod.conf --fork
else
# Linux
sudo systemctl start mongod || sudo service mongod start
fi
# Wait for MongoDB to start
sleep 3
# Check again
if ! pgrep -x "mongod" > /dev/null; then
echo -e "${RED}Failed to start MongoDB. Please start it manually before running this script.${NC}"
exit 1
else
echo -e "${GREEN}MongoDB started successfully.${NC}"
fi
else
echo -e "${GREEN}MongoDB is already running.${NC}"
fi
echo -e "${YELLOW}Creating cohorta_db database and collections...${NC}"
# S-M3: Use mongosh instead of deprecated mongo CLI
mongosh --eval '
db = db.getSiblingDB("cohorta_db");
db.createCollection("users");
db.createCollection("personas");
db.createCollection("focus_groups");
print("Collections created.");
'
echo -e "${GREEN}MongoDB setup completed. The database is now ready for development.${NC}"
echo -e "${YELLOW}Note: You may need to restart MongoDB for all changes to take effect:${NC}"
echo -e " - On macOS: brew services restart mongodb-community"
echo -e " - On Linux: sudo systemctl restart mongod"