Skip to main content

Connecting to a Node

Prerequisites

In order to connect to a Node that is performing one of your Jobs, you will need to pass an SSH public key in the parameters object during Job creation. This SSH key will be used to authenticate your connection to the Node.

// POST /v1/jobs

//...other fields,
"parameters": {
"type": "docker",
"parameters": {
"image": "otoy/zernet-base",
"tag": "latest",
"sshkey": "ssh-rsa ... user@host",
"allowed_ips": [
"127.0.0.1/32"
]
}
},

Retrieve the Node URLs

Query for the Job Runs that are associated with your Job. You can do this by sending a GET request to the /v1/jobs-runs endpoint with ?filter[job_uuid]=<job_uuid> as a query string.

GET /v1/jobs-runs?filter[job_uuid]=<job_uuid>

Each Job Run will have a node_urls field that contains an array of URLs that can be used to connect to the Node running the Job.

{
// ...other fields,
"node_urls": [
{
"description": "ssh",
"hostname": "127.0.0.1",
"port": 22,
"protocol": "tcp"
}
]
}

Connect to the Node

Use the information from the node_urls field to connect to the Node. For example, you can use the following command to connect to the Node via SSH:

ssh -p 22 user@hostname -i /path/to/private_key