VS Code Remote is the latest example in fly-examples. The example creates a SSH accessible, Ubuntu running app instance, ready for you to connect in with Visual Studio Code’s Remote SSH features so you can develop on a remote Fly system where ever you are.
What’s more, the example also shows how to import your own templates for applications, how to use Dockerfile build-args in Fly and other neat ways to work with Fly.
The script appears to only work for creating a new app. What if I want to connect to an existing app? I just want to be able to connect to my app via VS Code ultimately.
You can flyctl ssh console into an app, but I’m not sure what you mean by connect to the app with VSCode. Do you mean a workflow where you edit the code of a running app and then restart it directly?
Yeah so I want to access my app’s instance through ssh via VSCode. I have some files in the app instance that control the state of the application that I’d like to manipulate.
Our current examples are geared towards running a development environment for VSCode on Fly — like a big machine you can access from a laptop or iPad, a bit like Github Codespaces etc. In this case the Fly VM has your development tools, LSP server, working tree state, git history etc. Also the JS and CSS for the browser version of VSCode, if that’s your thing.
Getting into a specific machine and manipulating it is a bit of a different problem. fly ssh console does the first part for you, and you could also load up a remote directory in VSCode running on your laptop using normal ssh. Once you establish a link into the Fly network using Private Networking , the app instances become just like servers on your network. In this case you’d be running VSCode on your dev machine and loading up the files on an application VM, something like Mount remote directory using SSH - Ask Ubuntu might work. Or if you’re willing install stuff on the app to aid developing you could try Developing on Remote Machines using SSH and Visual Studio Code as well.
I’d imagine so, yes. You’d want to run ssh inside as well. I’ll ask around if there’s a built in way to handle the connection without the key management and ssh, but that should work either way.
You can use our built in SSH server to access a VM with vscode. You’ll need to create a wireguard peer, connect, then create an ssh key and add it to your local agent. Here are basic instructions: SSH connection to an instance - #2 by kurt
fly launch should be the command (no args) and it will ask for the org name, app name and more importantly, it will ask to copy fly.toml but before that you need to rename import.toml to fly.toml