Skip to content
Open
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
1 change: 1 addition & 0 deletions apps/nestjs-backend/src/configs/storage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ export const storageConfig = registerAs('storage', () => ({
accessKey: process.env.BACKEND_STORAGE_S3_ACCESS_KEY!,
secretKey: process.env.BACKEND_STORAGE_S3_SECRET_KEY!,
maxSockets: Number(process.env.BACKEND_STORAGE_S3_MAX_SOCKETS ?? 100),
forcePathStyle: process.env.BACKEND_STORAGE_S3_FORCE_PATH_STYLE === 'true',
},
uploadMethod: process.env.BACKEND_STORAGE_UPLOAD_METHOD ?? 'put',
encryption: {
Expand Down
4 changes: 3 additions & 1 deletion apps/nestjs-backend/src/features/attachments/plugins/s3.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export class S3Storage implements StorageAdapter {
private logger = new Logger(S3Storage.name);

constructor(@StorageConfig() readonly config: IStorageConfig) {
const { endpoint, region, accessKey, secretKey, maxSockets } = this.config.s3;
const { endpoint, region, accessKey, secretKey, maxSockets, forcePathStyle } = this.config.s3;
this.checkConfig();
this.httpsAgent = new https.Agent({
maxSockets,
Expand All @@ -50,6 +50,7 @@ export class S3Storage implements StorageAdapter {
region,
endpoint,
requestHandler,
forcePathStyle,
credentials: {
accessKeyId: accessKey,
secretAccessKey: secretKey,
Expand All @@ -64,6 +65,7 @@ export class S3Storage implements StorageAdapter {
endpoint,
bucketEndpoint: true,
requestHandler,
forcePathStyle,
credentials: {
accessKeyId: accessKey,
secretAccessKey: secretKey,
Expand Down
12 changes: 12 additions & 0 deletions apps/nextjs-app/.env.development
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,18 @@ NEXT_BUILD_ENV_SENTRY_UPLOAD_DRY_RUN=false
BACKEND_STORAGE_PROVIDER=local
BACKEND_STORAGE_PUBLIC_BUCKET=public
BACKEND_STORAGE_PUBLIC_URL=http://localhost:3000/api/attachments/read/public

# Example of configuration for RustFS
#BACKEND_STORAGE_PROVIDER=s3
#BACKEND_STORAGE_PUBLIC_BUCKET=public
#BACKEND_STORAGE_PUBLIC_URL=http://localhost:9000
#BACKEND_STORAGE_S3_REGION=eu
#BACKEND_STORAGE_S3_ENDPOINT=http://localhost:9000
#BACKEND_STORAGE_S3_INTERNAL_ENDPOINT=http://localhost:9000
#BACKEND_STORAGE_S3_ACCESS_KEY=teable
#BACKEND_STORAGE_S3_SECRET_KEY=teable123
#BACKEND_STORAGE_S3_FORCE_PATH_STYLE=true

# ↓↓↓↓↓↓↓↓ backend(nestjs) env ↓↓↓↓↓↓↓↓
NEXTJS_DIR=../nextjs-app
LOG_LEVEL=info
Expand Down
6 changes: 5 additions & 1 deletion dockers/.env
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,8 @@ REDIS_PASSWORD=teable

# Minio env
MINIO_ACCESS_KEY=teable
MINIO_SECRET_KEY=teable123
MINIO_SECRET_KEY=teable123

# RustFS S3
RUSTFS_ACCESS_KEY=teable
RUSTFS_SECRET_KEY=teable123
53 changes: 53 additions & 0 deletions dockers/storage-rustfs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: teable-storage

services:
teable-storage:
image: rustfs/rustfs:latest
container_name: teable-storage
hostname: teable-storage
restart: always
ports:
- '9000:9000'
- '9001:9001'
environment:
- RUSTFS_ADDRESS=:9000
- RUSTFS_CONSOLE_ADDRESS=:9001
- RUSTFS_ACCESS_KEY=${RUSTFS_ACCESS_KEY}
- RUSTFS_SECRET_KEY=${RUSTFS_SECRET_KEY}
- RUSTFS_CONSOLE_ENABLE=true
- RUSTFS_CORS_ALLOWED_ORIGINS=*
- RUSTFS_CONSOLE_CORS_ALLOWED_ORIGINS=*
volumes:
- storage_data:/data:rw
- storage_data:/logs:rw
# you may use a bind-mounted host directory instead,
# so that it is harder to accidentally remove the volume and lose all your data!
# - ./docker/storage/data:/data:rw
healthcheck:
test:
[
"CMD",
"sh", "-c",
"curl -f http://127.0.0.1:9000/health && curl -f http://127.0.0.1:9001/rustfs/console/health"
]
interval: 30s
timeout: 10s
retries: 3
start_period: 40s

createbuckets:
image: minio/mc
depends_on:
- teable-storage
entrypoint: >
/bin/sh -c "
/usr/bin/mc alias set teable-storage http://teable-storage:9000 ${RUSTFS_ACCESS_KEY} ${RUSTFS_SECRET_KEY};
/usr/bin/mc mb teable-storage/public;
/usr/bin/mc anonymous set public teable-storage/public;
/usr/bin/mc mb teable-storage/private;
exit 0;
"

volumes:
storage_data:
storage_logs: