Skip to content

Conversation

corylanou
Copy link
Collaborator

Summary

This PR adds support for custom S3-compatible storage endpoints directly from the command line using URL query parameters. This allows users to replicate to services like MinIO, Tigris, Wasabi, and other S3-compatible storage providers without needing a configuration file.

Fixes #219

Changes

  • Added ParseReplicaURLWithQuery() function to parse query parameters from S3 URLs
  • Modified NewS3ReplicaClientFromConfig() to handle query parameters:
    • endpoint - Custom S3-compatible endpoint
    • region - AWS region
    • forcePathStyle - Path-style vs virtual-hosted-style addressing
    • skipVerify - TLS certificate verification
  • Auto-prepend http:// to endpoints without a scheme
  • Added AWS S3 regex pattern for proper bucket name parsing
  • Added MinIO integration test to CI workflow

Query Parameters

Parameter Description Default
endpoint Custom S3-compatible endpoint URL -
region AWS region us-east-1 for custom endpoints
forcePathStyle Use path-style addressing true for custom endpoints
skipVerify Skip TLS certificate verification false

Examples

# MinIO
litestream replicate /path/to/db.sqlite \
  "s3://mybucket/db?endpoint=localhost:9000&forcePathStyle=true"

# Tigris (Fly.io)
litestream replicate /path/to/db.sqlite \
  "s3://my-tigris-bucket/db?endpoint=fly.storage.tigris.dev&region=auto"

# Restore from MinIO
litestream restore -o restored.db \
  "s3://mybucket/db?endpoint=localhost:9000"

# Standard AWS S3 (unchanged)
litestream replicate /path/to/db.sqlite s3://mybucket/db

Testing

  • ✅ Unit tests added for URL parsing with query parameters
  • ✅ Unit tests added for S3 client configuration
  • ✅ Integration tested locally with real MinIO instance
  • ✅ MinIO integration test added to CI workflow
  • ✅ All existing tests pass (backward compatibility maintained)

Test plan

  • Run unit tests: go test ./cmd/litestream ./s3
  • Test with local MinIO container
  • Verify restore functionality works
  • Ensure backward compatibility with existing S3 URLs
  • Test with actual Tigris deployment (requires account)
  • Test with other S3-compatible providers

🤖 Generated with Claude Code

Implements support for custom S3-compatible storage endpoints (MinIO, Tigris, etc.)
directly from the command line without requiring a configuration file.

Query parameters supported:
- endpoint: Custom S3-compatible endpoint URL
- region: AWS region configuration
- forcePathStyle: Path-style vs virtual-hosted addressing
- skipVerify: TLS certificate verification

Changes:
- Add ParseReplicaURLWithQuery() to parse query params from URLs
- Update S3 client config to use query parameters
- Auto-prepend http:// to endpoints without scheme
- Add AWS S3 URL regex for proper bucket name parsing
- Add MinIO integration test to CI workflow

Fixes #219

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
Copy link

github-actions bot commented Sep 5, 2025

Manual integration tests have been run by @corylanou

View test results

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Custom S3-Compatible Storage Support other than localhost
1 participant