Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,16 @@ jobs:
with:
node-version: ${{ matrix.node-version }}

- name: Setup MinIO
run: |
docker run -d \
--name minio \
-p 9000:9000 -p 9001:9001 \
-e MINIO_ROOT_USER=layotto \
-e MINIO_ROOT_PASSWORD=layotto_secret \
minio/minio:latest server /data --console-address ":9001"
bash scripts/setup-minio.sh

- name: Bootstrap layotto
# run: |
# cd demo
Expand Down
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,18 @@ npm run build:grpc

### step 1. Set up the environment

- Running redis and etcd under Docker
- Running redis, etcd and MinIO under Docker

```bash
docker-compose up -d
```

- Setup MinIO bucket for OSS tests

```bash
bash scripts/setup-minio.sh
```

- Start a echoserver for testing the rpc api

```bash
Expand Down
11 changes: 11 additions & 0 deletions demo/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,17 @@
}
}
},
"file": {
"oss_demo": {
"type": "minio",
"metadata": {
"endpoint": "localhost:9000",
"accessKeyID": "layotto",
"accessKeySecret": "layotto_secret",
"SSL": false
}
}
},
"app": {
"app_id": "app1",
"grpc_callback_port": 9999
Expand Down
21 changes: 21 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,29 @@ services:
networks:
- layotto-js-sdk

minio:
image: minio/minio:latest
command: server /data --console-address ":9001"
restart: always
environment:
- MINIO_ROOT_USER=layotto
- MINIO_ROOT_PASSWORD=layotto_secret
ports:
- 9000:9000
- 9001:9001
volumes:
- layotto-js-sdk-minio:/data
networks:
- layotto-js-sdk
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:9000/minio/health/live"]
interval: 10s
timeout: 5s
retries: 5

volumes:
layotto-js-sdk-redis:
layotto-js-sdk-minio:

networks:
layotto-js-sdk:
Expand Down
48 changes: 48 additions & 0 deletions scripts/setup-minio.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#!/bin/bash

# Setup MinIO for testing
# This script creates the required bucket for OSS tests

set -e

# Wait for MinIO to be ready
echo "Waiting for MinIO to be ready..."
for i in {1..30}; do
if curl -sf http://localhost:9000/minio/health/live > /dev/null 2>&1; then
echo "MinIO is ready!"
break
fi
if [ "$i" -eq 30 ]; then
echo "MinIO failed to start"
exit 1
fi
echo "Waiting for MinIO... ($i/30)"
sleep 1
done

# Install MinIO client if not available
if ! command -v mc &> /dev/null; then
echo "Installing MinIO client..."
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
curl -sSL https://dl.min.io/client/mc/release/linux-amd64/mc -o /tmp/mc
elif [[ "$OSTYPE" == "darwin"* ]]; then
curl -sSL https://dl.min.io/client/mc/release/darwin-amd64/mc -o /tmp/mc
else
echo "Unsupported OS: $OSTYPE"
exit 1
fi
chmod +x /tmp/mc
MC_CMD="/tmp/mc"
else
MC_CMD="mc"
fi

# Configure MinIO alias
echo "Configuring MinIO client..."
$MC_CMD alias set myminio http://localhost:9000 layotto layotto_secret

# Create test bucket
echo "Creating test bucket..."
$MC_CMD mb myminio/antsys-tnpmbuild --ignore-existing

echo "MinIO setup complete!"
2 changes: 1 addition & 1 deletion test/unit/client/Oss.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import crypto from 'node:crypto';
import { Client } from '../../../src';
import { randomUUID } from 'node:crypto';

describe.skip('client/Oss.test.ts', () => {
describe('client/Oss.test.ts', () => {
const client = new Client('34904', '127.0.0.1', { ossEnable: true });

it('test put object', async () => {
Expand Down