-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathjustfile
More file actions
427 lines (335 loc) · 13.4 KB
/
justfile
File metadata and controls
427 lines (335 loc) · 13.4 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
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
# All Things Linux monorepo — task runner (https://just.systems/)
# Requires: pnpm 10+, Node 24+, uv, Docker, just.
# Run `just setup` once after cloning to bootstrap everything.
set dotenv-load := true
set positional-arguments := true
# Compose project for chat services
chat_compose := "-f compose.yaml -f compose.dev-override.yaml --env-file .env --env-file .env.dev"
# ── Default ────────────────────────────────────────────────────────────────────
default:
@just --list
# ── Workspace ─────────────────────────────────────────────────────────────────
[group('workspace')]
setup:
@echo "Bootstrapping full development environment..."
pnpm install
uv sync --all-extras
./scripts/init.sh dev
[ ! -f .env ] && cp .env.example .env || true
[ ! -f .env.dev ] && cp .env.dev.example .env.dev || true
@echo "Done. Run 'just dev' to start JS apps or 'just chat-dev' for chat services."
[group('workspace')]
install:
pnpm install
[group('workspace')]
install-frozen:
pnpm install --frozen-lockfile
[group('workspace')]
build:
pnpm exec turbo run build
[group('workspace')]
dev:
pnpm exec turbo run dev
[group('workspace')]
check:
pnpm run lint
[group('workspace')]
fix:
pnpm run fix
[group('workspace')]
typecheck:
pnpm exec turbo run type-check
[group('workspace')]
test:
pnpm exec turbo run test
[group('workspace')]
test-coverage:
pnpm exec turbo run test:coverage
[group('workspace')]
clean:
pnpm run clean
# ── Web (apps/web — allthingslinux.org) ───────────────────────────────────────
[group('web')]
web-dev:
pnpm --filter @atl/web run dev
[group('web')]
web-build:
pnpm --filter @atl/web run build
[group('web')]
web-deploy:
pnpm --filter @atl/web run deploy
[group('web')]
web-destroy:
pnpm --filter @atl/web run destroy
[group('web')]
web-shadcn-add *ARGS:
cd apps/web && npx shadcn@latest add --overwrite {{ ARGS }}
# ── Chat Web (apps/chat-web — atl.chat marketing) ─────────────────────────────
[group('web')]
chat-web-dev:
pnpm --filter @atl/chat-web run dev
[group('web')]
chat-web-build:
pnpm --filter @atl/chat-web run build
[group('web')]
chat-web-deploy:
pnpm --filter @atl/chat-web run deploy
# ── Portal (apps/portal) ──────────────────────────────────────────────────────
[group('portal')]
portal-dev:
pnpm --filter @atl/portal run dev
[group('portal')]
portal-build:
pnpm --filter @atl/portal run build
[group('portal')]
portal-start:
pnpm --filter @atl/portal run start
[group('portal')]
portal-db-up:
pnpm --filter @atl/portal run compose:db
[group('portal')]
portal-db-down:
pnpm --filter @atl/portal run compose:db:down
[group('portal')]
portal-db-generate:
pnpm --filter @atl/portal run db:generate
[group('portal')]
portal-db-migrate:
pnpm --filter @atl/portal run db:migrate
[group('portal')]
portal-db-push:
pnpm --filter @atl/portal run db:push
[group('portal')]
portal-db-studio:
pnpm --filter @atl/portal run db:studio
[group('portal')]
portal-db-seed:
pnpm --filter @atl/portal run db:seed
[group('portal')]
portal-shadcn-add *ARGS:
cd apps/portal && npx shadcn@latest add --overwrite {{ ARGS }}
# ── Chat Services (IRC + XMPP + bridge — Docker) ──────────────────────────────
[group('chat')]
chat-init:
@echo "Initializing chat service data directories and config..."
./scripts/init.sh dev
[group('chat')]
chat-dev:
@if docker compose {{ chat_compose }} ps --services --status running | grep -q "."; then \
echo "Error: chat containers already running. Run 'just chat-down' first."; \
exit 1; \
fi
./scripts/init.sh dev
docker compose {{ chat_compose }} --profile dev up -d
[group('chat')]
chat-prod:
./scripts/init.sh prod
docker compose -f compose.yaml -f compose.prod-override.yaml --env-file .env --env-file .env.prod up -d
[group('chat')]
chat-down:
docker compose {{ chat_compose }} --profile dev down
[group('chat')]
chat-down-prod:
docker compose -f compose.yaml -f compose.prod-override.yaml --env-file .env --env-file .env.prod down
[group('chat')]
chat-logs service="":
docker compose {{ chat_compose }} logs -f ${service:+"$service"}
[group('chat')]
chat-status:
docker compose {{ chat_compose }} ps
[group('chat')]
chat-build:
docker compose {{ chat_compose }} build
[group('chat')]
chat-build-clean service="":
docker compose {{ chat_compose }} build --no-cache ${service:+"$service"}
[group('chat')]
prosody-token:
@docker exec -i atl-xmpp-server prosodyctl shell <<< '>local tk = prosody.hosts["xmpp.localhost"].modules.tokenauth; local grant = tk.create_grant("admin@xmpp.localhost", "admin@xmpp.localhost", nil, {}); local token = tk.create_token("admin@xmpp.localhost", grant, "prosody:operator", nil, "portal-api"); print(token)' 2>&1 | grep -oP 'secret-token:\S+'
[group('chat')]
gencloak:
#!/usr/bin/env bash
set -e
output=$(docker compose run --rm atl-irc-server gencloak 2>/dev/null)
echo "$output"
mapfile -t keys < <(echo "$output" | grep -oE '"[^"]{50,}"' | tr -d '"')
if [ ${#keys[@]} -ne 3 ]; then
echo "Failed to parse 3 cloak keys from gencloak output"; exit 1
fi
[ -f .env ] || cp .env.example .env
if grep -q '^IRC_CLOAK_KEY_1=' .env; then
sed -i "s|^IRC_CLOAK_KEY_1=.*|IRC_CLOAK_KEY_1=${keys[0]}|" .env
sed -i "s|^IRC_CLOAK_KEY_2=.*|IRC_CLOAK_KEY_2=${keys[1]}|" .env
sed -i "s|^IRC_CLOAK_KEY_3=.*|IRC_CLOAK_KEY_3=${keys[2]}|" .env
else
printf '\nIRC_CLOAK_KEY_1=%s\nIRC_CLOAK_KEY_2=%s\nIRC_CLOAK_KEY_3=%s\n' \
"${keys[0]}" "${keys[1]}" "${keys[2]}" >> .env
fi
echo "Cloak keys written to .env — restart IRC to apply."
# ── Bridge (apps/bridge — Python) ────────────────────────────────────────────
[group('bridge')]
bridge-install:
uv sync --all-extras
[group('bridge')]
bridge-check:
uv run ruff check apps/bridge/src apps/bridge/tests
uv run ruff format --check apps/bridge/src apps/bridge/tests
[group('bridge')]
bridge-fix:
uv run ruff check --fix apps/bridge/src apps/bridge/tests
uv run ruff format apps/bridge/src apps/bridge/tests
[group('bridge')]
bridge-typecheck:
uv run basedpyright
[group('bridge')]
bridge-test:
uv run pytest apps/bridge/tests -v --tb=short
[group('bridge')]
bridge-logs:
docker compose {{ chat_compose }} logs -f atl-bridge
# ── Docs (apps/docs) ──────────────────────────────────────────────────────────
[group('docs')]
docs-dev:
pnpm --filter @atl/docs run dev
[group('docs')]
docs-build:
pnpm --filter @atl/docs run build
[group('docs')]
docs-check-links:
pnpm --filter @atl/docs run lint:links
# ── Tools (atl.tools — self-hosted service directory) ────────────────────────
tools_compose := "-f compose.yaml --env-file .env --env-file .env.dev"
[group('tools')]
tools-dev:
docker compose {{ tools_compose }} up -d atl-tools-privatebin atl-tools-cyberchef atl-tools-convertx atl-tools-searxng atl-tools-it-tools atl-tools-jsoncrack atl-tools-stirling-pdf atl-tools-hckrnws
[group('tools')]
tools-up service:
docker compose {{ tools_compose }} up -d {{ service }}
[group('tools')]
tools-down:
docker compose {{ tools_compose }} stop atl-tools-privatebin atl-tools-cyberchef atl-tools-convertx atl-tools-searxng atl-tools-it-tools atl-tools-jsoncrack atl-tools-stirling-pdf atl-tools-hckrnws
[group('tools')]
tools-logs service="":
docker compose {{ tools_compose }} logs -f {{ service }}
[group('tools')]
tools-status:
docker compose {{ tools_compose }} ps atl-tools-privatebin atl-tools-cyberchef atl-tools-convertx atl-tools-searxng atl-tools-it-tools atl-tools-jsoncrack atl-tools-stirling-pdf atl-tools-hckrnws
[group('tools')]
tools-build:
docker compose {{ tools_compose }} build atl-tools-jsoncrack atl-tools-hckrnws
[group('tools')]
tools-web-dev:
pnpm --filter @atl/tools-web run dev
[group('tools')]
tools-web-build:
pnpm --filter @atl/tools-web run build
[group('tools')]
tools-web-deploy:
pnpm --filter @atl/tools-web run deploy
# ── CI & Config Validation ────────────────────────────────────────────────────
[group('ci')]
renovate-validate:
pnpm dlx --package=renovate renovate-config-validator .github/renovate.json5
# ── Infra & Maintenance ───────────────────────────────────────────────────────
[group('infra')]
docker-clean:
docker system prune -f
docker volume prune -f
[group('infra')]
docker-push-all:
@echo "Push all service images to GHCR..."
docker compose {{ chat_compose }} push
# ── Pubnix (infra/sh — atl.sh server provisioning) ────────────────────────────
pubnix_ansible := "infra/sh/ansible"
pubnix_terraform := "infra/sh/terraform"
pubnix_root := "infra/sh"
[group('pubnix')]
pubnix-setup:
cd {{ pubnix_root }} && uv sync
just pubnix-install
@echo "Pubnix tooling ready. Run 'just pubnix-dev-up' to start the dev VM."
[group('pubnix')]
pubnix-install:
cd {{ pubnix_ansible }} && ansible-galaxy role install -r requirements.yml -p ../.ansible/roles --force
cd {{ pubnix_ansible }} && ansible-galaxy collection install -r requirements.yml -p ../.ansible/collections --force
[group('pubnix')]
pubnix-deploy target:
cd {{ pubnix_ansible }} && ansible-playbook site.yml -l "{{ target }}"
[group('pubnix')]
pubnix-deploy-tag target tag:
cd {{ pubnix_ansible }} && ansible-playbook site.yml -l "{{ target }}" --tags "{{ tag }}"
[group('pubnix')]
pubnix-deploy-check target:
cd {{ pubnix_ansible }} && ansible-playbook site.yml -l "{{ target }}" --check --diff
[group('pubnix')]
pubnix-deploy-list-tags:
cd {{ pubnix_ansible }} && ansible-playbook site.yml --list-tags
[group('pubnix')]
pubnix-ping target:
cd {{ pubnix_ansible }} && ansible "{{ target }}" -m ping
[group('pubnix')]
pubnix-syntax-check:
cd {{ pubnix_ansible }} && ansible-playbook site.yml --syntax-check
[group('pubnix')]
pubnix-create-user username key target:
cd {{ pubnix_ansible }} && ansible-playbook playbooks/create-user.yml -e "username={{ username }}" -e "ssh_public_key='{{ key }}'" -e "target_hosts={{ target }}"
[group('pubnix')]
pubnix-remove-user username target:
cd {{ pubnix_ansible }} && ansible-playbook playbooks/remove-user.yml -e "username={{ username }}" -e "target_hosts={{ target }}"
[group('pubnix')]
pubnix-smoke-test target="dev":
cd {{ pubnix_ansible }} && ansible-playbook playbooks/smoke-test.yml -e "target_hosts={{ target }}"
[group('pubnix')]
pubnix-vault-edit:
ansible-vault edit {{ pubnix_ansible }}/inventory/group_vars/all/vault.yml
[group('pubnix')]
pubnix-molecule-test role:
#!/usr/bin/env bash
set -euo pipefail
cd {{ pubnix_root }}
ANSIBLE_LIBRARY=$(uv run python3 -c "import molecule_plugins, os; print(os.path.dirname(molecule_plugins.__file__) + '/vagrant/modules')")
cd ansible/roles/{{ role }}
ANSIBLE_LIBRARY="$ANSIBLE_LIBRARY" uv run molecule test
[group('pubnix')]
pubnix-molecule-converge role:
#!/usr/bin/env bash
set -euo pipefail
cd {{ pubnix_root }}
ANSIBLE_LIBRARY=$(uv run python3 -c "import molecule_plugins, os; print(os.path.dirname(molecule_plugins.__file__) + '/vagrant/modules')")
cd ansible/roles/{{ role }}
ANSIBLE_LIBRARY="$ANSIBLE_LIBRARY" uv run molecule converge
[group('pubnix')]
pubnix-molecule-verify role:
#!/usr/bin/env bash
set -euo pipefail
cd {{ pubnix_root }}
ANSIBLE_LIBRARY=$(uv run python3 -c "import molecule_plugins, os; print(os.path.dirname(molecule_plugins.__file__) + '/vagrant/modules')")
cd ansible/roles/{{ role }}
ANSIBLE_LIBRARY="$ANSIBLE_LIBRARY" uv run molecule verify
[group('pubnix')]
pubnix-molecule-destroy role:
#!/usr/bin/env bash
set -euo pipefail
cd {{ pubnix_root }}
ANSIBLE_LIBRARY=$(uv run python3 -c "import molecule_plugins, os; print(os.path.dirname(molecule_plugins.__file__) + '/vagrant/modules')")
cd ansible/roles/{{ role }}
ANSIBLE_LIBRARY="$ANSIBLE_LIBRARY" uv run molecule destroy
[group('pubnix')]
pubnix-tf-init:
cd {{ pubnix_terraform }} && terraform init
[group('pubnix')]
pubnix-tf-plan:
cd {{ pubnix_terraform }} && terraform plan
[group('pubnix')]
pubnix-tf-apply:
cd {{ pubnix_terraform }} && terraform apply
[group('pubnix')]
pubnix-dev-up:
cd {{ pubnix_root }} && vagrant up
[group('pubnix')]
pubnix-dev-down:
cd {{ pubnix_root }} && vagrant halt
[group('pubnix')]
pubnix-lint:
cd {{ pubnix_root }} && uvx pre-commit run --all-files
cd {{ pubnix_ansible }} && uv run ansible-lint