Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,6 @@ venv/
assets/unwrap/
*.dot
manifold/
RANDOM
db.sqlite3
django.log
19 changes: 2 additions & 17 deletions code/A5-ping.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,30 +47,15 @@
scheduler = scheduler,
)

##########
# setting up the data interface on both fit01 and fit02
init_node_01 = SshJob(
node = node1,
command = Run("turn-on-data"),
required = check_lease,
scheduler = scheduler,
)
init_node_02 = SshJob(
node = node2,
command = Run("turn-on-data"),
required = check_lease,
scheduler = scheduler,
)

# the command we want to run in node1 is as simple as it gets
ping = SshJob(
node = node1,
# wait for the 2 init jobs instead
# check_release is guaranteed to have completed anyway
required = (init_node_01, init_node_02),
required = (check_lease),
# let's be more specific about what to run
# we will soon see other things we can do on an ssh connection
command = Run('ping', '-c1', '-I', 'data', 'data02'),
command = Run('ping', '-c1', 'fit02'),
scheduler = scheduler,
)

Expand Down
2 changes: 1 addition & 1 deletion code/C1-files.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
verbose = verbose_ssh)

# saying gateway = faraday means to tunnel ssh through the gateway
node1 = SshNode(gateway = faraday, hostname = "fit01", username = "root",
node1 = SshNode(gateway = faraday, hostname = "fit20", username = "root", port = 2222,
verbose = verbose_ssh)

########## create the scheduler instance upfront
Expand Down
43 changes: 42 additions & 1 deletion markdown/tuto-020-shell-tools.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ skip_header: True
<script src="/assets/r2lab/r2lab-diff.js"></script>
<style>@import url("/assets/r2lab/r2lab-diff.css")</style>

<< tuto_tabs "LOG IN":LOGIN "SELECT NODES":NODES "IMAGES": "PHONES": >>
<< tuto_tabs "LOG IN":LOGIN "SELECT NODES":NODES "IMAGES": "PHONES": "BALEINE": >>

<div id="contents" class="tab-content" markdown="1">

Expand Down Expand Up @@ -228,6 +228,13 @@ This command, like all the `rhubarbe`-related commands, has a default timeout, t

rwait --timeout 30

### Using Docker containers with baleine

Baleine is a CLI tool allowing you to deploy Docker images to nodes running on the R2Lab testbed.
The default disk image to use with all the Docker configuration already done is the `baleine` image.

If you want exhaustive information about the different options available in the `baleine` CLI, please check out the [official docs](https://github.com/haysberg/baleine/wiki) on GitHub.


### `ssh`-ing into nodes

Expand All @@ -249,6 +256,10 @@ You can run a command on all selected nodes with

this time of course, you cannot specify another set of nodes than the selection.

If you want to directly access a Bash prompt **inside a Docker container** please connect through port `2222`, like this :

ssh -p 2222 root@fit25

### Saving images

You have the ablility to save the image - this now of course applies only to **one node** at a time. To save node 25
Expand Down Expand Up @@ -287,4 +298,34 @@ to get a reminder.

</div>

<!-- ------- BALEINE ------------>
<div id="BALEINE" class="tab-pane fade" markdown="1">

## Baleine

Baleine is a gateway tool allowing you to deploy Docker containers inside the R2Lab testbed.

We will now demonstrate the deploy subcommand that will be very useful to you :

```
baleine deploy --image faraday.repo/tutorial --nodes 1 2 --options -t -d
```

The `deploy` subcommand allows you to pull and deploy the docker image selected with `--image` on the nodes selected with `--nodes`.
The `--options` option allows you to give an array of argument to pass directly to the Docker Runtime.

The `faraday.repo/tutorial` docker image is based on Ubuntu, so the `-t` and `-d` options are necessary for the Docker image to continue running after initial launch.

To use the Docker container as your server to run the tutorials, please use port `2222` for SSH as `22` is reserved for the host OS.

### Saving Docker images

If you want to save a Docker container that you may have modified from its base image, you can use the [baleine save](https://github.com/haysberg/baleine/wiki/Save-a-custom-container) command.

baleine save --node 1 --name mycustomimage:1.0

[Check out the wiki](https://github.com/haysberg/baleine/wiki) for exhaustive information on the different commands and options available.

</div>

</div> <!-- end div contents -->
69 changes: 47 additions & 22 deletions markdown/tuto-040-A-ping.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,10 @@ in each tutorial.
Before we can run these experiments however, we need to have

* a valid lease set in the booking system
* the 2 nodes `fit01` and `fit02` up and running
* the 2 nodes `fit01` and `fit02` up and running with the `baleine` disk image
* the `faraday.repo/tutorial` Docker image running on the fit nodes

For this first tutorial we will assume that these 2 steps have been
For this first tutorial we will assume that these 3 steps have been
Copy link
Contributor

Choose a reason for hiding this comment

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

if it ain't broke don't fix it; 2 is good enough

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I mean, we now have 3 steps don't we ?

performed manually, and here is how to proceed with that.

### Getting a reservation
Expand All @@ -60,7 +61,7 @@ The code in this tutorial assumes you have a slice named
replace with your actual slice name when trying to run the code
yourself.

### Loading images
### Loading disk images

For loading the images manually on the 2 nodes needed here, please do
this (as usual, make sure to use **your slice name** instead of
Expand All @@ -86,7 +87,7 @@ explained [in the previous tutorial](tuto-020-shell-tools.md):
# select nodes 1 and 2
n 1 2
# load the default image (on the selected nodes)
rload
rload -i baleine
# wait for ssh to be up (still on the selected nodes)
rwait

Expand Down Expand Up @@ -119,27 +120,49 @@ should look like
export NBNODES=2

your_slicename@faraday:~$ rload
16:12:42 - +000s: Selection: fit01 fit02
16:12:42 - +000s: Loading image /var/lib/rhubarbe-images/default.ndz
16:12:42 - +000s: AUTH: checking for a valid lease
16:12:42 - +000s: AUTH: access granted
16:12:42 - +000s: fit02 reboot = Sending message 'on' to CMC reboot02
16:12:42 - +000s: fit01 reboot = Sending message 'on' to CMC reboot01
16:12:43 - +001s: fit02 reboot = idling for 15s
16:12:43 - +001s: fit01 reboot = idling for 15s
16:12:59 - +017s: started <[email protected]:10001 on default.ndz at 500 Mibps>
16:12:59 - +017s: fit01 frisbee_status = trying to telnet..
16:12:59 - +017s: fit02 frisbee_status = trying to telnet..
... <snip>
|############################################################################################|100% |29.56s|Time: 0:00:29
16:13:44 - +062s: fit02 Uploading successful
16:13:44 - +062s: fit02 reboot = Sending message 'reset' to CMC reboot02
16:13:46 - +064s: stopped <[email protected]:10001 on default.ndz at 500 Mibps>
Found binary frisbeed as /usr/sbin/frisbeed
Found binary nc as /usr/bin/nc
09:38:23 - +000s: Selection: fit01 fit02
09:38:23 - +000s: Loading image /var/lib/rhubarbe-images/baleine.ndz
09:38:23 - +000s: AUTH: checking for a valid lease
09:38:23 - +000s: AUTH: access granted
09:38:23 - +000s: fit01 reboot = Sending message 'on' to CMC reboot01
09:38:23 - +000s: fit02 reboot = Sending message 'on' to CMC reboot02
09:38:24 - +001s: fit02 reboot = idling for 30s
09:38:24 - +001s: fit01 reboot = idling for 30s
09:38:55 - +032s: started <[email protected]:10001 on baleine.ndz at 500 Mibps>
09:38:55 - +032s: fit01 frisbee_status = trying to telnet..
09:38:55 - +032s: fit02 frisbee_status = trying to telnet..
09:38:56 - +032s: fit01 frisbee_status = backing off for 4.22s
09:38:56 - +032s: fit02 frisbee_status = backing off for 3.07s
09:38:59 - +035s: fit02 frisbee_status = trying to telnet..
09:38:59 - +036s: fit02 frisbee_status = backing off for 1.61s
09:39:00 - +036s: fit01 frisbee_status = trying to telnet..
09:39:00 - +037s: fit01 frisbee_status = starting frisbee client
09:39:01 - +037s: fit02 frisbee_status = trying to telnet.. | 0% |0.00s|ETA: --:--:--
09:39:01 - +038s: fit02 frisbee_status = starting frisbee client
09:40:00 - +096s: fit02 reboot = Sending message 'reset' to CMC reboot02#### | 99% |59.46s|ETA: 0:00:00
|############################################################################|100% |59.81s|Time: 0:00:59
09:40:00 - +097s: fit01 reboot = Sending message 'reset' to CMC reboot01
09:40:02 - +099s: stopped <[email protected]:10001 on baleine.ndz at 500 Mibps>

your_slicename@faraday:~$ rwait
<Node fit01>:ssh OK
<Node fit02>:ssh OK

### Loading the Tutorial Docker image

To load Docker image on the fit nodes, we will now use the `baleine` command :

baleine deploy --nodes 1 2 --image faraday.repo/tutorial --options -t -d

Let's give a brief explanation of what we just wrote :
* The `deploy` subcommand allows us to pull an image from a Docker repository and create/launch a container on a fit node.
* The `--nodes` option allows us to mention what nodes we want to target. You can format the nodes just like with the `nodes` command you used before.
* The `--image` argument is the url to pull the image from. This can be from the Faraday repository, GitHub, DockerHub or any public repository. Please not that `faraday.repo` is reachable **ONLY** from the fit nodes.
* The `--options` argument allows to pass specific arguments directly to the Docker daemon running on the fit nodes. By default, if you give no command the `ubuntu` Docker image will stop instantly. To prevent that, we use the `-t -d` options. You can get more details about them [here](https://docs.docker.com/engine/reference/run/).


At this point, both nodes have been loaded with the default image. So
you can log out of `faraday.inria.fr` and go back to your laptop to
run [the tutorial in tab A1](javascript:open_tab('A1')).
Expand Down Expand Up @@ -257,11 +280,13 @@ This materializes the fact that we reach node `fit01` through the
gateway. It also ensures that only one ssh connection gets established
to the gateway, regardless of the number of nodes actually controlled.

Please note that we are using the `container` user in the script to directly connect to the Docker container shell.

**Double check:** Remember that for this to work, you need to have a currently valid slice (and to use it with the `--slice` option if needed), and you need `fit01` to be up and running.

### The code

<< codeview A3 A3-ping.py previous=A2-ping.py >>
<< codeview A3 A3-ping-docker.py previous=A2-ping.py >>

### Sample output

Expand Down Expand Up @@ -349,7 +374,7 @@ for an example of that feature.

### The code

<< codeview A4 A4-ping.py previous=A3-ping.py graph=A4.png >>
<< codeview A4 A4-ping-docker.py previous=A3-ping-docker.py graph=A4.png >>

### Sample output

Expand Down
1 change: 1 addition & 0 deletions r2lab/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@
ALLOWED_HOSTS = [
'r2lab.inria.fr',
'localhost',
'127.0.0.1'
]

# Application definition
Expand Down