SFTP Storage
Store packages on a remote server via SFTP (SSH File Transfer Protocol).
Package
dotnet add package AvantiPoint.Packages.Sftp
Configuration
appsettings.json:
{
"Storage": {
"Type": "Sftp",
"Host": "sftp.example.com",
"Port": 22,
"Username": "packages",
"Password": "your-password",
"RemotePath": "/var/packages",
"MaxConnections": 4
}
}
Passwordless auth:
{
"Storage": {
"PrivateKeyPath": "/path/to/id_rsa",
"PrivateKeyPassphrase": "optional"
}
}
Program.cs:
options.AddSftpStorage();
// or
options.AutoDiscoverSftpStorage();
Behavior notes
- Downloads:
GetDownloadUriAsyncreturnsnull. Clients download package content through the feed API (no CDN redirect). - Concurrency: Use
MaxConnectionsto limit parallel SSH sessions. SFTP is not ideal for high-concurrency feeds. - Paths: Package paths are POSIX-style under
RemotePath(for examplepackages/{id}/{version}/...).
Local testing
docker run -p 2222:22 -d atmoz/sftp testuser:testpass:1001:1001:packages
Example test configuration:
{
"Storage": {
"Type": "Sftp",
"Host": "localhost",
"Port": 2222,
"Username": "testuser",
"Password": "testpass",
"RemotePath": "/"
}
}
CI uses Testcontainers (atmoz/sftp) in AvantiPoint.Packages.Storage.Tests.