-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjustfile
208 lines (161 loc) · 4.94 KB
/
justfile
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
# List all recipes
default:
@just --list
# Start all services with Docker Compose
up:
docker compose up -d
# Stop all services
down:
docker compose down
# Show logs for all services
logs:
docker compose logs -f
# Show logs for a specific service
service-logs service:
docker compose logs -f {{service}}
# Pull the Mistral model for Ollama
ollama-pull:
docker compose exec ollama ollama pull mistral
# Start up the frontend
frontend-up:
npm run dev
alias fe := frontend-up
# Start the database container
db-up:
./scripts/db/up.sh
# Stop the database container
db-down:
./scripts/db/down.sh
# Restart the database container
db-restart:
just db-down
just db-up
# Connect to PostgreSQL database
db-connect:
docker exec -it language_vows-db-1 psql -U postgres -d language_vows
# Show all tables in the database
db-tables:
./scripts/db/status.sh
# Show contents of vows table
db-vows:
docker exec language_vows-db-1 psql -U postgres -d language_vows -c '\x on' -c 'SELECT * FROM vows;'
# Count rows in a table (default: vows)
db-count table="vows":
docker exec language_vows-db-1 psql -U postgres -d language_vows -t -c 'SELECT COUNT(*) FROM {{table}};' | tr -d '[:space:]'
# Clear all vows from the table
db-clear:
docker exec -it language_vows-db-1 psql -U postgres -d language_vows -c 'DELETE FROM vows;'
# Create the vows table (idempotent)
db-init:
docker exec -it language_vows-db-1 psql -U postgres -d language_vows -f /docker-entrypoint-initdb.d/schema.sql
# Run the Go backend server
go-run:
./scripts/dev/go-run.sh
# Check status of all services
status:
@echo "=== Database Status ==="
@just db-status
@echo "\n=== Backend Status ==="
@just backend-status
@echo "\n=== Ollama Status ==="
@just ollama-status
# Check database status
db-status:
./scripts/db/status.sh
# Check backend status
backend-status:
@curl -s http://localhost:8080/api/vows > /dev/null && echo "Backend: ✅ Running" || echo "Backend: ❌ Not running"
# Check Ollama status
ollama-status:
@curl -s http://localhost:11434/api/version > /dev/null && echo "Ollama: ✅ Running" || echo "Ollama: ❌ Not running"
# Start everything (backend, database, and Ollama)
start:
just db-up
docker compose up -d ollama
sleep 5 # Give Ollama time to start
just go-run
alias be := start
# Backup the database to a file (seed.sql or timestamped)
db-backup type="timestamp":
./scripts/db/backup.sh {{type}}
# Restore the database from backup
db-restore:
./scripts/db/restore.sh
# Initialize database with schema and seed data
db-init-all:
just db-init
just db-restore
# List all AWS resources for the project
aws-status:
./scripts/aws/status.sh
# Check specific AWS resource status
aws-check RESOURCE:
./scripts/aws/check.sh {{RESOURCE}}
# Set GitHub secrets from AWS config and generated credentials
gh-secrets:
./scripts/gh-secrets.sh
# Check AWS Secrets Manager
aws-check-secrets:
./scripts/aws/secrets.sh
# Validate ECS task definitions
aws-validate-tasks:
./scripts/aws/validate-tasks.sh
# Check ECS service status and events
aws-check-services:
./scripts/aws/services.sh
# Check AWS Fargate service quotas
aws-check-quotas:
./scripts/aws/quotas.sh
# Create AWS secret for DB password
aws-create-secret:
./scripts/aws/create-secret.sh
# Update task definitions with actual values
aws-update-tasks:
./scripts/aws/update-tasks.sh
# Create security groups for ECS and RDS
aws-create-security:
./scripts/aws/create-security.sh
# Create ECS execution role
aws-create-ecs-role:
./scripts/aws/create-ecs-role.sh
# Create ECS services
aws-create-services:
./scripts/aws/create-services.sh
# Clean up AWS resources
aws-cleanup:
./scripts/aws/cleanup.sh
# Full AWS cleanup including VPC and RDS
aws-teardown:
./scripts/aws/teardown.sh
# Generate AWS task definitions
aws-generate-tasks:
./scripts/aws/generate-task-definitions.sh
# Full AWS setup sequence with generated tasks
aws-setup-all:
test -f .env.aws || { echo "Error: Must be run from project root directory"; exit 1; }
just aws-generate-tasks
test -x scripts/aws/setup-all.sh || chmod +x scripts/aws/setup-all.sh
scripts/aws/setup-all.sh
# Check all AWS resource status
aws-status-all:
./scripts/aws/status-all.sh
# Fetch AWS credentials and save to .env.aws.generated
aws-fetch-credentials:
./scripts/dev/fetch-credentials.sh
# Format Go code
go-fmt:
gofmt -w ./backend
# Run Go linter
go-lint:
cd backend && golangci-lint run ./...
# Install Go tools
go-tools:
go install golang.org/x/tools/cmd/goimports@latest
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin
# Auto-fix common Go issues
go-fix:
cd backend && goimports -w .
cd backend && go vet ./...
cd backend && golangci-lint run --fix ./...
# Format and lint Go code (with fixes)
go-format: go-fmt go-fix go-lint