Exposing a local HTTP server to my application

I am trying to prepopulate a volume with some files, but all my attempts until now have failed:

  1. Connecting through SFTP from Windows (with or without WSL). This seems to be a known issue.
  2. Using rsync from a VM running the latest Ubuntu 22.04. Used fly ssh issue --agent, followed by fly proxy 8080:22, followed by rsync --rsh='ssh -p8080' foo root@localhost:/data/foo. Rsync fails with the message: rsync error: protocol incompatibility (code 2) at compat.c(600)

Now I am looking for a workaround and I thought it might be possible to spin up a local web server and serve the files I want to transfer, then use curl from a shell in my application (through fly ssh console) to download them. Is it possible to connect from the application to my local machine and access its webserver? If so, how?

I’ve installed an SSH agent into the server, had it listen on port 2222, and then set port 22 in services as an exposed port (the internal port is 2222). Then I was able to SSH in via normal SSH (use scp, etc).

Port 22 is already taken on some internal networks by a process in fly to support the fly ssh command IIRC.

I ended up trying scp with the proxy approach mentioned in my original post (instead of rsync) and it worked. I did have to install it first on the server, though. This definitely feels like a less polished side of fly.io, in contrast to the rest of the experience, which is usually great.

2 Likes