Update VSCode cluster connection instructions for new configuration#324
Update VSCode cluster connection instructions for new configuration#324CarlosLopezElorduy wants to merge 5 commits into
Conversation
FedericaBrando
left a comment
There was a problem hiding this comment.
Thanks for the update Carlos,
Actually I do it in a different way - I use the SBATCH command to submit the job and I always call the same node, cpus and memory directly in the sbatch file. This is my current header:
❯ cat .local/bin/vscode-it
#!/bin/bash
#SBATCH --job-name="code-client"
#SBATCH --cpus-per-task=16
#SBATCH --nodelist=irbccn25
#SBATCH --partition=bbg_cpu_zen4
#SBATCH --mem=32G
#SBATCH --qos=interactive
#SBATCH --time=30-00:00:00 # walltime
set -xe
/usr/sbin/sshd -D -p 3131 -f /dev/null -h ${HOME}/.ssh/id_ecdsathen I run it from the login node with:
sbatch vscode-itThis avoids the problem of allocating a different node every time and then losing the history for your opened sessions on a specific node in vscode, then it reduces the steps from 3 to just one, since the job is directly launched from the login node, no need for a screen nor an interactive session.
Having said so, your method works as well, and it's fine to me, up to you. If you want to merge go ahead!
🚀 🚀
b633d51 to
52b873b
Compare
There was a problem hiding this comment.
Pull request overview
Updates the IRB cluster VSCode connection documentation to reflect newer cluster/login node settings and to add two interactive-node workflows (dynamic vs fixed node), plus ignores local AI tool directories.
Changes:
- Reworked
cluster_node.mdwith separate instructions for login node vs interactive nodes, including Method A (interactive) and Method B (sbatch). - Updated SSH/ProxyJump examples and added an optional helper function for SSH config + tunneling.
- Extended
.gitignoreto exclude.claude/and.opencode/.
Reviewed changes
Copilot reviewed 1 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| docs/Tools/VSCode/cluster_node.md | Major rewrite of VSCode-to-cluster connection instructions, adding two interactive-node methods and updated SSH guidance. |
| .gitignore | Adds ignores for .claude/ and .opencode/ directories. |
Comments suppressed due to low confidence (6)
docs/Tools/VSCode/cluster_node.md:114
- Method A starts an SSHD on port 2222 (Step 2), but the suggested local SSH config sets
Port 22. That mismatch will make VSCode/SSH connect to the node’s regular SSH port instead of the job-launched SSHD. Align the port usage (either change the SSH config to 2222, or remove/adjust the SSHD step and keep port 22 consistently, including the optional tunnel).
Modify the file `~/.ssh/config` in your local machine to include the following configuration:
```bash
Host irbccn*
HostName %h
ProxyJump irblogin02.sc.irbbarcelona.org
User <user>
docs/Tools/VSCode/cluster_node.md:84
- This SSHD command uses the user’s
~/.ssh/id_ecdsaas the server host key and runs with-f /dev/null(default config). Reusing a personal client key as a host key and relying on defaults can weaken security and may fail if the key is passphrase-protected. Prefer generating a dedicated host key for this purpose and using an explicit minimal sshd config/options (e.g., disable password auth, restrict listen address).
#!/bin/bash
#SBATCH --job-name="tunnel"
#SBATCH --time=8:00:00 # walltime
docs/Tools/VSCode/cluster_node.md:167
- The helper function executes a composed SSH command via
evaland interpolates unvalidatedhost_aliasinto both a grep regex and the command string. This allows unexpected shell/regex injection if the alias contains special characters. Avoideval, quote variables, and either validatehost_aliasagainst an expected pattern (e.g.,^irbccn[0-9]+$) or escape it before using it in regex/commands.
```bash
add_cluster_ssh_host_with_tunnel() {
read -p "Enter host alias (e.g., irbccn39): " host_alias
current_user=$(whoami)
# Check if SSH config for this host already exists
if grep -qE "^Host[[:space:]]+${host_alias}\$" ~/.ssh/config; then
echo "SSH configuration for host '${host_alias}' already exists. Skipping configuration update."
else
new_entry="Host ${host_alias}
HostName %h
ProxyJump irblogin02.sc.irbbarcelona.org
User ${current_user}
Port 22
"
echo -e "\n${new_entry}" >> ~/.ssh/config
echo "SSH configuration added for host '${host_alias}'."
fi
# Create the SSH tunnel.
# Assuming the full hostname is <host_alias>.hpc.irbbarcelona.pcb.ub.es
computed_hostname="${host_alias}.hpc.irbbarcelona.pcb.ub.es"
tunnel_cmd="ssh -f -N -L 2222:${computed_hostname}:22 ${current_user}@irblogin02.sc.irbbarcelona.org"
echo "Establishing SSH tunnel with command:"
echo "${tunnel_cmd}"
docs/Tools/VSCode/cluster_node.md:183
ssh irbccn*is likely to fail because the*will be treated as a shell glob (or passed literally), not as an SSH config pattern selector. Use a concrete host alias (e.g.,ssh irbccn39) or document that users should replace it with their allocated node name.
#### Step 3.1: [LOCAL] [ONE-TIME-STEP] Access through the terminal to the node
To make sure the configuration is working, access the node through the terminal with:
```bash
docs/Tools/VSCode/cluster_node.md:324
- Same issue here:
ssh irbccn*is not a valid way to select a host pattern; users should connect with the specific node alias (e.g.,ssh irbccn25) or substitute the node name explicitly.
#### Step 3.1: [LOCAL] [ONE-TIME-STEP] Access through the terminal to the node
To make sure the configuration is working, access the node through the terminal with:
```bash
docs/Tools/VSCode/cluster_node.md:261
- This SBATCH method also runs SSHD with
-f /dev/nulland uses~/.ssh/id_ecdsaas the host key. Even if this is internal, it’s better to use a dedicated host key file and an explicit sshd config/options to avoid enabling unintended auth methods via defaults and to prevent reusing a personal client key as a server key.
#SBATCH --time=30-00:00:00 # walltime
set -xe
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
I have added a new section (in the form of a pane) with your setup. If you want to recheck it just in case there is something extra to add in that regard feel free to comment again. Thanks! @FedericaBrando |
FedericaBrando
left a comment
There was a problem hiding this comment.
Thanks for adding the setting, I think some customization and disclaimers should be added as well. I advice to use minimal configuration to avoid saturation of the cluster and to avoid failing of sending sbatch job because different people are using the same port on the same node! Thanks, almost there! 🚀
Revise the documentation to reflect changes in the cluster configuration, including updated resource allocation commands and SSH settings for connecting to the IRB cluster.