/ scripts / setup / start_echo_system.sh
start_echo_system.sh
 1  #!/usr/bin/env bash
 2  #
 3  # ECHO System Startup
 4  # Starts all agents + monitor dashboard
 5  #
 6  
 7  set -e
 8  
 9  echo "๐Ÿš€ Starting ECHO System..."
10  
11  # 1. Kill any existing agents
12  echo "๐Ÿงน Cleaning up existing agents..."
13  pkill -f "apps/ceo/ceo" || true
14  pkill -f "apps/cto/cto" || true
15  pkill -f "apps/chro/chro" || true
16  pkill -f "apps/operations_head/operations_head" || true
17  pkill -f "apps/product_manager/product_manager" || true
18  pkill -f "apps/senior_architect/senior_architect" || true
19  pkill -f "apps/uiux_engineer/uiux_engineer" || true
20  pkill -f "apps/senior_developer/senior_developer" || true
21  pkill -f "apps/test_lead/test_lead" || true
22  pkill -f "mix phx.server" || true  # Kill monitor if running
23  sleep 1
24  
25  # 2. Start Docker (PostgreSQL + Redis)
26  echo "๐Ÿ“ฆ Starting infrastructure..."
27  docker-compose up -d
28  sleep 3
29  
30  # 3. Export environment variables
31  export DB_HOST=localhost
32  export DB_USER=echo_org
33  export DB_PASSWORD=postgres
34  export DB_PORT=5433
35  export DB_NAME=echo_org
36  export REDIS_HOST=localhost
37  export REDIS_PORT=6383
38  
39  # 4. Start all agents in background
40  echo "๐Ÿค– Starting agents..."
41  ./run_autonomous_agents.sh &
42  sleep 5
43  
44  # 5. Start monitor dashboard
45  echo "๐Ÿ“Š Starting monitor at http://localhost:4000"
46  cd monitor
47  mkdir -p logs
48  
49  # Ensure dependencies are installed (silent)
50  mix deps.get > /dev/null 2>&1 || true
51  
52  # Start in detached mode
53  MIX_ENV=dev elixir --erl "-detached" -S mix phx.server > logs/monitor_phoenix.log 2>&1 &
54  MONITOR_PID=$!
55  echo $MONITOR_PID > logs/monitor.pid
56  echo "โœ… Monitor starting (PID: $MONITOR_PID)"
57  cd ..
58  
59  # Wait for monitor to start
60  echo "โณ Waiting for monitor to start..."
61  sleep 10
62  
63  echo ""
64  echo "โœ… ECHO System Running!"
65  echo ""
66  echo "๐Ÿ“Š Monitor Dashboard: http://localhost:4000"
67  echo "๐Ÿ“ Agent Logs:        tail -f logs/autonomous/*.log"
68  echo "๐Ÿ“ Monitor Log:       tail -f monitor/logs/monitor_phoenix.log"
69  echo ""
70  echo "๐Ÿ“จ Send agenda:       ./send_agenda.sh \"Your agenda here\""
71  echo "๐Ÿ›‘ Stop everything:   ./stop_echo_system.sh"
72  echo ""