Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improvements to workers' deployment documentation #82

Open
wants to merge 22 commits into
base: feature/remote-worker
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 18 commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
f8078bc
Added dependencies session and added some commands to worker deployme…
wesleymonte May 12, 2020
0b42475
Added info about coordination host in the worker deploy doc
wesleymonte May 12, 2020
257228b
Refactored README.md from worker deployment
wesleymonte May 13, 2020
55632da
Added image about worker node deployment
wesleymonte May 13, 2020
c6e2176
Added session on how to create a key pair in the worker deployment doc
wesleymonte May 13, 2020
abbff2e
Added session about minimum requirements of host in the worker deploy…
wesleymonte May 13, 2020
cadcb13
Remove ansible files path field from hosts.conf in the worker/deploy
wesleymonte May 13, 2020
4b360aa
Added numbering for sessions in the worker deployment doc
wesleymonte May 13, 2020
ab53252
Removed underlines from README.md in the worker/deploy
wesleymonte May 13, 2020
b37de43
Removed values from field in the config template
wesleymonte May 13, 2020
8a5f5f4
Added info about security group in the worker deployment doc
wesleymonte May 13, 2020
f2b2539
Batch of fix in the worker deployment doc
wesleymonte May 14, 2020
aecc127
Updated create RSA Key pair session from worker deployment doc
wesleymonte May 14, 2020
dd5bc4f
Added comments in the hosts.conf from worker/deploy
wesleymonte May 14, 2020
e3085ea
Added an introduction to the worker deployment doc
wesleymonte May 14, 2020
6b1cabb
Updated infrastructure session from worker deployment doc
wesleymonte May 14, 2020
2996151
Updated 'Fill configuration file' session from worker deployment doc
wesleymonte May 14, 2020
2a42c29
Fixed host.conf example from worker deployment doc
wesleymonte May 14, 2020
5324b1e
Removed unecessary notes in the check session from worker deployment doc
wesleymonte May 14, 2020
a0a2374
Added note about private key and fixed text in the worker readme
wesleymonte May 15, 2020
05d6d02
Update README.md
thiagomanel May 19, 2020
f07b4c3
Improved worker deployment image
thiagoyeds Nov 16, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added imgs/wd.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
146 changes: 126 additions & 20 deletions worker/deploy/README.md
Original file line number Diff line number Diff line change
@@ -1,47 +1,153 @@
# Worker Node deployment
# Worker Node Deployment

Arrebol tasks are processed by the Workers. In a typical deployment, multiple Workers are deployed together in a single virtual machine, a `Worker Node`. As each task run in an isolated docker container, the Docker engine and other dependencies must have be installed and configured in the Worker Node. Below, we detail the configuration procedure.
This document provides instructions for deploying worker nodes. It was designed to facilitate the deployment of worker nodes over multiple machines.
wesleymonte marked this conversation as resolved.
Show resolved Hide resolved

## Requeriments
## **Overview**

