Skip to content

Login Node

The login node is a machine where SOCA users can SSH in to access their SOCA environment. It's a regular compute node, meaning you have access to the filesystem or scheduler commands (qsub, qstat, qdel ...).

Add/Remove Login Node(s)

Login Nodes are configured as part of an auto-scaling group, meaning you can have 1 or more login node(s) in your SOCA environment.

To add/remove login node(s), navigate to EC2 Console > AutoScaling Group, find the AutoScaling Group associated to the Login Node(s) then change the Desired Capacity to the number of login node(s) you want to use.

Login nodes are standard compute nodes. The only difference is the generation of static SSH keys to avoid SSH fingerprint warnings when we add/remove nodes from the ASG pool.

Tip

Whether you have 1 or more login nodes, accessing them will always be done via the same load balancer DNS name.

graph LR
    A[User] --SSH--> B[SOCA SSH Load Balancer]
    B-->C[Login Node 1]
    B-->D[Login Node 2]
    B-.->E[Login Node N]

Bootstrap Code:

user_data.sh

Important

User Data is limited to 16kb size. It's not recommended to change the content of this file.

This is the default EC2 User Data generated at instance launch via /apps/soca/CLUSTER_ID/cluster_manager/orchestrator/cloudformation_builder.py and is located inside the /apps/soca/CLUSTER_ID/cluster_node_bootstrap/compute_node/ folder. This script only prepare the machine by installing/upgrading awscli and performing some filesystem operations.

setup.sh

This file is responsible for the main setup phase of your node. Template is located on /apps/soca/CLUSTER_ID/cluster_node_boostrap/compute_node. This file can be updated post-SOCA deployment.

setup_post_reboot.sh

This file is responsible for the main setup phase and is executed after the first reboot triggered by setup.sh. Template is located on /apps/soca/CLUSTER_ID/cluster_node_boostrap/compute_node. This file can be updated post-SOCA deployment.

setup_user_customization.sh

This file is the perfect place if you want to add your own set of configuration while not touching the existing node bootstrap sequence. Template is located on /apps/soca/CLUSTER_ID/cluster_node_boostrap/compute_node. You can update this file post-SOCA deployment.

Bootstrap Sequence

sequenceDiagram
  autonumber
  SOCA Admin->>installer/resources/src/cdk_construct.py: Launch soca_installer.sh
  loop
     installer/resources/src/cdk_construct.py->>installer/resources/src/cdk_construct.py: Render 01_user_data.sh from 01_user_data.sh.j2 
  end 
  Note right of installer/resources/src/cdk_construct.py: Template rendered using Jinja2  
  installer/resources/src/cdk_construct.py->>EC2 Login Node: Launch EC2 Login Node and assign 01_user_data.sh as UserData
  loop
      EC2 Login Node->>EC2 Login Node: Execute 01_user_data.sh
      EC2 Login Node->>EC2 Login Node: Render setup.sh.j2
      EC2 Login Node->>EC2 Login Node: Execute setup.sh
  end 

Info

setup.sh is rendered from /apps/soca/CLUSTER_ID/cluster_node_bootstrap/compute_node/setup.sh.j2 using Jinja2 via /apps/soca/<CLUSTER_ID>/cluster_manager/tools/j2generator

Note

Unlike HPC/Virtual Desktop nodes, there is no PostReboot actions for login nodes, as actions performed via /apps/soca/CLUSTER_ID/cluster_node_bootstrap/compute_node/setup_post_reboot.sh are specific to HPC jobs of Virtual destkop nodes.

Bootstrap Flow

  graph TD;
      A[SOCA EC2 Node Provisioned] --> B{Architecture?};
      B-- x86_64 -->C[Install x86_64 packages];
      B-- aarch64 -->D[Install aarch64 packages];
      C-->E{Check Node Type};
      D-->E;
      E--Login Node-->G[Login Node Extra Scripts];
      G-->H[Common scripts];
      H-->I[Login Node Ready]  

Customize Login Node Bootstrap Code

We recommend you to add your customizations to /apps/soca/CLUSTER_ID/cluster_node_boostrap/compute_node/setup_user_customization.sh.j2. Alternatively, you can update /apps/soca/CLUSTER_ID/cluster_node_boostrap/compute_node/setup.sh.j2.

This file is common to HPC nodes, Virtual Desktop nodes and Login Nodes. Use the following condition if you want to limit your changes to only apply to Login Nodes:

{% if context.get("/job/NodeType") == "login_node" %}
  echo "This code is only executed on Login Node"
{% endif %}

Danger - Read me

Modifying a file under /cluster_node_boostrap has immediate effect and will not require any service restart.

Any error in your script may prevent SOCA to successfully provision capacity. If you suspect an error, check the logs mentioned below.

Always create a backup of the file before modifying it.

Do not edit 01_user_data.sh.j2 unless you can confirm the rendered file will be less than 16kb after your modifications.

If you need to edit the UserData post-SOCA deployment, navigate to EC2 Console > Launch Template and create a new version of the Login Node launch template using the updated UserData.

View Login Node Logs

Depending the operating system, UserData log can be found on the same host under:

  • /var/log/cloud-init.log
  • /var/log/cloud-init-output.log
  • /var/log/message

setup.sh logs can be found on the shared filesystem: /apps/soca/CLUSTER_ID/cluster_node_boostrap/logs/login_node