Bundle extension (upload hook + API endpoint + admin module) that warms Directus image transform cache in-process with an explicit acceptFormat, so the generated file matches the browser's cache key byte-for-byte. - resumable, window-aware backfill with progress + cancel - system + custom presets, effective-format reporting, shadow warnings - storage breakdown (previews vs originals), human-readable API fields - diagnostics: resolve-plan prediction, per-file generate, ops ring buffer - isolated dev/staging compose stack + deploy/rollback scripts Verified on Directus 11.17.4: 40/40 tests, hash-match gate passed, idempotent backfill, custom fixed-format presets, error surfacing.
48 lines
1.5 KiB
Markdown
48 lines
1.5 KiB
Markdown
# Local dev / staging stack
|
|
|
|
Isolated Directus **11.17.4** with its own Postgres and volumes. Nothing is shared with the prod
|
|
instance (separate containers, volumes, and port **8057**).
|
|
|
|
## Run
|
|
|
|
```bash
|
|
# from the project root
|
|
./dev/sync-extension.sh # build + copy dist/package.json into dev/extension
|
|
docker compose -f dev/compose.dev.yml up -d
|
|
```
|
|
|
|
Admin: `http://localhost:8057` — `admin@example.com` / `admin12345`.
|
|
The extension is loaded from `dev/extension` (bind mount). Check:
|
|
|
|
```bash
|
|
docker logs image-previews-dev-directus-1 | grep -i "loaded extensions"
|
|
```
|
|
|
|
## After changing source
|
|
|
|
```bash
|
|
./dev/sync-extension.sh
|
|
docker compose -f dev/compose.dev.yml restart directus
|
|
```
|
|
|
|
(`EXTENSIONS_AUTO_RELOAD` is on, but a restart is the reliable path. Never `rm -rf dev/extension` —
|
|
it breaks the bind mount.)
|
|
|
|
## Smoke test
|
|
|
|
```bash
|
|
BASE=http://localhost:8057
|
|
TOKEN=$(curl -s -X POST "$BASE/auth/login" -H 'Content-Type: application/json' \
|
|
-d '{"email":"admin@example.com","password":"admin12345"}' | jq -r '.data.access_token')
|
|
|
|
curl -s "$BASE/image-previews/status" -H "Authorization: Bearer $TOKEN" | jq .
|
|
curl -s -X POST "$BASE/files" -H "Authorization: Bearer $TOKEN" -F "file=@dev/seed/test.jpg" | jq '.data | {id,filename_disk}'
|
|
docker exec image-previews-dev-directus-1 sh -c "ls -1 /directus/uploads | grep '__' | sort"
|
|
```
|
|
|
|
## Stop / reset
|
|
|
|
```bash
|
|
docker compose -f dev/compose.dev.yml down # stop, keep data
|
|
docker compose -f dev/compose.dev.yml down -v # stop and wipe DB + uploads
|
|
```
|