-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathjustfile
More file actions
240 lines (201 loc) Β· 8.43 KB
/
justfile
File metadata and controls
240 lines (201 loc) Β· 8.43 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
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
# Soulcaster Development Commands
# Run 'just' to see all available commands
# Default recipe - show help
default:
@just --list
# ============================================================================
# Development
# ============================================================================
# Run FastAPI backend (localhost:8000)
dev-backend:
@echo "π Starting FastAPI backend on http://localhost:8000"
cd backend && uv run uvicorn main:app --reload --port 8000
# Run Next.js dashboard (localhost:3000)
dev-dashboard:
@echo "π Starting Next.js dashboard on http://localhost:3000"
cd dashboard && npm run dev
# Reset all DEV data (Redis + Vector)
dev-reset:
@echo "ποΈ Resetting DEV data..."
python scripts/reset_dev_data.py
# Reset DEV data without confirmation
dev-reset-force:
@echo "ποΈ Force resetting DEV data (no confirmation)..."
python scripts/reset_dev_data.py --force
# ============================================================================
# Docker (Local Testing Only - Production uses hosting platform)
# ============================================================================
# Build backend Docker image from repo root (local testing)
docker-build:
@echo "π³ Building backend Docker image (from repo root)..."
@echo "βΉοΈ Production builds happen automatically on hosting platform"
docker build -t soulcaster-backend -f Dockerfile .
# Run backend in Docker with unified .env (local test)
docker-run:
@echo "π³ Running backend in Docker on http://localhost:8000"
@echo "Loading env vars from .env"
docker run -p 8000:8000 --env-file .env soulcaster-backend
# Build and run with Docker Compose (includes Redis + unified .env)
docker-up:
@echo "π³ Starting backend + Redis with Docker Compose..."
@echo "Using unified .env from project root (../.env)"
@echo "βΉοΈ This is for local testing - production uses hosting platform"
cd backend && docker-compose up --build
# Stop Docker Compose services
docker-down:
@echo "π³ Stopping Docker Compose services..."
cd backend && docker-compose down
# View Docker Compose logs
docker-logs:
@echo "π Showing Docker Compose logs..."
cd backend && docker-compose logs -f
# Test Docker build without cache (troubleshooting)
docker-build-clean:
@echo "π³ Building Docker image (no cache, from repo root)..."
docker build --no-cache -t soulcaster-backend -f Dockerfile .
# ============================================================================
# Production
# ============================================================================
# Check production backend health
prod-health:
#!/usr/bin/env bash
if [ -z "$PROD_BACKEND_URL" ]; then
echo "β PROD_BACKEND_URL not set"
exit 1
fi
echo "π₯ Checking production backend health..."
curl -sf $PROD_BACKEND_URL/health | jq '.' || echo "β Health check failed"
# Deploy backend (git push triggers auto-deploy)
prod-deploy-backend:
@echo "π Deploying backend..."
@echo "β οΈ Ensure you've:"
@echo " 1. Committed all changes"
@echo " 2. Updated env vars in hosting dashboard"
@echo " 3. Pushed to 'main' branch"
@echo ""
git push origin main
# Deploy dashboard to Vercel
prod-deploy-dashboard:
@echo "π Deploying dashboard to Vercel..."
cd dashboard && vercel --prod
# ============================================================================
# Testing & Quality
# ============================================================================
# Run all tests
test: test-backend test-dashboard
# Run backend tests
test-backend:
@echo "π§ͺ Running backend tests..."
cd backend && uv run pytest -v
# Run dashboard tests
test-dashboard:
@echo "π§ͺ Running dashboard tests..."
cd dashboard && npm test
# Run linters
lint:
@echo "π Linting code..."
@echo "Backend:"
cd backend && uv run ruff check .
@echo "\nDashboard:"
cd dashboard && npm run lint
# Format code
format:
@echo "β¨ Formatting code..."
@echo "Backend:"
cd backend && uv run black .
cd backend && uv run ruff check --fix .
@echo "\nDashboard:"
cd dashboard && npm run format
# ============================================================================
# Installation
# ============================================================================
# Install backend dependencies with uv
install-backend:
@echo "π¦ Installing backend dependencies with uv..."
cd backend && uv sync
# Install dashboard dependencies
install-dashboard:
@echo "π¦ Installing dashboard dependencies..."
cd dashboard && npm install
cd dashboard && npx prisma generate
# Install all dependencies
install: install-backend install-dashboard
@echo "β
All dependencies installed!"
# ============================================================================
# Database
# ============================================================================
# Run Prisma migrations
db-migrate:
@echo "ποΈ Running Prisma migrations..."
cd dashboard && npx prisma migrate dev
# Reset Prisma database (DEV only!)
db-reset:
@echo "ποΈ Resetting Prisma database..."
cd dashboard && npx prisma migrate reset
# Open Prisma Studio
db-studio:
@echo "ποΈ Opening Prisma Studio..."
cd dashboard && npx prisma studio
# ============================================================================
# Utilities
# ============================================================================
# Check environment configuration
check-env:
#!/usr/bin/env bash
echo "π Checking environment configuration..."
echo ""
echo "Unified .env (recommended):"
if [ -f .env ]; then
echo " β
Found at project root"
echo ""
echo " Required variables:"
grep -q "^ENVIRONMENT=" .env && echo " β
ENVIRONMENT" || echo " β ENVIRONMENT (missing or commented)"
grep -q "^UPSTASH_REDIS_REST_URL=" .env && echo " β
UPSTASH_REDIS_REST_URL" || echo " β UPSTASH_REDIS_REST_URL"
grep -q "^UPSTASH_REDIS_REST_TOKEN=" .env && echo " β
UPSTASH_REDIS_REST_TOKEN" || echo " β UPSTASH_REDIS_REST_TOKEN"
grep -q "^UPSTASH_VECTOR_REST_URL=" .env && echo " β
UPSTASH_VECTOR_REST_URL" || echo " β UPSTASH_VECTOR_REST_URL"
grep -q "^UPSTASH_VECTOR_REST_TOKEN=" .env && echo " β
UPSTASH_VECTOR_REST_TOKEN" || echo " β UPSTASH_VECTOR_REST_TOKEN"
grep -q "^GEMINI_API_KEY=" .env && echo " β
GEMINI_API_KEY" || echo " β GEMINI_API_KEY"
grep -q "^GITHUB_ID=" .env && echo " β
GITHUB_ID" || echo " β GITHUB_ID"
grep -q "^GITHUB_SECRET=" .env && echo " β
GITHUB_SECRET" || echo " β GITHUB_SECRET"
grep -q "^NEXTAUTH_SECRET=" .env && echo " β
NEXTAUTH_SECRET" || echo " β NEXTAUTH_SECRET"
grep -q "^DATABASE_URL=" .env && echo " β
DATABASE_URL" || echo " β DATABASE_URL"
grep -q "^E2B_API_KEY=" .env && echo " β
E2B_API_KEY" || echo " β E2B_API_KEY"
else
echo " β Missing - run: cp .env.example .env"
fi
echo ""
echo "Legacy files (should be removed):"
if [ -f backend/.env ]; then echo " β οΈ backend/.env exists (remove it)"; fi
if [ -f dashboard/.env.local ]; then echo " β οΈ dashboard/.env.local exists (remove it)"; fi
# Tail local backend logs
logs-backend-dev:
@echo "π Tailing local backend logs..."
tail -f backend/logs/*.log 2>/dev/null || echo "No log files found"
# Clean build artifacts
clean:
@echo "π§Ή Cleaning build artifacts..."
rm -rf backend/__pycache__ backend/**/__pycache__
rm -rf dashboard/.next dashboard/node_modules/.cache
@echo "β
Clean complete"
# ============================================================================
# Git & Worktree
# ============================================================================
# Show current worktree info
worktree-info:
@echo "π Worktree Information:"
@git worktree list
@echo ""
@echo "Current branch:"
@git branch --show-current
@echo ""
@echo "Status:"
@git status -s
# Create a new worktree for a feature
worktree-create BRANCH:
@echo "π³ Creating worktree for {{BRANCH}}..."
git worktree add ../soulcaster-{{BRANCH}} -b {{BRANCH}}
@echo "β
Created at ../soulcaster-{{BRANCH}}"
# Remove a worktree
worktree-remove PATH:
@echo "ποΈ Removing worktree at {{PATH}}..."
git worktree remove {{PATH}}