Commit cfe321e2 authored by Chris Hines's avatar Chris Hines
Browse files

Update vscode.md

parent d8bbbc0f
Pipeline #18063 failed with stage
in 4 minutes and 13 seconds
Introduction
-------------
## Introduction
So you'd like to use VS Code, but your data is on M3. No problem. You want a VS Code remote server
......@@ -7,74 +7,107 @@ The official VS Code documentation on this is here https://code.visualstudio.com
By default, if you follow those instructions, you will end up running the VS Code remote server on the login node. Please don't do this, the login nodes are a shared resources and we would rather allocate you a resource just for you.
Steps
------
## Steps
1. Setup VS Code (install remote server extension)
Please follow the excelent instructions here https://code.visualstudio.com/docs/remote/ssh#_installation ... When you get to the section "Connect to a remote host" please come back here
2. Setup ssh-agent and keys (optional HIGHLY recommended)
1. Generate a key
If you are still using passwords, you should definitly switch to keys open a terminal (mac and linux) or a powershell (windows) and run the command
```
ssh-keygen -t ed25519
```
you will be asked to enter a passphrase. This is used to encrypt the output file on your computer.
2.1 Generate a key
Next enter
If you are still using passwords, you should definitly switch to keys
open a terminal (mac and linux) or a powershell (windows) and run the command
```
cat ~/.ssh/id_ed25519.pub
```
copy the line of text printed out. Using Strudel2 (beta.cloud.cvl.org.au), select Terminal -> Run on Login node
when the new window opens type
```
echo <paste the line you just copied> >> .ssh/authorized_keys
```
```
ssh-keygen -t ed25519
```
2. Setup the agent
Windows only (the agent is already running on linux and mac)
you will be asked to enter a passphrase. This is used to encrypt the output file on your computer.
ALERT ALERT THIS DOCUMENTATION IS INCOMPLETE!!!!!
I *think* you may have to install openssh on windows, but it may be pre-installed.
```
To install the OpenSSH components:
Open Settings, select Apps > Apps & Features, then select Optional Features.
Scan the list to see if the OpenSSH is already installed. If not, at the top of the page, select Add a feature, then:
On Windows 10, find OpenSSH Client, then click Install
```
Next you need to start the OpenSSH SSH agent. You have two options
### Via GUI:
Next enter
I think you command
```
cat ~/.ssh/id_ed25519.pub
```
1. Press the windows key (to begin search) and type "Services". Hit enter to open the services app
2. Scroll down to OpenSSH Authentication Agent and double click
copy the line of text printed out. Using Strudel2 (beta.cloud.cvl.org.au), select Terminal -> Run on Login node
when the new window opens type
```
echo <paste the line you just copied> >> .ssh/authorized_keys
```
3. Change "Startup type" to "Automatic"
2.2 Setup the agent
4. Click start
Windows only (the agent is already running on linux and mac)
It is possible to start the inbuild windows ssh-agent. But I'm having difficulty finding a good link to follow. If you find one please tell me. This https://docs.microsoft.com/en-us/windows-server/administration/openssh/openssh_keymanagement is sort of OK, but could be better.
### Via PowerShell:
Open a terminal and type `ssh-add .ssh/id_ed25519` you'll be asked for that key passphrase, but then your computer will remember the key (until the next reboot)
Start a powershell as administrator and run the following
```
Install-Module -Force OpenSSHUtils -Scope AllUsers
Get-Service -Name ssh-agent | Set-Service -StartupType Automatic
Start-Service ssh-agent
```
3. Configure VS Code
Skip down to here https://code.visualstudio.com/docs/remote/ssh#_remember-hosts-and-advanced-settings. If you are on linux or mac, for your "SSH Connection Command" enter
Open a terminal and type `ssh-add .ssh/id_ed25519` you'll be asked for that key passphrase, but then your computer will remember the key (until the next reboot)
3. Configure VS Code
Skip down to here https://code.visualstudio.com/docs/remote/ssh#_remember-hosts-and-advanced-settings. If you are on linux or mac, for your "SSH Connection Command" enter
```
ssh -l <username> VSCode -o ProxyCommand="ssh <username>@m3.massive.org.au /usr/local/sv2/sshnc.sh"
```
On windows enter
```
```
ssh -l <username> VSCode -o ProxyCommand="ssh.exe <username>@m3.massive.org.au /usr/local/sv2/sshnc.sh"
```
```
The proxycommand allows us to connect, not to the login nodes but to a node allocated just to you. This is different than a regular VSCode setup because youre on an HPC cluster, not a regular server.
4. Start remote server.
4. Allocate a computer for the remote server
Using strudel2 https://beta.cloud.cvl.org.au login to CVL and select the VS Code application on the left. Fill in how many CPUs which GPU and how much RAM you need for how long and click launch
Using strudel2 https://beta.cloud.cvl.org.au login to CVL and select the VS Code application on the left. Fill in how many CPUs which GPU and how much RAM you need for how long and click launch
5. Start the remote server
5. Switching back to vscode, Remote-ssh: Connect to host and select the VS Code host
If you didn't add the key to the agent, VS Code will ask you for either you key passphrase or your M3 password. It will ask twice (once to the connect to the login nodes, then again to connect to the node running the remote server)
Switching back to vscode, Remote-ssh: Connect to host and select the VS Code host If you didn't add the key to the agent, VS Code will ask you for either you key passphrase or your M3 password. It will ask twice (once to the connect to the login nodes, then again to connect to the node running the remote server)
VS Code will also ask you what type of server it is (linux)
VS Code will also ask you what type of server it is (linux)
Then you should be good to good
Then you should be good to good
FAQ:
====
## FAQ:
Q: I see a message about "Connection Reset by peer":
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment