-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
justfile
150 lines (111 loc) · 3.52 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
set dotenv-load := true
# Service startup commands
start-api:
cargo run -p api
start-web:
yarn start
start-queue:
cargo run -p forge
# Development commands
dev-api: start-api
dev-web:
yarn dev
dev-queue: start-queue
# Database commands
init-db: create-db migrate
create-db:
sqlx database create
drop-db:
sqlx database drop
mig_source := "packages/db/migrations"
mig: migrate
migrate:
sqlx migrate run --source {{ mig_source }}
mig-add mig_name:
sqlx migrate add {{ mig_name }} --source {{ mig_source }}
revert:
sqlx migrate run --source {{ mig_source }}
# Build commands
build-web:
yarn build
build-api:
cargo build -p api --release
build-queue:
cargo build -p forge --release
# Docker build commands - Queue Service (forge-queue)
biq: build-image-queue # Shorthand for building queue image
build-image-queue: (build-image-queue-local) # Default to local build for queue
# Build queue image for local development (M1/ARM64)
build-image-queue-local:
docker build --platform linux/arm64 -t forge-queue -f config/queue.Dockerfile .
# Build queue image for production (AMD64)
build-image-queue-prod:
docker build --platform linux/amd64 -t forge-queue -f config/queue.Dockerfile .
# Run queue container with local build
run-queue: build-image-queue
docker run -e DATABASE_URL=${DATABASE_URL} forge-queue
# Run queue container with production build
run-queue-prod: build-image-queue-prod
docker run -e DATABASE_URL=${DATABASE_URL} forge-queue
# Docker build commands - API Service (silo-api)
bia: build-image-api # Shorthand for building API image
build-image-api: (build-image-api-local) # Default to local build for API
# Build API image for local development (M1/ARM64)
build-image-api-local:
docker build --platform linux/arm64 -t silo-api -f config/api.Dockerfile .
# Build API image for production (AMD64)
build-image-api-prod:
docker build --platform linux/amd64 -t silo-api -f config/api.Dockerfile .
# Run API container with local build
run-api: build-image-api
docker run -p 3000:3000 -e DATABASE_URL=${DATABASE_URL} -e JWT_SECRET=${JWT_SECRET} silo-api
# Run API container with production build
run-api-prod: build-image-api-prod
docker run -p 3000:3000 -e DATABASE_URL=${DATABASE_URL} -e JWT_SECRET=${JWT_SECRET} silo-api
# Docker build commands - UI Service (barn-ui)
biu: build-image-ui # Shorthand for building UI image
build-image-ui: (build-image-ui-local) # Default to local build for UI
# Build UI image for local development (M1/ARM64)
build-image-ui-local:
docker build --platform linux/arm64 -t barn-ui -f config/ui.Dockerfile .
# Build UI image for production (AMD64)
build-image-ui-prod:
docker build --platform linux/amd64 -t barn-ui -f config/ui.Dockerfile .
# Run UI container with local build
run-ui: build-image-ui
docker run -p 3000:3000 barn-ui
# Run UI container with production build
run-ui-prod: build-image-ui-prod
docker run -p 3000:3000 barn-ui
# Utility commands
sync: sync-web
sync-web:
yarn sync
# Clean commands
clean:
cargo clean
rm -rf node_modules
rm -rf uploads
rm -rf videos
# Verification commands
verify:
cargo check
cargo test
cargo clippy -- -D warnings
cargo fmt --all -- --check
# Run all services
dev: dev-web dev-api dev-queue
# Build all services
build: build-web build-api build-queue
# Nuke all data
nuke:
@just drop-db
@just clean
# Install all dependencies
# TODO: Install ffmpeg dependency
install:
yarn
cargo check
init:
@just install
@just init-db