Commit Graph
40 Commits
Author SHA1 Message Date
tao.chenandtao.chen 65be676024 chore: web volumes 2026-09-02 10:10:41 +08:00
tao.chenandtao.chen 87ffe5bab6 chore: web volumes 2026-09-02 10:10:41 +08:00
tao.chenandtao.chen 6f052b8847 chore: web volumes 2026-09-02 10:10:41 +08:00
tao.chenandtao.chen 75ef8f32a0 chore: encrypt_secret.py 2026-09-02 10:10:41 +08:00
tao.chenandtao.chen 1faca179b0 chore: delete demo_auth_enabled from config 2026-09-02 10:10:41 +08:00
tao.chenandClaude Fable 5 dfe3f0b118 fix(security): P0-1 — port exposure + service-token auth on /internal/* + jupyter RPC
The fix lands in three concentric layers, all backed by a single
INTERNAL_SERVICE_TOKEN shared secret so we have one mechanism
instead of three:

1. docker-compose: drop the backend.ports: 8891:8000 and
   runtime.ports: 8892:8000 mappings. Nginx is the only host
   ingress again (architecture §2.2).
2. /internal/v1/*: the storage control plane had six endpoints, five
   of which were dead code (frontend already migrated to
   /api/v1/data-resources/* with JWT; schedule only ever called
   POST /internal/v1/objects). Delete the dead routes, mount the
   one survivor with Depends(require_internal_service) that
   compares the X-Internal-Service-Token header against
   settings.internal_service_token with secrets.compare_digest.
3. POST /api/v1/jupyter on the runtime container: previously open
   inside the Docker network. Same token mechanism — backend's
   runtime_http_client now carries the header, runtime's
   handle_jupyter_action requires the same header. /api/v1/health
   stays open for the Nginx and compose healthchecks.

The schedule worker was already configured to call
POST /internal/v1/objects; build_storage_http_client now
sets the token header so its existing call site keeps working
without changes.

Files touched:
  backend/src/backend/storage_api.py   # 5 dead routes deleted + token guard
  backend/src/backend/main.py          # runtime_http_client header
  runtime/src/runtime/main.py          # require_internal_service Depends
  common/src/common/config.py          # internal_service_token setting
  schedule/src/schedule/service.py     # httpx client header
  docker-compose.yml                   # ports dropped, INTERNAL_SERVICE_TOKEN env
  .env.example                         # INTERNAL_SERVICE_TOKEN placeholder
  API.md / README.md / DEVELOP.md      # §9 trimmed to 1 endpoint

Verified:
  compileall -> 0 errors
  pytest backend/tests -> 37 passed
  in-process ASGI smoke:
    POST /internal/v1/objects no/wrong/correct token -> 401/401/200
    POST /api/v1/jupyter   no/wrong/correct token -> 401/401/200
    5 deleted internal routes -> 404
  docker compose config (with env) -> OK

P0-1 still has one open sub-item (rclone RC --rc-no-auth) that
the user has explicitly deferred; not touched here.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-17 16:48:46 +08:00
tao.chen 6258cf5d12 fix: offline deploy 2026-08-17 15:59:19 +08:00
tao.chen 0974881fbb fix: offline deploy 2026-08-17 15:30:21 +08:00
tao.chen 7347b409e5 update: port 2026-08-14 15:32:34 +08:00
tao.chen e9a7e1a24e update: docker-compose.yml 2026-08-14 15:19:29 +08:00
Winnie be475dd0d9 fix: support local storage runtime and schedule logs 2026-08-14 15:06:36 +08:00
tao.chen 1ad0ec9dbf update: docker-compose.yml 2026-08-13 11:03:08 +08:00
tao.chen 0bcdbb1068 fix: add logging limit 2026-08-12 19:52:14 +08:00
tao.chen 9d0ca1e8b6 fix: READINESS_TARGETS 2026-08-12 19:49:05 +08:00
tao.chen 91339aa993 update: docker-compose.yml 2026-08-12 13:33:29 +08:00
tao.chen 14c41a22b6 fix: runtime timeout 2026-08-07 18:50:48 +08:00
tao.chen 6b2db5c613 fix: docker-compose.yml
env var error
2026-08-07 14:03:01 +08:00
tao.chen edd560cf84 fix: docker-compose.yml
env var error
2026-08-07 14:01:17 +08:00
tao.chen 96f9a5c644 update: docker-compose.yml
add volumes
2026-08-07 13:58:04 +08:00
taochen dcc2088999 add port 2026-08-06 09:45:40 +08:00
tao.chen 4b2a67ae5d storage: extract unified AsyncStorageBackend abstraction + migrate from RustFS
Replace the old RustFS-specific storage layer (common.storage.client /
RustFSObjectStore) with a minimal sync/async abstraction:

  AsyncStorageBackend: put / get / get_stream / delete / exists / stat /
                       list / get_url / copy
  StorageBackend:      same surface, sync implementations
  create_storage({"type": "s3" | "local", "mode": "async", ...})
  backends/s3.py:      S3-compatible (boto3 / aioboto3)
  backends/local.py:   on-disk filesystem (aiofiles)

Concretely:
  - Drop RustFSObjectStore + common.storage.client (deleted).
  - Drop the RustFS-specific ensure_bucket / presign_put / move_to_trash /
    rewrite_to_public_path / sha256 / put_bytes methods.
  - Migrate backend/storage_api.py + backend/main.py + backend/scripts.py
    + schedule/service.py + schedule/worker.py to the new abstraction.
  - Migrate backend/storage_client.py + schedule/storage_client.py to
    stub status (HTTP wrapper is dead code post-migration; rewrite pending).
  - Rename all RUSTFS_* env vars to S3_* across .env.example,
    docker-compose.yml, default.conf, scripts/nginx-entrypoint.sh,
    common/config.py.
  - Replace hardcoded rclone remote name "rustfs" with "s3" in
    docker-compose.yml + config.py default.
  - Rename "rustfs" SQLAlchemy column comments + table comments to
    provider-neutral wording; StorageObjects.storage_backend enum
    value moves from "rustfs" to "s3" (DB rows with the old value will
    fail the != "s3" check until a one-shot migration is applied).
  - Drop unused common/src/common/migrations/{README,env.py,script.py.mako}
    (the alembic setup lives in /migrations/, not here).

Migration of the old abstractions has been done in one pass; per-route
method calls (delete / stat / put / get_url) are now direct one-liners
against AsyncStorageBackend.

After this commit:
  - All Python imports resolve; routes compile (compileall green).
  - s3 mode is fully wired.
  - Routes that depended on removed methods (presign_put, move_to_trash,
    rewrite_to_public_path, head() metadata) raise NotImplementedError
    with a one-line TODO; rewriting these route handlers is the next step.
2026-08-05 13:08:32 +08:00
Winnie f3cc83c5fa Merge branch 'develop' of http://8.153.151.51:8888/team_group/model-develop into develop
# Conflicts:
#	schedule/src/schedule/orchestrator.py
#	schedule/src/schedule/worker.py
2026-08-04 14:41:22 +08:00
Winnie a2deae2f22 修复调度运行失败 2026-08-04 14:09:03 +08:00
tao.chen d45109916a chore: update docker-compose.yml 2026-08-04 10:30:24 +08:00
Winnie d7bd88335c merge: integrate feat/auth into develop 2026-08-03 17:44:00 +08:00
tao.chen 386efb4d98 update: add volumes 2026-08-03 13:55:41 +08:00
tao.chen a44b984203 chore: rollback mount path 2026-07-31 19:49:02 +08:00
Winnie 49ee2c0a4a feat: 完善模型平台相关功能 2026-07-31 19:10:37 +08:00
tao.chen fb073c6f99 feat: auth 2026-07-31 17:22:25 +08:00
tao.chen 86988bdaef chore: frontend build 2026-07-31 15:08:31 +08:00
tao.chen f288c90d37 refactor: remove local fs, add config class to common pacakge 2026-07-31 12:46:31 +08:00
tao.chen a052f97dbc update: remove local fs 2026-07-31 12:39:41 +08:00
tao.chen d63c66f5ee chore: update env variable 2026-07-31 11:17:58 +08:00
tao.chen 91767461d6 refactor 2026-07-30 20:52:46 +08:00
tao.chen ec53edbce5 refactor 2026-07-30 20:02:19 +08:00
Winnie 6d6c70cea8 refactor: integrate model platform backend 2026-07-30 13:43:29 +08:00
tao.chen 233dc90efe feat: add schedule package 2026-07-29 13:35:32 +08:00
tao.chen 128aa7563f feat: deploy demo test 2026-07-28 13:57:54 +08:00
tao.chen af74f2f242 update: optimize environment 2026-07-28 11:32:06 +08:00
tao.chen 1c03a32298 update: add common 2026-07-27 15:37:58 +08:00