mirror of
https://github.com/Afilmory/afilmory
synced 2026-04-24 23:05:05 +00:00
- Updated the SuperAdminTenantManager component to support pagination and sorting of tenant data. - Introduced new parameters for fetching tenants, including page, limit, status, sortBy, and sortDir. - Enhanced the UI to allow users to filter tenants by status and sort by name or creation date. - Updated localization files to include new strings for tenant filtering and pagination. Signed-off-by: Innei <tukon479@gmail.com>
100 lines
2.3 KiB
Plaintext
100 lines
2.3 KiB
Plaintext
---
|
|
title: B2 (Backblaze B2)
|
|
description: Configure Backblaze B2 storage for cost-effective cloud storage.
|
|
createdAt: 2025-11-14T22:10:00+08:00
|
|
lastModified: 2025-12-04T15:54:49+08:00
|
|
order: 33
|
|
---
|
|
|
|
# B2 (Backblaze B2) Storage
|
|
|
|
Backblaze B2 provides cost-effective cloud storage with an S3-compatible API. It's a great alternative to AWS S3 for budget-conscious deployments.
|
|
|
|
## Configuration
|
|
|
|
Configure B2 storage in `builder.config.ts`:
|
|
|
|
```typescript
|
|
import { defineBuilderConfig } from '@afilmory/builder'
|
|
|
|
export default defineBuilderConfig(() => ({
|
|
storage: {
|
|
provider: 'b2',
|
|
applicationKeyId: process.env.B2_KEY_ID!,
|
|
applicationKey: process.env.B2_KEY!,
|
|
bucketId: process.env.B2_BUCKET_ID!,
|
|
bucketName: process.env.B2_BUCKET_NAME!,
|
|
prefix: 'photos/',
|
|
customDomain: process.env.B2_CUSTOM_DOMAIN, // Optional CDN domain
|
|
},
|
|
}))
|
|
```
|
|
|
|
## Environment Variables
|
|
|
|
Add these to your `.env` file:
|
|
|
|
```bash
|
|
# Required
|
|
B2_KEY_ID=your_application_key_id
|
|
B2_KEY=your_application_key
|
|
B2_BUCKET_ID=your_bucket_id
|
|
B2_BUCKET_NAME=your_bucket_name
|
|
|
|
# Optional
|
|
B2_CUSTOM_DOMAIN=cdn.yourdomain.com
|
|
```
|
|
|
|
## Getting B2 Credentials
|
|
|
|
1. Sign up for a Backblaze B2 account
|
|
2. Create a bucket in the B2 console
|
|
3. Create an application key with read permissions
|
|
4. Copy the Key ID and Application Key to your `.env` file
|
|
5. Find your bucket ID and name in the B2 console
|
|
|
|
## CDN Integration
|
|
|
|
B2 links can be fronted by a CDN. Set `customDomain` if you use Cloudflare or another CDN:
|
|
|
|
```typescript
|
|
customDomain: 'cdn.yourdomain.com'
|
|
```
|
|
|
|
This generates public URLs using your CDN instead of B2's default domain.
|
|
|
|
## Prefix Organization
|
|
|
|
Use `prefix` to organize photos within your bucket:
|
|
|
|
```typescript
|
|
prefix: 'photos/2024/'
|
|
```
|
|
|
|
This scopes the builder to a specific folder, useful for organizing by year or project.
|
|
|
|
## Cost Considerations
|
|
|
|
B2 offers competitive pricing:
|
|
|
|
- **Storage**: $6/TB/month
|
|
- **Download**: First 1GB/day free, then $10/TB
|
|
- **Operations**: Free for most use cases
|
|
|
|
Compare with AWS S3 to see which fits your usage pattern better.
|
|
|
|
## Troubleshooting
|
|
|
|
**Authentication errors:**
|
|
|
|
- Verify `B2_KEY_ID` and `B2_KEY` are correct
|
|
- Check that the application key has read permissions
|
|
- Ensure the bucket ID and name match your B2 bucket
|
|
|
|
**Rate limiting:**
|
|
|
|
- B2 has generous rate limits, but very high concurrency may still hit limits
|
|
- Reduce concurrency if needed
|
|
|
|
|