From c0b343805556ac8ca0885eeac869ff3a8846ff30 Mon Sep 17 00:00:00 2001 From: ZHANG Wentao Date: Thu, 3 Aug 2023 17:31:21 +0800 Subject: [PATCH] docs: update cloudlab.md to reflect recent changes elsewhere --- docs/cloudlab.md | 101 +++++++++++++++++++++++++++++++++-------------- 1 file changed, 71 insertions(+), 30 deletions(-) diff --git a/docs/cloudlab.md b/docs/cloudlab.md index dda2c8c7d4..26700a3f1e 100644 --- a/docs/cloudlab.md +++ b/docs/cloudlab.md @@ -1,15 +1,23 @@ # CloudLab getting started guide -## Create CloudLab experiments +## 1 Prerequisites First, submit an account request to CloudLab (https://www.cloudlab.us/). Things to note: -- Select "Join Existing Project" and type: `Sieve-Acto` +- If you're an internal member, select "Join Existing Project" and type: `Sieve-Acto`. Otherwise, you'll have to join other existing projects or create a new one, which is not detailed here. - The username and key you provide will be used for SSH login Wait for the admin to approve your account. Once you are able to login, familiarize yourself with the web-based dashboard, and [the concept of *profiles* and *experiments*](https://docs.cloudlab.us/basic-concepts.html). -Although you should be able to login onto any machine instantiated by your project collaborators (i.e. a Linux user will be automatically created for you on every machine with `authorized_keys` set up), our current practice is to let everyone run code **on their own experiments**. +Although you should be able to log in to any machine instantiated by your project collaborators (i.e. a Linux user will be automatically created for you on every machine with `authorized_keys` set up), for us (`Sieve-Acto`), the current practice is to let everyone run code **on their own experiments**. + +Next you'll prepare the dependencies either manually ([section 2](#2-manually-set-up-the-dependencies)) or automatically ([section 3](#3-automatically-set-up-the-dependencies), recommended). + +## 2 Manually set up the dependencies + +
Click to show details + +### 2.1 Create CloudLab experiments Launch an experiment via the web dashboard: @@ -18,56 +26,89 @@ Launch an experiment via the web dashboard: - "Select OS image": `UBUNTU 20.04` - "Optional physical node type": `c6420` - Leave other parameters as default. (Especially those regarding temporary filesystem -- we'll deal with it after provisioning using Ansible.) -3. "Next". Give your experiment a name. "Next". "Next". +3. "Next". Give your experiment a name. "Next". "Finish". -Wait for the provisioning to finish. The web dashboard will show you the server address, in the form of `clnodeXXX.clemson.cloudlab.us`. +Wait for the provisioning to finish. The web dashboard will show you the server address, in the form of `..cloudlab.us`. E.g. `clnode123.clemson.cloudlab.us`. -## Configure CloudLab machines +### 2.2 Install dependencies -We are going to manage CloudLab machines with Ansible **from our local machine**. (Ideally this "local machine" can be a CloudLab one too. However, the scripts were not designed to do so and may mess things up. For the time being, minor tweaks are needed in order to let them function properly in such cases.) +We are going to manage CloudLab machines with Ansible from a controller node. This "controller" can be your local machine, or one of the CloudLab machines themselves. -**On your local machine**: +**On your controller node**: -```shell -# -# Install Ansible -# +Install Ansible: +```shell sudo apt update -sudo apt install software-properties-common +sudo apt -y install software-properties-common sudo add-apt-repository --yes --update ppa:ansible/ansible -sudo apt install ansible +sudo apt -y install ansible ansible-galaxy collection install ansible.posix ansible-galaxy collection install community.general +``` -# -# Checkout the repository -# +Clone the Ansible scripts: -cd ~ -git clone https://github.com/xlab-uiuc/acto.git -cd acto/ +```shell +git clone https://github.com/xlab-uiuc/acto-cloudlab.git /tmp/acto-cloudlab +``` -# -# Prepare the CloudLab machine(s) with Ansible -# +Set up `ansible_hosts` file (remember to replace the placeholders with your real domain and user name): -cd scripts/ansible/ -# TODO: replace the placeholders with your real domain and user name you -# obtained or submitted in the previous section +```shell domain="clnodeXXX.clemson.cloudlab.us" user="alice" + +cd /tmp/acto-cloudlab/scripts/ansible/ echo "$domain ansible_connection=ssh ansible_user=$user ansible_port=22" > ansible_hosts +``` + +> If the controller is a CloudLab machine too, this step can be automated: +> +> ```shell +> component_name=$( geni-get portalmanifest | xmlstarlet sel -N x="http://www.geni.net/resources/rspec/3" -t -v "//x:node/@component_id" ) +> cluster_domain=$( echo $component_name | cut -d '+' -f 2 ) +> node_subdomain=$( echo $component_name | cut -d '+' -f 4 ) +> domain="${node_subdomain}.${cluster_domain}" +> user=$( geni-get user_urn | rev | cut -d '+' -f -1 | rev ) +> +> cd /tmp/acto-cloudlab/scripts/ansible/ +> echo "$domain ansible_connection=ssh ansible_user=$user ansible_port=22" > ansible_hosts +> ``` +> +> Or even simpler, use `127.0.0.1` directly: +> +> ```shell +> cd /tmp/acto-cloudlab/scripts/ansible/ +> echo 127.0.0.1 > ansible_hosts +> ``` + +(Only if the controller is a CloudLab machine too) work around the key authentication: + +```shell +ssh-keygen -b 2048 -t rsa -f ~/.ssh/id_rsa -q -N "" && cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys +``` + +Finally, run the Ansible scripts to install dependencies: + +```shell ansible-playbook -i ansible_hosts configure.yaml ``` -## Run Acto +
+ +(Only if the controller is a CloudLab machine too) log out and log in again before jumping to section 4. + +## 3 Automatically set up the dependencies + +TODO + +## 4 Run Acto -Login onto **the CloudLab machine**, and run: +Log in to the CloudLab machine, and run: ```shell -cd ~/acto -pip install -r requirements.txt # FIXME: see #247 +cd ~/workdir/acto make python3 -m acto.reproduce \ --reproduce-dir test/cassop-330/trial-demo \