forked from IshikawaUta/ruby-chatbot
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstart.sh
More file actions
executable file
·34 lines (28 loc) · 958 Bytes
/
start.sh
File metadata and controls
executable file
·34 lines (28 loc) · 958 Bytes
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
#!/bin/bash
# Fungsi untuk mematikan semua proses saat script dihentikan (Ctrl+C)
cleanup() {
echo ""
echo "Menghentikan semua server..."
kill $BRAIN_PID 2>/dev/null
exit
}
trap cleanup SIGINT SIGTERM
echo "------------------------------------------"
echo "🚀 Menjalankan WhatsApp AI Chatbot..."
echo "------------------------------------------"
# 1. Jalankan Ruby Brain di background
echo "1. Memulai Ruby Brain (eksa-server) di port 5000..."
(cd brain && bundle exec eksa-server --host 0.0.0.0 -p 5000 -c 0 config.ru) &
BRAIN_PID=$!
# Cek apakah brain berhasil jalan
sleep 3
if ps -p $BRAIN_PID > /dev/null; then
echo "✅ Ruby Brain berhasil dijalankan (PID: $BRAIN_PID)"
else
echo "❌ Gagal menjalankan Ruby Brain. Periksa log di atas."
exit 1
fi
# 2. Jalankan Node.js Bridge di foreground
echo "2. Memulai Node.js Bridge di port 3001..."
echo "------------------------------------------"
cd bridge && node server.js