Skip to content

Integrate SeaweedFS#185

Merged
pbrassel merged 16 commits into
mainfrom
seaweedfs
Jul 16, 2026
Merged

Integrate SeaweedFS#185
pbrassel merged 16 commits into
mainfrom
seaweedfs

Conversation

@pbrassel

@pbrassel pbrassel commented Jul 16, 2026

Copy link
Copy Markdown
Member

Summary by CodeRabbit

  • New Features

    • Added automatic database migrations during application startup.
    • Added migration tooling and configurable migration history tracking.
    • Added container health checks and structured application logging.
  • Improvements

    • Replaced the local MinIO storage service with the S3-compatible SeaweedFS service across Docker Compose, Kubernetes, and integration testing.
    • Updated configuration and setup guidance for S3 storage, PostgreSQL, authentication, and testing.
    • Improved local storage upload, retrieval, tagging, and deletion compatibility with S3.
  • Chores

    • Pre-commit hooks now install for commit, push, and message checks.

@coderabbitai

coderabbitai Bot commented Jul 16, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@pbrassel, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 16 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 8ff03079-1280-4e7d-9b09-c06638a38c45

📥 Commits

Reviewing files that changed from the base of the PR and between fe0dae1 and 91598f3.

📒 Files selected for processing (4)
  • entrypoint.sh
  • k8s/helm/node-storage-service/templates/node-storage-deployment.yaml
  • project/migrations/scripts/router.py
  • project/routers/local.py
📝 Walkthrough

Walkthrough

The application replaces MinIO with S3-compatible SeaweedFS, renames storage configuration and dependencies, adds Peewee migrations executed during container startup, updates database lifecycle handling, and revises Docker, Kubernetes, CI, test, logging, and setup configuration.

Changes

S3 storage and local API

Layer / File(s) Summary
S3 configuration and local object operations
project/config.py, project/dependencies.py, project/routers/local.py, tests/*
Storage settings and dependency injection use S3 naming, local endpoints call the S3 client, and fixtures and assertions target SeaweedFS-compatible object behavior.

Database migration lifecycle

Layer / File(s) Summary
Database migration lifecycle
project/crud.py, project/migrations/*, project/server.py, pyproject.toml, tests/conftest.py
The Postgres helper is replaced by a database proxy lifecycle, Peewee migrations are added, migration scripts are wired, and test database setup runs migrations.

Container startup and deployment integration

Layer / File(s) Summary
Container startup and logging
Dockerfile, entrypoint.sh, config/logging.json, project/main.py
The image packages an executable startup script that runs migrations before Uvicorn, creates the logs directory, and uses the updated logging configuration.
SeaweedFS deployment and integration setup
.env.example, .github/workflows/*, docker-compose.yml, k8s/*, README.md, tests/docker-compose.yml, .pre-commit-config.yaml
Local, CI, Docker Compose, Kubernetes, Helm, and documentation configuration switches storage services and variables from MinIO to SeaweedFS and adds service readiness checks.

Estimated code review effort: 4 (Complex) | ~60 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Container
  participant MigrationRouter
  participant Postgres
  participant Uvicorn
  Container->>MigrationRouter: Run database migrations
  MigrationRouter->>Postgres: Apply migration definitions
  Container->>Uvicorn: Start application after migrations
Loading

Possibly related PRs

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 26.47% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately captures the main change: replacing the MinIO-based storage setup with SeaweedFS integration.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch seaweedfs

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 7

🧹 Nitpick comments (4)
project/migrations/001_init.py (2)

59-59: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Use a tuple for Peewee indexes to avoid mutable class attribute warnings.

Similar to the Result model, use a tuple for the indexes definition here to avoid static analysis warnings and keep consistency.

🛠️ Proposed fix to use a tuple
         class Meta:
             table_name = "tag"
-            indexes = [(("tag_name", "project_id"), True)]
+            indexes = ((("tag_name", "project_id"), True),)
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@project/migrations/001_init.py` at line 59, Update the `indexes` definition
in the migration to use a tuple instead of a list, matching the immutable index
declaration used by the `Result` model and avoiding mutable class attribute
warnings.

Source: Linters/SAST tools


49-49: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Use a tuple for Peewee indexes to avoid mutable class attribute warnings.

Peewee supports lists for indexes, but it's best practice to use tuples ((..., ...),) to prevent static analysis warnings (e.g., Ruff RUF012) regarding mutable class defaults and to align with the definitions in project/crud.py.

🛠️ Proposed fix to use a tuple
         class Meta:
             table_name = "result"
-            indexes = [(("client_id", "object_id"), True)]
+            indexes = ((("client_id", "object_id"), True),)
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@project/migrations/001_init.py` at line 49, Update the indexes definition in
the migration to use Peewee’s tuple-based form instead of a list, preserving the
existing client_id/object_id composite index and uniqueness setting while
matching the convention in project/crud.py.

Source: Linters/SAST tools

README.md (1)

114-116: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Specify a language for the fenced code block.

For better syntax highlighting and to resolve markdown linter warnings, consider specifying a language (e.g., shell or bash) for the code block.

📝 Proposed fix
-```
+```shell
 $ docker compose -f tests/docker-compose.yml up -d --build
</details>

<details>
<summary>🤖 Prompt for AI Agents</summary>

Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @README.md around lines 114 - 116, Update the fenced code block containing
the docker compose command to specify the shell language, using the existing
command unchanged.


</details>

<!-- cr-comment:v1:e5f2dad368de891455323323 -->

_Source: Linters/SAST tools_

</blockquote></details>
<details>
<summary>tests/docker-compose.yml (1)</summary><blockquote>

`21-25`: _📐 Maintainability & Code Quality_ | _🔵 Trivial_ | _💤 Low value_

**Fix typo in Postgres healthcheck variables.**

The `postgres` container sets `POSTGRES_USER` and `POSTGRES_DB` (with a single underscore), but the healthcheck uses `$${POSTGRES__USER}` and `$${POSTGRES__DB}` (with a double underscore). Although it falls back to the default `flame` correctly, it's best to use the right variable names.



<details>
<summary>📝 Proposed fix</summary>

```diff
     healthcheck:
-      test: [ "CMD-SHELL", "pg_isready -U $${POSTGRES__USER:-flame} -d $${POSTGRES__DB:-flame}" ]
+      test: [ "CMD-SHELL", "pg_isready -U $${POSTGRES_USER:-flame} -d $${POSTGRES_DB:-flame}" ]
       interval: 5s
       timeout: 5s
       retries: 10
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tests/docker-compose.yml` around lines 21 - 25, Correct the Postgres
healthcheck command to reference the container’s POSTGRES_USER and POSTGRES_DB
environment variables with single underscores, while preserving the existing
default values and pg_isready behavior.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/integration-test.yml:
- Around line 61-68: Add an explicit SeaweedFS server command with S3 enabled to
the service definitions: update .github/workflows/integration-test.yml lines
61-68, k8s/seaweedfs-deployment.yaml lines 15-21, and tests/docker-compose.yml
lines 3-11 to use the container’s command configuration with “server -s3”,
preserving the existing image, environment, and port settings.

In `@docker-compose.yml`:
- Around line 3-14: Update the seaweedfs service definition to explicitly start
SeaweedFS with the S3 subcommand, such as server -s3, so the S3 gateway listens
on port 8333 and supports the existing /healthz healthcheck.

In `@Dockerfile`:
- Around line 43-44: Update entrypoint.sh so its server-launch command uses exec
before python -m uvicorn, passing "$@" unchanged, allowing Uvicorn to replace
the shell process while preserving the existing arguments.

In `@entrypoint.sh`:
- Around line 4-5: Update the final Uvicorn invocation in the entrypoint script
to use exec, replacing the shell process with Uvicorn while preserving the
existing project target and "$@" argument forwarding.

In `@k8s/helm/node-storage-service/templates/node-storage-deployment.yaml`:
- Around line 23-32: Update the S3__ENDPOINT environment variable in the
node-storage deployment to append SeaweedFS’s exposed port 8333 to the existing
service hostname, preserving the current Release.Name-based service reference.

In `@project/routers/local.py`:
- Around line 287-288: Update the existence check around _get_object_from_s3 to
retain the returned HTTPResponse and explicitly close it after verification,
ensuring the unread response stream and underlying connection are released while
preserving the existing behavior and error handling.

In `@project/server.py`:
- Around line 63-64: Update get_postgres_db in dependencies.py to return the
globally initialized db_proxy or a single cached pool instance instead of
creating a new PooledPostgresqlDatabase per call. Ensure FastAPI transaction
blocks and Peewee model queries use the same database object and connection
pool, while preserving the existing initialization flow in db_proxy.initialize.

---

Nitpick comments:
In `@project/migrations/001_init.py`:
- Line 59: Update the `indexes` definition in the migration to use a tuple
instead of a list, matching the immutable index declaration used by the `Result`
model and avoiding mutable class attribute warnings.
- Line 49: Update the indexes definition in the migration to use Peewee’s
tuple-based form instead of a list, preserving the existing client_id/object_id
composite index and uniqueness setting while matching the convention in
project/crud.py.

In `@README.md`:
- Around line 114-116: Update the fenced code block containing the docker
compose command to specify the shell language, using the existing command
unchanged.

In `@tests/docker-compose.yml`:
- Around line 21-25: Correct the Postgres healthcheck command to reference the
container’s POSTGRES_USER and POSTGRES_DB environment variables with single
underscores, while preserving the existing default values and pg_isready
behavior.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 8d82fdde-d030-4429-8ba4-328a1e126c71

📥 Commits

Reviewing files that changed from the base of the PR and between 5c392b8 and fe0dae1.

⛔ Files ignored due to path filters (1)
  • poetry.lock is excluded by !**/*.lock
📒 Files selected for processing (32)
  • .env.example
  • .github/workflows/integration-test.yml
  • .pre-commit-config.yaml
  • Dockerfile
  • README.md
  • config/logging.json
  • docker-compose.yml
  • entrypoint.sh
  • k8s/README.md
  • k8s/helm/node-storage-service/templates/minio-deployment.yaml
  • k8s/helm/node-storage-service/templates/node-storage-deployment.yaml
  • k8s/helm/node-storage-service/templates/seaweedfs-deployment.yaml
  • k8s/helm/node-storage-service/templates/seaweedfs-service.yaml
  • k8s/helm/node-storage-service/values.yaml
  • k8s/node-storage-deployment.yaml
  • k8s/seaweedfs-deployment.yaml
  • k8s/seaweedfs-service.yaml
  • project/config.py
  • project/crud.py
  • project/dependencies.py
  • project/main.py
  • project/migrations/001_init.py
  • project/migrations/scripts/create_migration.py
  • project/migrations/scripts/migrate.py
  • project/migrations/scripts/router.py
  • project/routers/local.py
  • project/server.py
  • pyproject.toml
  • tests/conftest.py
  • tests/docker-compose.yml
  • tests/test_local.py
  • tests/test_local_tagged.py
💤 Files with no reviewable changes (3)
  • k8s/helm/node-storage-service/templates/minio-deployment.yaml
  • project/main.py
  • project/crud.py

Comment thread .github/workflows/integration-test.yml
Comment thread docker-compose.yml
Comment thread Dockerfile
Comment thread entrypoint.sh Outdated
Comment thread project/routers/local.py Outdated
Comment thread project/server.py
@pbrassel
pbrassel merged commit b5320ab into main Jul 16, 2026
2 checks passed
@pbrassel
pbrassel deleted the seaweedfs branch July 16, 2026 10:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant