Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: multi storage providers support #350

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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
130 changes: 95 additions & 35 deletions .env.sample
Original file line number Diff line number Diff line change
@@ -1,55 +1,115 @@
# Tenant Configuration
#######################################
# Tenant
#######################################
TENANT_ID=bjhaohmqunupljrqypxz
ANON_KEY=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJyb2xlIjoiYW5vbiIsImlhdCI6MTYxMzUzMTk4NSwiZXhwIjoxOTI5MTA3OTg1fQ.mqfi__KnQB4v6PkIjkhzfwWrYyF94MEbSC6LnuvVniE
SERVICE_KEY=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJyb2xlIjoic2VydmljZV9yb2xlIiwiaWF0IjoxNjEzNTMxOTg1LCJleHAiOjE5MjkxMDc5ODV9.th84OKK0Iz8QchDyXZRrojmKSEZ-OuitQm_5DvLiSIc
TENANT_ID=bjhaohmqunupljrqypxz
PGRST_JWT_SECRET=f023d3db-39dc-4ac9-87b2-b2be72e9162b

# Database configuration
DATABASE_URL=postgresql://postgres:[email protected]/postgres
DATABASE_POOL_URL=postgresql://postgres:[email protected]:6453/postgres

# Upload configuration
FILE_SIZE_LIMIT=52428800

# Storage
STORAGE_BACKEND=s3
GLOBAL_S3_BUCKET=name-of-your-s3-bucket
REGION=region-of-where-your-service-is-running

# S3 Configuration
REGION=region-of-your-s3-bucket
GLOBAL_S3_ENDPOINT=http://127.0.0.1:9000
GLOBAL_S3_PROTOCOL=http
#######################################
# Server
#######################################
HOST=0.0.0.0
PORT=5000
ADMIN_PORT=5001
SERVER_KEEP_ALIVE_TIMEOUT=61
SERVER_HEADERS_TIMEOUT=65

# Minio Configuration (if using Minio)
GLOBAL_S3_FORCE_PATH_STYLE=true
AWS_ACCESS_KEY_ID=supa-storage
AWS_SECRET_ACCESS_KEY=secret1234
AWS_DEFAULT_REGION=ap-southeast-1
#######################################
# Auth
#######################################
AUTH_JWT_SECRET=f023d3db-39dc-4ac9-87b2-b2be72e9162b
AUTH_JWT_ALGORITHM=HS256

# Local File Storage Configuration
FILE_STORAGE_BACKEND_PATH=./data
#######################################
# Database
#######################################
DATABASE_URL=postgresql://postgres:[email protected]/postgres
DATABASE_POOL_URL=postgresql://postgres:[email protected]:6453/postgres
DATABASE_CONNECTION_TIMEOUT=3000
DATABASE_MAX_CONNECTIONS=20

# Multitenant
#######################################
# Multi Tenancy
#######################################
IS_MULTITENANT=false
MULTITENANT_DATABASE_URL=postgresql://postgres:[email protected]:5433/postgres
X_FORWARDED_HOST_REGEXP=
ADMIN_API_KEYS=apikey
ENCRYPTION_KEY=encryptionkey

# Logs
LOGFLARE_ENABLED=false
LOGFLARE_API_KEY=api_key
LOGFLARE_SOURCE_TOKEN=source_token
#######################################
# Uploads
#######################################
FILE_SIZE_LIMIT=52428800
SIGNED_UPLOAD_URL_EXPIRATION_TIME=60
TUS_URL_PATH=/upload/resumable
TUS_URL_EXPIRY_MS=3600000

#######################################
# Image Transformation
#######################################
ENABLE_IMAGE_TRANSFORMATION=true
IMGPROXY_URL=http://localhost:50020
IMG_LIMITS_MIN_SIZE=0
IMG_LIMITS_MAX_SIZE=2000

ENABLE_RATE_LIMITER=false
RATE_LIMITER_DRIVER=redis
RATE_LIMITER_REDIS_URL=localhost:6379

#######################################
# Storage Driver
#######################################
STORAGE_BACKEND=s3

#######################################
# S3 Providers
#######################################
STORAGE_S3_BUCKET=name-of-your-s3-bucket
STORAGE_S3_MAX_SOCKETS=200

# S3 Provider Configuration
#
# You can list more then one provider.
# The convention is STORAGE_S3_PROVIDER_{PROVIDER_NAME}_{CONFIGURATION}
# When specifying more than one provider you must also specify the default provider using STORAGE_S3_PROVIDER_{PROVIDER_NAME}_DEFAULT=true
#
# Example AWS S3 provider:
#
# STORAGE_S3_PROVIDER_AWS_ACCESS_KEY_ID=access_key_id
# STORAGE_S3_PROVIDER_AWS_SECRET_ACCESS_KEY=secret_access_key
# STORAGE_S3_PROVIDER_AWS_REGION=us-east-1

# Minio Provider Configuration
STORAGE_S3_PROVIDER_MINIO_DEFAULT=true
STORAGE_S3_PROVIDER_MINIO_ENDPOINT=http://127.0.0.1:9000
STORAGE_S3_PROVIDER_MINIO_FORCE_PATH_STYLE=true
STORAGE_S3_PROVIDER_MINIO_ACCESS_KEY_ID=supa-storage
STORAGE_S3_PROVIDER_MINIO_SECRET_ACCESS_KEY=secret1234
STORAGE_S3_PROVIDER_MINIO_REGION=us-east-1

#######################################
# File Provider Configuration
#######################################
FILE_STORAGE_BACKEND_PATH=./data

#######################################
# Queue
WEBHOOK_URL=
#######################################
ENABLE_QUEUE_EVENTS=false

# Rate Limiter
ENABLE_RATE_LIMITER=true
RATE_LIMITER_DRIVER=redis
RATE_LIMITER_REDIS_URL=localhost:6379
#######################################
# Webhooks
#######################################
WEBHOOK_URL=
WEBHOOK_API_KEY=

#######################################
# Monitoring
#######################################
LOG_LEVEL=info
LOGFLARE_ENABLED=false
LOGFLARE_API_KEY=api_key
LOGFLARE_SOURCE_TOKEN=source_token
ENABLED_DEFAULT_METRICS=true
1 change: 1 addition & 0 deletions migrations/multitenant/0006-s3-provider.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ALTER table tenants ADD COLUMN s3_provider TEXT DEFAULT NULL;
Loading