I made an sftp.

For those interested in retrieving files from VMs once deployed, there’s now a branch of flyctl that speaks SFTP to our VMs:

There’s no official build of this (it’s a work in progress), so you’ll have to make it yourself to play with it. Once you’ve got it, it’s flyctl ssh sftp shell (the command names are one of the things we’ll need to do better with).

Right now the shell just does cd, ls, and get; get of a directory will retrieve a ZIP file of the whole directory tree. Don’t try to get /dev/zero (or at least don’t hold me responsible if it fills your disk).

This will only work on VMs started after this community post — I had to deploy a fix to hallpass, our tiny SSH server, to get this to work. Your current running VMs are still running old hallpass.

All the normal rules about connecting to SSH apply.

Most of the reason I’m posting this is: what else do you want this SFTP thingy to do? And for each of those things, what problem does it solve for your app?

10 Likes

Very cool. I’ve wanted to do a “put” occasionally and worked around by putting a file somewhere and downloading it on the VM instead.

Ok, the PR now includes “put” and “chmod” (also, I made “ls -l” work).

1 Like

Would I be too greedy asking for a put with wildcard (glob) syntax?

1 Like

Not if you tell me how it should work!

2 Likes

How about I back up. I have 10 files I want to replace on my VM, all in the same directory. What is the best way to do this?

I’m just a simple unfrozen caveman SFTP implementor. You all should have a conversation about what you need and then tell me what to do. :slight_smile:

4 Likes

Add the official-R option (to recursively put files) to the put command would be great. You can’t put a directory right now.

Not sure how feasible this would be to implement, but I think it would be useful if the sftp command could operate on a volume that’s not currently mounted on a running vm. Maybe behind the scenes you’d need to start a vm temporarily, but it would be great if that was an implementation detail that I didn’t need to care about.

The use case would be if I want a Docker image that already expects certain things to exist on the volume, it would be great to be able to create the volume, sftp initial files to it, and then run my vm, rather than me needing to modify my Docker image or create a separate vm with which to initialize the volume.

Hey guys! I created a PR where I added support for glob patterns for the put command, as I needed this feature for one of my apps. I’d appreciate some feedback on it!