-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjustfile
More file actions
209 lines (183 loc) · 5.87 KB
/
Copy pathjustfile
File metadata and controls
209 lines (183 loc) · 5.87 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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
# ArbitrageAI - Justfile
# Modern task runner for quick project commands
# Install just: https://just.systems/install.sh
# Default recipe - shows help
default:
@just --list
# ===========================================
# QUICK START
# ===========================================
# Start all services (Ollama + Backend + Frontend)
start:
#!/usr/bin/env bash
set -e
echo "Starting all ArbitrageAI services..."
echo ""
# Ensure logs directory exists
mkdir -p /home/alexc/Projects/ArbitrageAI/logs
# Start Ollama in background
echo "Starting Ollama..."
export OLLAMA_GPU_LAYERS=99
export OLLAMA_NUM_PARALLEL=4
export OLLAMA_CONTEXT_WINDOW=16384
nohup ollama serve > /home/alexc/Projects/ArbitrageAI/logs/ollama.log 2>&1 &
echo "Ollama started in background (check logs/ollama.log)"
# Start Backend in background
cd /home/alexc/Projects/ArbitrageAI
echo "Starting FastAPI backend..."
nohup uvicorn src.api.main:app --host 0.0.0.0 --port 8000 --reload > /home/alexc/Projects/ArbitrageAI/logs/backend.log 2>&1 &
# Wait for backend to start
sleep 3
# Start Frontend in background
cd /home/alexc/Projects/ArbitrageAI/src/client_portal
echo "Starting Vite frontend..."
nohup npm run dev > /home/alexc/Projects/ArbitrageAI/logs/frontend.log 2>&1 &
echo ""
echo "=========================================="
echo " All services started!"
echo "=========================================="
echo " Frontend: http://localhost:5173"
echo " Backend: http://localhost:8000"
echo " API Docs: http://localhost:8000/docs"
echo ""
# Alias for start
serve: start
# ===========================================
# INDIVIDUAL SERVICES
# ===========================================
# Start FastAPI backend only
backend:
#!/usr/bin/env bash
set -e
cd /home/alexc/Projects/ArbitrageAI
mkdir -p logs
echo "Starting FastAPI backend on port 8000..."
uvicorn src.api.main:app --host 0.0.0.0 --port 8000 --reload
# Start Vite frontend only
frontend:
#!/usr/bin/env bash
set -e
cd /home/alexc/Projects/ArbitrageAI/src/client_portal
echo "Starting Vite frontend on port 5173..."
npm run dev
# Start Ollama with P40 optimizations
ollama:
#!/usr/bin/env bash
set -e
cd /home/alexc/Projects/ArbitrageAI
mkdir -p logs
export OLLAMA_GPU_LAYERS=99
export OLLAMA_NUM_PARALLEL=4
export OLLAMA_CONTEXT_WINDOW=16384
export OLLAMA_FLASH_ATTENTION=1
echo "Starting Ollama with P40 optimizations..."
echo " GPU_LAYERS: $OLLAMA_GPU_LAYERS"
echo " NUM_PARALLEL: $OLLAMA_NUM_PARALLEL"
echo " CONTEXT_WINDOW: $OLLAMA_CONTEXT_WINDOW"
nohup ollama serve > logs/ollama.log 2>&1 &
echo "Ollama started (logs: logs/ollama.log)"
# ===========================================
# INSTALLATION & SETUP
# ===========================================
# Install all dependencies (Python + Node.js)
install:
#!/usr/bin/env bash
set -e
cd /home/alexc/Projects/ArbitrageAI
echo "Installing Python dependencies..."
pip install -e .
echo ""
echo "Installing Node.js dependencies..."
cd /home/alexc/Projects/ArbitrageAI/src/client_portal
npm install
# Full first-time setup (dependencies + Docker image)
setup: install
#!/usr/bin/env bash
set -e
cd /home/alexc/Projects/ArbitrageAI
echo "Building Docker sandbox image..."
docker build -t ai-sandbox-base -f Dockerfile.sandbox .
echo ""
echo "Setup complete! Run 'just start' to begin."
# ===========================================
# SERVICE MANAGEMENT
# ===========================================
# Stop all running services
stop:
#!/usr/bin/env bash
echo "Stopping ArbitrageAI services..."
pkill -f 'uvicorn.*src.api.main' && echo "✓ Stopped backend" || echo "- Backend not running"
pkill -f 'vite' && echo "✓ Stopped frontend" || echo "- Frontend not running"
echo "Services stopped."
# Show status of all services
status:
#!/usr/bin/env bash
echo "Checking ArbitrageAI services..."
echo ""
# Check Ollama
if curl -s http://localhost:11434/api/version > /dev/null 2>&1; then
echo "✓ Ollama: running"
else
echo "✗ Ollama: not running"
fi
# Check Backend
if curl -s http://localhost:8000/ > /dev/null 2>&1; then
echo "✓ Backend: running (http://localhost:8000)"
else
echo "✗ Backend: not running"
fi
# Check Frontend
if curl -s http://localhost:5173/ > /dev/null 2>&1; then
echo "✓ Frontend: running (http://localhost:5173)"
else
echo "✗ Frontend: not running"
fi
echo ""
# Show logs for a service
logs service:
#!/usr/bin/env bash
case {{service}} in
ollama)
tail -f /home/alexc/Projects/ArbitrageAI/logs/ollama.log
;;
backend)
tail -f /home/alexc/Projects/ArbitrageAI/logs/backend.log
;;
frontend)
tail -f /home/alexc/Projects/ArbitrageAI/logs/frontend.log
;;
*)
echo "Available services: ollama, backend, frontend"
;;
esac
# ===========================================
# DEVELOPMENT COMMANDS
# ===========================================
# Run tests
test:
#!/usr/bin/env bash
set -e
cd /home/alexc/Projects/ArbitrageAI
pytest tests/ -v
# Run linter
lint:
#!/usr/bin/env bash
set -e
cd /home/alexc/Projects/ArbitrageAI
ruff check src/
# Format code
format:
#!/usr/bin/env bash
set -e
cd /home/alexc/Projects/ArbitrageAI
ruff format src/
# Open API docs in browser
docs:
#!/usr/bin/env bash
if command -v xdg-open > /dev/null; then
xdg-open http://localhost:8000/docs
elif command -v open > /dev/null; then
open http://localhost:8000/docs
else
echo "Open http://localhost:8000/docs in your browser"
fi