Commit Graph
435 Commits
Author SHA1 Message Date
Siddharth Kumar Sah bbae319333 Merge branch 'refactor/remove-lite-variant' 2026-04-10 22:36:39 +08:00
Siddharth Kumar Sah 9ae15e43d2 Merge branch 'main' of https://github.com/stirling-image/stirling-image 2026-04-10 22:13:02 +08:00
Siddharth Kumar Sah e1dec040f4 Merge branch 'feat/unified-docker-image' 2026-04-10 21:58:23 +08:00
semantic-release-bot aa4e5cac8d chore(release): 1.13.0 [skip ci]
# [1.13.0](https://github.com/stirling-image/stirling-image/compare/v1.12.0...v1.13.0) (2026-04-10)

### Bug Fixes

* complete RBAC implementation lost during merge ([cc8a272](https://github.com/stirling-image/stirling-image/commit/cc8a27239b02a63ca88abc3e363c8a46f89674e8))

### Features

* add backend permission map and requirePermission middleware ([1a99571](https://github.com/stirling-image/stirling-image/commit/1a995711535a1525e709cdd7bff75361f457e942))
* add permission checks and admin override to API key routes ([d776680](https://github.com/stirling-image/stirling-image/commit/d776680f2d2342e35b84821792d6c24ae7e0ffbc))
* add permission checks and admin override to pipeline routes ([59f40db](https://github.com/stirling-image/stirling-image/commit/59f40dbfd4a97f8691b5fbbf6d338063c389987b))
* add permission checks and ownership scoping to user-files routes ([86ba698](https://github.com/stirling-image/stirling-image/commit/86ba69825a1dd87c9f868d79cd806b7d594cce1b))
* add shared Permission and Role types ([2f594e9](https://github.com/stirling-image/stirling-image/commit/2f594e96057c72bf107f3012426e87af5f97eb94))
* add tools:use permission check to tool, batch, pipeline, and upload routes ([885ace5](https://github.com/stirling-image/stirling-image/commit/885ace54f09b3301989f8aa404c15f60e19c054d))
* extend useAuth hook with role and permissions from session ([e0ba8be](https://github.com/stirling-image/stirling-image/commit/e0ba8be7b3211299c8cde90b2d22e7796eee2206))
* filter settings tabs by user permissions, remove admin fallback ([bcbd24a](https://github.com/stirling-image/stirling-image/commit/bcbd24a2395b93b64dbbf638ba0138f9ec9ba9da))
* include permissions and teamName in login/session responses ([4943177](https://github.com/stirling-image/stirling-image/commit/49431772ec6a02eae8aced48da92ef87a6c89afb))
* replace requireAdmin with requirePermission on all routes ([af7f57d](https://github.com/stirling-image/stirling-image/commit/af7f57d52f49c8f8412876639076084c96eba284))
v1.13.0
2026-04-10 13:26:01 +00:00
Siddharth Kumar Sah cc8a27239b fix: complete RBAC implementation lost during merge
Several RBAC features from feat/rbac-permissions were silently lost
during the merge into main. This restores and completes them:

- Add permissions and teamName to login/session API responses
- Export Permission and Role types from shared package
- Filter settings tabs by user permissions in frontend
- Extend useAuth hook with role, permissions, and hasPermission
- Restrict teams listing to admin only
- Add admin override for API keys, files, and pipelines listing
- Add ownership scoping to file access, download, and delete routes
- Register userFileRoutes in integration test server
- Mock auth import in unit permissions test to avoid SQLite lock
2026-04-10 21:25:30 +08:00
Siddharth Kumar Sah 6c6fb113fa test: add e2e tests for role-based settings tab visibility and API access 2026-04-10 21:25:30 +08:00
Siddharth Kumar Sah bcbd24a239 feat: filter settings tabs by user permissions, remove admin fallback 2026-04-10 21:25:30 +08:00
Siddharth Kumar Sah e0ba8be7b3 feat: extend useAuth hook with role and permissions from session 2026-04-10 21:25:30 +08:00
Siddharth Kumar Sah 59f40dbfd4 feat: add permission checks and admin override to pipeline routes
Replace requireAuth with requirePermission("pipelines:own") on pipeline
save/list/delete routes. Admin users with pipelines:all can see and
delete all pipelines. Unauthorized delete returns 404 to avoid leaking
resource existence.
2026-04-10 21:25:30 +08:00
Siddharth Kumar Sah 86ba69825a feat: add permission checks and ownership scoping to user-files routes
Replace getAuthUser (optional auth) with requirePermission("files:own") on all
user-files routes, enforcing mandatory authentication and ownership checks.
Admin users with files:all permission bypass ownership restrictions. Returns 404
(not 403) for ownership failures to avoid leaking resource existence.
2026-04-10 21:25:30 +08:00
Siddharth Kumar Sah d776680f2d feat: add permission checks and admin override to API key routes
Replace requireAuth with requirePermission(apikeys:own). Admin users
with apikeys:all can see and delete any user's keys.
2026-04-10 21:25:30 +08:00
Siddharth Kumar Sah af7f57d52f feat: replace requireAdmin with requirePermission on all routes
Migrate settings, teams, branding, and user management routes to use
the new permission-based authorization system. Remove requireAdmin
function entirely.
2026-04-10 21:25:30 +08:00
Siddharth Kumar Sah 885ace54f0 feat: add tools:use permission check to tool, batch, pipeline, and upload routes 2026-04-10 21:25:30 +08:00
Siddharth Kumar Sah 49431772ec feat: include permissions and teamName in login/session responses 2026-04-10 21:25:30 +08:00
Siddharth Kumar Sah 1a99571153 feat: add backend permission map and requirePermission middleware
Create the RBAC permission module that maps roles to permissions and
provides a requirePermission middleware to replace requireAdmin. Update
the test server to use requirePermission for the admin health check.
2026-04-10 21:25:30 +08:00
Siddharth Kumar Sah 2f594e9605 feat: add shared Permission and Role types 2026-04-10 21:25:29 +08:00
semantic-release-bot e8bad0e67b chore(release): 1.12.0 [skip ci]
# [1.12.0](https://github.com/stirling-image/stirling-image/compare/v1.11.0...v1.12.0) (2026-04-10)

### Bug Fixes

* **a11y:** add keyboard support to pdf-to-image upload dropzone ([1778f72](https://github.com/stirling-image/stirling-image/commit/1778f7266b9837a07b20f167e82e1e9b163086b7))
* use specific selector in pdf-to-image e2e test ([b2a2c89](https://github.com/stirling-image/stirling-image/commit/b2a2c890a1d25f60e392e6a2df23e1600cc3ad8d))

### Features

* add pdf-to-image backend route with info and processing endpoints ([30155c1](https://github.com/stirling-image/stirling-image/commit/30155c1c7073c55290d4f662f7f93779cc4512b7))
* add pdf-to-image frontend settings component ([44bbfba](https://github.com/stirling-image/stirling-image/commit/44bbfba80dfb3eb069c563e5ca691a0f8dce1eea))
* register pdf-to-image in frontend tool registry ([5fd294c](https://github.com/stirling-image/stirling-image/commit/5fd294c994e7df076c4de0016f62d952a161345b))
* register pdf-to-image tool in shared constants and i18n ([43324c1](https://github.com/stirling-image/stirling-image/commit/43324c1f23e3f278c89fa301d5a0275b12f587e7))
* unified Docker image with GPU auto-detection ([#37](https://github.com/stirling-image/stirling-image/issues/37)) ([b0083e2](https://github.com/stirling-image/stirling-image/commit/b0083e2b083d0bf52b6a576f7ef67fbff0cc8cbe))
v1.12.0
2026-04-10 12:56:42 +00:00
Siddharth Kumar Sah 1778f7266b fix(a11y): add keyboard support to pdf-to-image upload dropzone 2026-04-10 20:56:13 +08:00
Siddharth Kumar Sah b2a2c890a1 fix: use specific selector in pdf-to-image e2e test
The getByText("3 pages") matched multiple elements including the
convert button. Scope the selector to the file info area.
2026-04-10 20:56:13 +08:00
Siddharth Kumar Sah cab6772dab test: add e2e test for pdf-to-image tool 2026-04-10 20:56:13 +08:00
Siddharth Kumar Sah 5fd294c994 feat: register pdf-to-image in frontend tool registry 2026-04-10 20:56:13 +08:00
Siddharth Kumar Sah 48cf919fb7 test: add integration tests for pdf-to-image endpoints 2026-04-10 20:56:13 +08:00
Siddharth Kumar Sah 44bbfba80d feat: add pdf-to-image frontend settings component 2026-04-10 20:56:13 +08:00
Siddharth Kumar Sah 30155c1c70 feat: add pdf-to-image backend route with info and processing endpoints 2026-04-10 20:56:13 +08:00
Siddharth Kumar Sah 6b03cdb6d8 test: add unit tests for pdf-to-image page range parser 2026-04-10 20:56:13 +08:00
Siddharth Kumar Sah 43324c1f23 feat: register pdf-to-image tool in shared constants and i18n 2026-04-10 20:56:13 +08:00
Siddharth Kumar Sah d650f301ca chore: add mupdf dependency for PDF-to-image tool 2026-04-10 20:56:13 +08:00
Siddharth Kumar Sah 958b10cb45 refactor: remove lite variant, fix release workflow
- Remove all lite/full variant logic from frontend, API, shared constants,
  docs, and tests (single unified Docker image only)
- Replace single QEMU multi-arch Docker build with per-architecture native
  builds (amd64 + arm64) and manifest merge to fix disk space exhaustion
- Add disk cleanup step and per-platform build cache scopes
- Switch release trigger from push to workflow_dispatch
- Add GitHub issue templates and PR template
2026-04-10 17:38:54 +08:00
semantic-release-bot b20039eddf chore(release): 1.12.0 [skip ci]
# [1.12.0](https://github.com/stirling-image/stirling-image/compare/v1.11.0...v1.12.0) (2026-04-10)

### Features

* unified Docker image with GPU auto-detection ([#37](https://github.com/stirling-image/stirling-image/issues/37)) ([b0083e2](https://github.com/stirling-image/stirling-image/commit/b0083e2b083d0bf52b6a576f7ef67fbff0cc8cbe))
2026-04-10 05:45:42 +00:00
stirling-imageandGitHub b0083e2b08 feat: unified Docker image with GPU auto-detection (#37)
Merge CPU, CUDA, and lite Docker images into a single unified image.
One tag (latest) works on all platforms: amd64 (NVIDIA CUDA) and arm64 (CPU).
GPU auto-detected at runtime. All ML models and packages baked in.

Key changes:
- Platform-conditional Dockerfile (nvidia/cuda on amd64, node on arm64)
- tini as PID 1 for proper signal handling
- Fix FILES_STORAGE_PATH data loss bug
- Fix RealESRGAN upscaler (was broken, always fell back to Lanczos)
- Fix PaddleOCR language codes and stdout corruption
- Simplified CI/CD (single build, single tag)
- Expanded model pre-download with verification
- Shutdown timeout, improved health endpoint
- Remove unused lama-cleaner
2026-04-10 13:21:06 +08:00
Siddharth Kumar Sah 3481663960 fix: simplify smoke test to CPU-only imports for build-time compat
GPU-dependent libraries (paddlepaddle-gpu, torch CUDA, realesrgan)
cannot be imported at Docker build time because the CUDA driver is
only available at runtime. Smoke test now verifies CPU-only imports
(rembg, cv2, numpy, mediapipe, seam_carving) and checks that model
files exist on disk. GPU imports are verified at runtime.
2026-04-10 12:35:11 +08:00
Siddharth Kumar Sah 0083a741a9 fix: handle paddlepaddle-gpu CUDA import at build time gracefully
paddlepaddle-gpu requires libcuda.so.1 at import time, but no CUDA
driver exists during Docker build. The download script now catches
this ImportError and skips PaddleOCR model pre-download on amd64.
Models will download on first use at runtime when the CUDA driver
is available via nvidia-container-toolkit.

On arm64 (CPU paddlepaddle), models are still pre-downloaded at build
time as before.

Also reverted CI to amd64-only Docker build test for speed. Multi-arch
build is tested on release via the release workflow.
2026-04-10 12:22:11 +08:00
Siddharth Kumar Sah d31d66556e fix: install cuda-compat stubs for build-time PaddlePaddle import
paddlepaddle-gpu needs libcuda.so.1 at import time, but the real NVIDIA
driver is only injected at runtime by the container toolkit. Install
cuda-compat-12-6 which provides forward-compat stubs that satisfy the
dlopen without a real GPU. Also force CPU mode via env vars in the
download script.
2026-04-10 11:35:50 +08:00
Siddharth Kumar Sah b4b59a7500 fix: force CPU mode in download_models.py for build-time compatibility
paddlepaddle-gpu tries to load libcuda.so.1 on import, but no GPU
driver exists during Docker build. Set PADDLE_DEVICE=cpu, FLAGS_use_cuda=0,
and CUDA_VISIBLE_DEVICES="" before any ML imports to force CPU mode.
2026-04-10 11:22:56 +08:00
Siddharth Kumar Sah 74183e8dc1 fix: split paddlepaddle-gpu and paddleocr installs, use --extra-index-url
-i replaces the entire package index so paddleocr couldn't be found.
Use --extra-index-url to add PaddlePaddle's index alongside PyPI, and
install paddleocr separately so it resolves from PyPI.
2026-04-10 11:01:58 +08:00
Siddharth Kumar Sah dd9528f53c fix: use PaddlePaddle GPU package index for CUDA wheels
paddlepaddle-gpu==3.0.0 is not on PyPI, it is hosted on PaddlePaddle's
own package index. Added -i flag pointing to the cu126 stable index
for the amd64 GPU build.
2026-04-10 10:44:47 +08:00
Siddharth Kumar Sah caf65bc469 fix: address code review findings before merge
- Warn on startup if deprecated STIRLING_VARIANT env var is set
- Broaden upscale.py exception handling to catch RuntimeError/OSError
  for Lanczos fallback (not just ImportError)
- Add QEMU + multi-arch (amd64+arm64) to CI Docker build test
- Use .get() instead of .all() for single-row health check query
- Restore container_name in docker-compose.yml for backwards compat
2026-04-10 10:35:13 +08:00
Siddharth Kumar Sah c0b419de21 fix: suppress ML library stdout noise in ocr.py and upscale.py
PaddleOCR prints download/init messages to stdout which corrupts the
JSON result that the bridge expects. Same risk with basicsr/realesrgan.
Applied the same fd-level stdout redirect pattern already used in
remove_bg.py: redirect fd 1 to stderr during ML work, restore for
the JSON result. Also added show_log=False to PaddleOCR constructor.
2026-04-10 01:22:53 +08:00
Siddharth Kumar Sah e55253dee0 fix: revert to npx tsx in CMD for pnpm compatibility
node --import tsx requires tsx to be directly in node_modules/, but
pnpm hoists it differently. npx tsx works because it resolves through
pnpm's bin links. tini as PID 1 handles signal forwarding regardless.
2026-04-10 00:54:03 +08:00
Siddharth Kumar Sah 1e2ef52846 fix: skip RealESRGAN import check on arm64 in smoke test
basicsr has a known torchvision.transforms.functional_tensor compat
issue on arm64 with newer torchvision. On arm64, upscale.py falls back
to Lanczos via ImportError anyway. Smoke test still verifies the model
weights file exists on all platforms.
2026-04-10 00:46:57 +08:00
Siddharth Kumar Sah e1ee57103c fix: correct PaddleOCR language codes for model download and OCR
PaddleOCR uses its own language codes (ch, japan, korean, latin) not
ISO codes (zh, ja, ko, de, fr, es). The download script and ocr.py
now map API language codes to PaddleOCR codes correctly. German,
French, and Spanish all use the "latin" script model.
2026-04-10 00:40:45 +08:00
Siddharth Kumar Sah 7face19238 fix: use platform-specific mediapipe version for arm64 compatibility
mediapipe==0.10.21 only has amd64 wheels. arm64 maxes out at 0.10.18.
Split into platform-conditional install to fix build failure on arm64.
2026-04-10 00:33:34 +08:00
Siddharth Kumar Sah ff37bb769a docs: update for unified Docker image
Rewrite docker-tags.md for single image with GPU auto-detection.
Update deployment.md to remove variant table and lite/cuda references.
Replace LaMa Cleaner references with OpenCV in architecture and AI docs.
Add migration notes for users on :lite and :cuda tags.
2026-04-10 00:25:28 +08:00
Siddharth Kumar Sah b385a2eabb feat: simplify CI to single unified Docker build
Remove 3-variant matrix (full/lite/cuda). Single build produces
a multi-arch manifest (amd64 + arm64) pushed to Docker Hub and GHCR.
Tags: latest, X.Y.Z, X.Y, X. CI builds native platform only (amd64)
for speed. Multi-arch only on release.
2026-04-10 00:24:43 +08:00
Siddharth Kumar Sah 986ad37bb5 fix: add shutdown timeout and improve health endpoint
- Add 8s shutdown timeout to prevent indefinite hang when app.close()
  stalls. Stays under Docker's default 10s stop_grace_period.
- Health endpoint now checks database connectivity, returns 503 when
  DB is unreachable so Docker marks container unhealthy.
- Removed variant field from health response (single image now).
2026-04-10 00:22:57 +08:00
Siddharth Kumar Sah 84f7057a49 feat: simplify compose to single file, add log rotation
GPU is activated at runtime via --gpus all, not a separate compose file.
Added log rotation (10MB x 3 files) to prevent disk fill on long-running
instances. Removed docker-compose.gpu.yml.
2026-04-10 00:22:49 +08:00
Siddharth Kumar Sah 6c3eb3b876 feat: unified Docker image with GPU auto-detection
- Remove VARIANT/GPU build args, single image for all platforms
- amd64: nvidia/cuda base with GPU Python packages
- arm64: node base with CPU Python packages
- Add tini as PID 1 for proper signal handling
- Replace npx tsx with node --import tsx
- Split pip install into base + tool layers for better caching
- Add NVIDIA_VISIBLE_DEVICES env vars for container toolkit
- Suppress Python ML library log noise
- Increase healthcheck start-period to 60s
- Remove STIRLING_VARIANT env var
- Remove lama-cleaner from pip installs
2026-04-10 00:21:41 +08:00
Siddharth Kumar Sah a9e3b96887 feat: expand model pre-download with verification and smoke test
Downloads all rembg models (6), RealESRGAN_x4plus.pth weights,
PaddleOCR models for all 7 supported languages, verifies MediaPipe
bundles its face detection models. Runs a final smoke test importing
every ML library. Any failure exits non-zero, failing the Docker build.
2026-04-10 00:19:42 +08:00
Siddharth Kumar Sah 592a9cbf08 chore: remove unused lama-cleaner, add seam-carving to GPU requirements
lama-cleaner is pip-installed but never imported in any Python script.
inpaint.py uses OpenCV TELEA. Removing saves ~100+ MB of image size.
Also added seam-carving to requirements-gpu.txt where it was missing.
2026-04-10 00:18:14 +08:00
Siddharth Kumar Sah fa9569c920 fix: load RealESRGAN pretrained weights for actual AI upscaling
model_path was None, so the model had random weights and always fell back
to Lanczos. Now loads RealESRGAN_x4plus.pth from /opt/models/realesrgan/
(configurable via REALESRGAN_MODEL_PATH env var). Only falls back to
Lanczos on ImportError, not blanket Exception.
2026-04-10 00:18:13 +08:00