Before the configuration and installation of Worker Node dependencies, each Worker Node virtual machine should be configured to be reached via SSH (using a rsa key pair). Also, the [Ansible](https://www.ansible.com/) automation tool should be installed in the deploy `coordination host`. This host is a machine that commands that deploy. To this end, the `coordination host` should be able to access the Worker Node through SSH.
### _Worker Node_

To install Ansible run these commands:
**Worker Node** is the host where workers live. You need to deploy at least one worker node for Arrebol.

### _Coordination Host_

The **coordination host** is a machine from which scripts are executed to deploy worker nodes. The coordination host must have access to worker nodes via **SSH (using a rsa key pair)** to perform its function.

![Worker Deployment](../../imgs/wd.png)
Copy link
Member

Choose a reason for hiding this comment

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

edit this figure. it has three boxes. We need only the left-most box. below the worker nodes use the following pattern: VM N/Worker Node N

Copy link
Collaborator

Choose a reason for hiding this comment

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

done


## **Infrastructure**

You will need at least two hosts: **a coordination host** and **a worker node**. At the end of the deployment, the coordination host is no longer needed.

### _Worker Node_

#### Requirements

The requirements of the Worker Node depend a lot on the workload of the Jobs you intend to submit to Arrebol. Below is a minimum standard recommendation:

- vCPU: 2
- RAM: 2GB
- FREE DISK SPACE: 10GB
- OS: Ubuntu 16 or higher

#### Security Group

* Custom TCP Rule to allow ingress in the port 5555 (Docker API)
* Custom TCP Rule to allow ingress in the port 22 (SSH)

### _Coordination Host_

#### Requirements
- vCPU: 1
- RAM: 1GB
- FREE DISK SPACE: 10GB
- OS: Ubuntu 16 or higher

#### Security Group

* Custom TCP Rule to allow egress in the port 22 (SSH)

## **Setup**

### _1.Create RSA Key Pair_

`Note: If you already have a key pair configured between the coordination host and the worker nodes go to Install dependencies.`

Log into the coordination host, and then use command-line SSH to generate a key pair using the RSA algorithm.
To generate RSA keys, on the command line, enter:

```bash
mkdir -p ~/.ssh
cd ~/.ssh
ssh-keygen -t rsa -N "" -f coordination_host_key
chmod 600 coordination_host_key
```
If the commands were successful we will have two new files in the **~/.ssh** directory:
* **coordination_host_key**: The private key. It authenticates the coordination host. Ansible uses this key to access worker nodes.
* **coordination_host_key.pub**: The public key. It authorizes the coordination host to access the worker node. Its content must be in the authorized keys of each worker node.

To coordination host have authorization to access worker node via SSH the public key (**coordination_host_key.pub**) must be copied in an **authorized keys file** from worker node.

Then, log into the worker node machine and create a copy of the public key as you see fit. The commands below write the public key into **authorized_keys** of worker node considering that it is in the home directory.
```bash
mkdir -p ~/.ssh
touch ~/.ssh/authorized_keys
cat ~/coordination_host_key.pub >> ~/.ssh/authorized_keys
wesleymonte marked this conversation as resolved.
Show resolved Hide resolved
```



### _2.Install dependencies_

Log in the coordination host and run the following commands to install dependencies.
wesleymonte marked this conversation as resolved.
Show resolved Hide resolved

```
sudo apt update
sudo apt install software-properties-common
sudo apt-add-repository --yes --update ppa:ansible/ansible
sudo apt install -y ansible
sudo apt install -y ansible git grep sed
```

`Note: The deployment requires versions newer than 14 for ubuntu.`
### _3.Download the repository_

## Configuration
Log in the coordination host and run the below commands to download the arrebol repository.
wesleymonte marked this conversation as resolved.
Show resolved Hide resolved

The `hosts.conf` configuration file should be edited to declare the Worker Node. See below how to edit it.
```bash
git clone -b feature/remote-worker https://github.com/ufcg-lsd/arrebol.git
```

### _4.Fill configuration file_

Go to the directory _worker/deploy_ inside _arrebol_ directory.
wesleymonte marked this conversation as resolved.
Show resolved Hide resolved

### Example
```bash
cd arrebol/worker/deploy
```
worker_ip_1=10.30.1.36
worker_ip_2=10.30.1.37

remote_user=ubuntu
Then, edit the `hosts.conf` file present in this directory, as follows.\
**All fields of the files must be filled**. See below how to edit it.

ansible_ssh_private_key_file=/home/admin/.ssh/priv_key
#### Hosts configuration

# Default
ansible_files_path=./ansible-playbook
File: host.conf
```
# For each worker node write a field started by `worker_ip`
wesleymonte marked this conversation as resolved.
Show resolved Hide resolved
# In this example, there will be 2 worker nodes.

worker_ip_1=
worker_ip_2=

## Install
remote_user=

ansible_ssh_private_key_file=
```

| Field | Description |
wesleymonte marked this conversation as resolved.
Show resolved Hide resolved
|:---------------------------------:|----------------|
| **worker_ip** | The **worker node** addresses. For each ip create a field beginning with **_worker_ip_**. |
| **remote_user** | The user name that should be used to access the **worker nodes** via ssh. |
| **ansible_ssh_private_key_file** | The path to the **coordination host private key** that will be used to access worker nodes via ssh |

Considering that this user name is **ubuntu**, your worker nodes are **10.30.1.1** and **10.30.1.2**, and the private key are in the **~/.ssh/coordination_host**. The content of the **host.conf** file would be:

```
worker_ip_1=10.30.1.1
worker_ip_2=10.30.1.2

remote_user=ubuntu

ansible_ssh_private_key_file=~/.ssh/coordination_host
```

### _5.Install_

After configuring the `hosts.conf` file, execute the `install.sh` script in the coordination host to setup the Worker Node.

```
sudo bash install.sh
```

## Check
## **Check**


To verify whether the worker deployment was successful, one can submit below sample requests to the docker api.

Expand All @@ -50,12 +156,12 @@ To verify whether the worker deployment was successful, one can submit below sam
`Note 2: If you use a cloud provider you may need to add a firewall rule.`

---
Request
### Request
```bash
curl http://<worker-address>:5555/version
```

Expected
### Expected
```json
{
"Platform": {
Expand Down
6 changes: 3 additions & 3 deletions worker/deploy/hosts.conf
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# For each worker node write a field started by `worker_ip`
Copy link
Member

Choose a reason for hiding this comment

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

is it really anything? or it is a number ranging from 1 until N, where N is the number of workers nodes to be deployed

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is really anything.

# worker_ip[anything]
worker_ip_1=

# The user name that should be used to access the worker nodes via ssh.
remote_user=

# The path to the private key that will be used to access worker nodes via ssh
ansible_ssh_private_key_file=

# Default
ansible_files_path=./ansible-playbook
5 changes: 1 addition & 4 deletions worker/deploy/install.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

readonly ANSIBLE_FILES_PATH_PATTERN="ansible_files_path"
readonly ANSIBLE_HOSTS_FILE="./ansible-playbook/hosts"
readonly PRIVATE_KEY_FILE_PATH_PATTERN="ansible_ssh_private_key_file"
readonly DEPLOYED_WORKER_IP_PATTERN="worker_ip"
readonly DEPLOY_WORKER_YML_FILE="deploy-worker.yml"
Expand All @@ -15,9 +15,6 @@ if [ -z "$MY_PATH" ] ; then
fi

HOSTS_CONF_FILE="${MY_PATH}/hosts.conf"

ANSIBLE_FILES_PATH=$(grep "${ANSIBLE_FILES_PATH_PATTERN}" "${HOSTS_CONF_FILE}" | awk -F "=" '{print $2}')
ANSIBLE_HOSTS_FILE="${ANSIBLE_FILES_PATH}/hosts"
PRIVATE_KEY_FILE_PATH=$(grep "${PRIVATE_KEY_FILE_PATH_PATTERN}" "${HOSTS_CONF_FILE}" | awk -F "=" '{print $2}')

# Clears the worker machine addresses
Expand Down