Storage Backends
Artifact Keeper supports multiple storage backends to accommodate different deployment scenarios and scale requirements.
Storage Backend Types
Filesystem Storage
The default backend stores artifacts on the local filesystem or network-attached storage.
Configuration
STORAGE_BACKEND=filesystemSTORAGE_PATH=/var/lib/artifact-keeper/artifactsAdvantages
- Simple setup, no external dependencies
- Predictable performance
- Easy to backup with standard tools
- Works well with NFS/NAS for shared storage
Limitations
- Scaling requires network storage
- No built-in redundancy
- Manual backup procedures
Directory Structure
/var/lib/artifact-keeper/artifacts/├── repositories/│ ├── repo-{id}/│ │ ├── packages/│ │ │ ├── {package-name}/│ │ │ │ ├── {version}/│ │ │ │ │ ├── {artifact-file}│ │ │ │ │ └── metadata.json├── temp/ # Temporary upload staging└── cache/ # Downloaded edge cachePermissions
Ensure the backend process has read/write access:
sudo mkdir -p /var/lib/artifact-keeper/artifactssudo chown -R artifact-keeper:artifact-keeper /var/lib/artifact-keepersudo chmod -R 750 /var/lib/artifact-keeper/artifactsS3-Compatible Storage
Use Amazon S3 or compatible object storage (MinIO, Wasabi, DigitalOcean Spaces, etc.) for cloud-native deployments.
Configuration
STORAGE_BACKEND=s3S3_BUCKET=artifact-keeper-prodS3_REGION=us-east-1S3_ENDPOINT=https://s3.amazonaws.com # Optional, for S3-compatible servicesS3_ACCESS_KEY_ID=AKIAIOSFODNN7EXAMPLES3_SECRET_ACCESS_KEY=wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEYS3_PATH_PREFIX=artifacts/ # Optional, prefix for all keysAWS S3
STORAGE_BACKEND=s3S3_BUCKET=my-artifact-bucketS3_REGION=us-west-2# Use IAM roles for credentials (recommended)# Or set S3_ACCESS_KEY_ID and S3_SECRET_ACCESS_KEYMinIO (Self-Hosted)
STORAGE_BACKEND=s3S3_BUCKET=artifactsS3_REGION=us-east-1S3_ENDPOINT=https://minio.example.comS3_ACCESS_KEY_ID=minioadminS3_SECRET_ACCESS_KEY=minioadminS3_FORCE_PATH_STYLE=true # Required for MinIODigitalOcean Spaces
STORAGE_BACKEND=s3S3_BUCKET=my-spaces-bucketS3_REGION=nyc3S3_ENDPOINT=https://nyc3.digitaloceanspaces.comS3_ACCESS_KEY_ID=your-spaces-keyS3_SECRET_ACCESS_KEY=your-spaces-secretAdvantages
- Unlimited scalability
- Built-in redundancy and durability
- Geographic distribution
- No filesystem management
- Pay-as-you-go pricing
Considerations
- Network latency for uploads/downloads
- Data transfer costs
- Requires internet connectivity
- Credential management
MinIO as S3 Alternative
MinIO provides S3-compatible object storage that you can self-host.
Docker Compose Setup
version: '3.8'services: minio: image: minio/minio:latest command: server /data --console-address ":9001" environment: MINIO_ROOT_USER: minioadmin MINIO_ROOT_PASSWORD: minioadmin ports: - "9000:9000" - "9001:9001" volumes: - minio_data:/data healthcheck: test: ["CMD", "curl", "-f", "http://localhost:9000/minio/health/live"] interval: 30s timeout: 20s retries: 3
artifact-keeper: image: artifact-keeper-backend:latest environment: STORAGE_BACKEND: s3 S3_BUCKET: artifacts S3_REGION: us-east-1 S3_ENDPOINT: http://minio:9000 S3_ACCESS_KEY_ID: minioadmin S3_SECRET_ACCESS_KEY: minioadmin S3_FORCE_PATH_STYLE: "true" depends_on: - minio
volumes: minio_data:Create Bucket
Access MinIO console at http://localhost:9001 and create the artifacts bucket, or use the CLI:
mc alias set local http://localhost:9000 minioadmin minioadminmc mb local/artifactsmc policy set download local/artifacts # Optional: public readStorage Layout
Regardless of backend, artifacts are organized hierarchically:
Key/Path Structure
{repository_id}/packages/{package_name}/{version}/{artifact_filename}Examples:
repo-123/packages/my-app/1.0.0/my-app-1.0.0.tar.gzrepo-456/packages/@scope/package/2.1.3/package-2.1.3.tgzrepo-789/packages/my-image/latest/manifest.jsonMetadata Storage
Artifact metadata is stored in PostgreSQL, not in the storage backend. The storage backend only contains the binary artifact files.
Garbage Collection
Remove orphaned artifacts that are no longer referenced in the database.
Manual Cleanup
curl -X POST https://registry.example.com/api/v1/admin/cleanup \ -H "Authorization: Bearer $ADMIN_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "dry_run": true, "older_than_days": 30 }'Scheduled Cleanup
Configure automatic garbage collection:
GC_ENABLED=trueGC_SCHEDULE="0 2 * * *" # Daily at 2 AMGC_RETENTION_DAYS=90 # Keep artifacts for 90 daysWhat Gets Cleaned
- Artifacts marked as deleted but still on disk
- Incomplete multipart uploads (>24 hours old)
- Temporary files from failed uploads
- Orphaned chunks from interrupted edge transfers
Dry Run Mode
Always test with dry run first:
GC_DRY_RUN=trueThis logs what would be deleted without actually removing anything.
Storage Migration
From Filesystem to S3
- Configure S3 backend settings
- Run migration tool:
cargo run --bin migrate-storage -- \ --from filesystem \ --from-path /var/lib/artifact-keeper/artifacts \ --to s3 \ --s3-bucket artifact-keeper-prod- Verify migration:
cargo run --bin migrate-storage -- --verify- Update backend configuration to use S3
- Restart backend services
From S3 to Filesystem
Same process in reverse:
cargo run --bin migrate-storage -- \ --from s3 \ --s3-bucket artifact-keeper-prod \ --to filesystem \ --to-path /var/lib/artifact-keeper/artifactsPerformance Tuning
Filesystem
# Use faster filesystem for metadataSTORAGE_PATH=/mnt/ssd/artifacts
# Enable direct I/O for large filesSTORAGE_DIRECT_IO=true
# Adjust buffer sizesSTORAGE_BUFFER_SIZE=1048576 # 1 MBS3
# Multipart upload thresholdS3_MULTIPART_THRESHOLD=104857600 # 100 MB
# Chunk size for multipart uploadsS3_MULTIPART_CHUNK_SIZE=10485760 # 10 MB
# Connection poolingS3_MAX_CONNECTIONS=50
# Enable transfer acceleration (AWS S3 only)S3_USE_TRANSFER_ACCELERATION=trueBackup Considerations
Filesystem Backend
Use standard backup tools:
# rsync to backup locationrsync -av /var/lib/artifact-keeper/artifacts/ /backup/artifacts/
# Tar archivetar -czf artifacts-backup.tar.gz /var/lib/artifact-keeper/artifactsS3 Backend
Enable versioning and lifecycle policies:
# Enable versioningaws s3api put-bucket-versioning \ --bucket artifact-keeper-prod \ --versioning-configuration Status=Enabled
# Lifecycle rule for old versionsaws s3api put-bucket-lifecycle-configuration \ --bucket artifact-keeper-prod \ --lifecycle-configuration file://lifecycle.jsonUse S3 replication for disaster recovery:
aws s3api put-bucket-replication \ --bucket artifact-keeper-prod \ --replication-configuration file://replication.jsonMonitoring
Storage Metrics
Monitor these metrics:
- Total storage size
- Number of artifacts
- Upload/download throughput
- Error rates (failed uploads/downloads)
- Storage backend latency
Prometheus Metrics
artifact_keeper_storage_size_bytesartifact_keeper_storage_objects_totalartifact_keeper_storage_upload_duration_secondsartifact_keeper_storage_download_duration_secondsartifact_keeper_storage_errors_totalHealth Checks
# Check storage backend connectivitycurl https://registry.example.com/api/v1/admin/health/storageTroubleshooting
Filesystem Permission Errors
# Check ownershipls -la /var/lib/artifact-keeper/artifacts
# Fix permissionssudo chown -R artifact-keeper:artifact-keeper /var/lib/artifact-keeperS3 Connection Issues
# Test credentials with AWS CLIaws s3 ls s3://artifact-keeper-prod --profile your-profile
# Verify endpoint connectivitycurl -v https://s3.us-east-1.amazonaws.comHigh Storage Costs
- Enable garbage collection
- Set retention policies
- Use S3 lifecycle rules to move to cheaper storage classes
- Compress artifacts before upload
- Deduplicate using content-addressable storage