Skip to content

Update VSCode cluster connection instructions for new configuration#324

Open
CarlosLopezElorduy wants to merge 5 commits into
mainfrom
289-update-vscode-cluster-instructions
Open

Update VSCode cluster connection instructions for new configuration#324
CarlosLopezElorduy wants to merge 5 commits into
mainfrom
289-update-vscode-cluster-instructions

Conversation

@CarlosLopezElorduy
Copy link
Copy Markdown
Member

Revise the documentation to reflect changes in the cluster configuration, including updated resource allocation commands and SSH settings for connecting to the IRB cluster.

Copy link
Copy Markdown
Member

@FedericaBrando FedericaBrando left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_ecdsa

then I run it from the login node with:

sbatch vscode-it

This 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!

🚀 🚀

Copilot AI review requested due to automatic review settings May 12, 2026 23:26
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.md with 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 .gitignore to 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_ecdsa as 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 eval and interpolates unvalidated host_alias into both a grep regex and the command string. This allows unexpected shell/regex injection if the alias contains special characters. Avoid eval, quote variables, and either validate host_alias against 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/null and uses ~/.ssh/id_ecdsa as 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.

Comment thread docs/Tools/VSCode/cluster_node.md
@CarlosLopezElorduy
Copy link
Copy Markdown
Member Author

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

Copy link
Copy Markdown
Member

@FedericaBrando FedericaBrando left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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! 🚀

Comment thread docs/Tools/VSCode/cluster_node.md Outdated
Comment thread docs/Tools/VSCode/cluster_node.md Outdated
Comment thread docs/Tools/VSCode/cluster_node.md Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BBGwiki | [update] Update VSCode in cluster instructions for new cluster

3 participants