diff --git a/docs/configuration/storage.md b/docs/configuration/storage.md index a2dd1592..7b954766 100644 --- a/docs/configuration/storage.md +++ b/docs/configuration/storage.md @@ -43,13 +43,13 @@ lancedb: aws_secret_access_key: YOUR_SECRET_KEY region: us-east-1 -# S3-compatible (MinIO, Tigris, etc.) +# S3-compatible (SeaweedFS, Tigris, etc.) lancedb: uri: s3://my-bucket/my-table storage_options: - endpoint: http://localhost:9000 - aws_access_key_id: minioadmin - aws_secret_access_key: minioadmin + endpoint: http://localhost:8333 + aws_access_key_id: YOUR_ACCESS_KEY + aws_secret_access_key: YOUR_SECRET_KEY region: us-east-1 allow_http: "true" diff --git a/tests/docker/docker-compose.minio.yml b/tests/docker/docker-compose.minio.yml deleted file mode 100644 index 2928d0c7..00000000 --- a/tests/docker/docker-compose.minio.yml +++ /dev/null @@ -1,22 +0,0 @@ -services: - minio: - image: minio/minio - ports: - - "9000:9000" - - "9001:9001" - environment: - MINIO_ROOT_USER: minioadmin - MINIO_ROOT_PASSWORD: minioadmin - command: server /data --console-address ":9001" - - createbucket: - image: minio/mc - depends_on: - - minio - entrypoint: > - /bin/sh -c " - sleep 2; - mc alias set myminio http://minio:9000 minioadmin minioadmin; - mc mb myminio/test-bucket; - exit 0; - " diff --git a/tests/docker/docker-compose.s3.yml b/tests/docker/docker-compose.s3.yml new file mode 100644 index 00000000..facf5be7 --- /dev/null +++ b/tests/docker/docker-compose.s3.yml @@ -0,0 +1,18 @@ +services: + seaweedfs: + image: chrislusf/seaweedfs + ports: + - "8333:8333" + command: server -s3 -s3.config=/etc/seaweedfs/s3-config.json + volumes: + - ./s3-config.json:/etc/seaweedfs/s3-config.json:ro + + createbucket: + image: chrislusf/seaweedfs + depends_on: + - seaweedfs + entrypoint: > + /bin/sh -c " + sleep 3 && + echo 's3.bucket.create -name test-bucket' | weed shell -master seaweedfs:9333 + " diff --git a/tests/docker/s3-config.json b/tests/docker/s3-config.json new file mode 100644 index 00000000..1d9ec9ce --- /dev/null +++ b/tests/docker/s3-config.json @@ -0,0 +1,14 @@ +{ + "identities": [ + { + "name": "admin", + "credentials": [ + { + "accessKey": "testkey", + "secretKey": "testsecret" + } + ], + "actions": ["Admin", "Read", "Write", "List", "Tagging"] + } + ] +} diff --git a/tests/test_s3_integration.py b/tests/test_s3_integration.py index 85a7e08f..b763c1df 100644 --- a/tests/test_s3_integration.py +++ b/tests/test_s3_integration.py @@ -1,7 +1,7 @@ -# Start MinIO before running: -# docker compose -f tests/docker/docker-compose.minio.yml up -d +# Start SeaweedFS before running: +# docker compose -f tests/docker/docker-compose.s3.yml up -d # Stop after: -# docker compose -f tests/docker/docker-compose.minio.yml down -v +# docker compose -f tests/docker/docker-compose.s3.yml down -v import socket from uuid import uuid4 @@ -13,20 +13,20 @@ from haiku.rag.client import HaikuRAG from haiku.rag.config.models import AppConfig, LanceDBConfig from haiku.rag.store.engine import Store -MINIO_ENDPOINT = "http://localhost:9000" -MINIO_BUCKET = "test-bucket" -MINIO_STORAGE_OPTIONS = { - "aws_access_key_id": "minioadmin", - "aws_secret_access_key": "minioadmin", - "endpoint": MINIO_ENDPOINT, +S3_ENDPOINT = "http://localhost:8333" +S3_BUCKET = "test-bucket" +S3_STORAGE_OPTIONS = { + "endpoint": S3_ENDPOINT, "region": "us-east-1", "allow_http": "true", + "aws_access_key_id": "testkey", + "aws_secret_access_key": "testsecret", } -def _minio_available() -> bool: +def _s3_available() -> bool: try: - s = socket.create_connection(("localhost", 9000), timeout=1) + s = socket.create_connection(("localhost", 8333), timeout=1) s.close() return True except OSError: @@ -36,7 +36,7 @@ def _minio_available() -> bool: pytestmark = [ pytest.mark.integration, pytest.mark.skipif( - not _minio_available(), reason="MinIO not running on localhost:9000" + not _s3_available(), reason="SeaweedFS not running on localhost:8333" ), ] @@ -45,8 +45,8 @@ def _make_config() -> AppConfig: unique_prefix = uuid4().hex[:8] return AppConfig( lancedb=LanceDBConfig( - uri=f"s3://{MINIO_BUCKET}/test-{unique_prefix}", - storage_options=MINIO_STORAGE_OPTIONS, + uri=f"s3://{S3_BUCKET}/test-{unique_prefix}", + storage_options=S3_STORAGE_OPTIONS, ) ) @@ -129,7 +129,6 @@ async def test_client_delete_document(tmp_path): @pytest.mark.asyncio async def test_app_info(tmp_path, capsys): config = _make_config() - # Initialize the database first async with HaikuRAG(tmp_path / "unused", config=config, create=True) as rag: await rag.create_document("Info test document.", uri="test://info")