-
Notifications
You must be signed in to change notification settings - Fork 324
Description
Feature Description
Add native support for Alibaba Cloud Object Storage Service (OSS) as a storage backend, similar
to existing S3, GCS, and ABS implementations.
Use Cases
I was using Litestream 0.3.x with Alibaba Cloud OSS through its S3-compatible API. However,
after upgrading to Litestream 0.5.x, this compatibility was broken.
Root cause: Litestream 0.5 upgraded to AWS SDK Go v2, which automatically enables chunked
encoding for uploads ≥5MB. Alibaba Cloud OSS does not support chunked encoding with
S3-compatible mode.
According to Alibaba Cloud's official
documentation:
Go SDK v2 automatically enables chunked encoding for large files (≥5MB), causing upload
failures. Use Go SDK v1 for large file uploads.
This makes it impossible for users in China and other regions who rely on Alibaba Cloud OSS to
use Litestream 0.5+.
Proposal
I have implemented a native OSS backend using the official
aliyun-oss-go-sdk. The implementation:
- Follows the existing
ReplicaClientinterface pattern - Supports all required operations (LTXFiles, OpenLTXFile, WriteLTXFile, DeleteLTXFiles, etc.)
- Handles metadata timestamps for point-in-time recovery
- Supports environment variable credentials (
ALIBABA_CLOUD_ACCESS_KEY_ID,
ALIBABA_CLOUD_ACCESS_KEY_SECRET) - Supports custom endpoints and regions
Configuration example:
dbs:
- path: /path/to/db.sqlite
replicas:
- type: oss
bucket: my-bucket
path: backups
region: cn-hangzhou
access-key-id: ${ALIBABA_CLOUD_ACCESS_KEY_ID}
access-key-secret: ${ALIBABA_CLOUD_ACCESS_KEY_SECRET}
Or using URL format:
dbs:
- path: /path/to/db.sqlite
replicas:
- url: oss://my-bucket/backupsI'm happy to submit a PR with the implementation and maintain the OSS backend going forward.