# Objectives

In this lab, you will set up your lab container to serve the training materials.

# Index page

Go to your student index page, `<yourname>.local.nsrc.org`. You should get the main lab access page.

It’s straightforward to edi this page.

ssh into the training host, then run:

    incus shell <yourname>
    cd /var/www/html
    nano index.html

If “nano” isn’t available, then install it (`apt install nano`) or use a different editor like `vi` if you are familiar with that.

Find the title (`<h1>Campus Network Design and Operations</h1>`) and modify it to include your name.

Save the file (in nano this is ctrl-X, Y (yes), hit Enter when it asks Write to Filename)

Refresh the student index page and see if your change is reflected.

Type “exit” to come out of the shell inside your container, and get back to the outer host.

# Agenda and training materials

## Check the agenda

Go back to your student index page, `<yourname>.local.nsrc.org`

Click on “Agenda” at the top-left.

You should get a “Not Found” error:

> https://<yourname>.local.nsrc.org/current/agenda.html

> The requested URL was not found on this server.

This is because the GNS3 container doesn’t have any training materials.

## Download materials

ssh into the training host.

Create a subdirectory on the training host (not inside your container!) to put the materials, and change directory into it.

    mkdir -p ~/syncthing/<yourname>
    cd ~/syncthing/<yourname>

> Note

> Creating the website on the host, rather than directly inside the container, makes it easier to edit and easier to replicate with syncthing if required.

Inside this directory, fetch and unpack the materials:

    wget https://nsrc.org/activities/agendas/en/cndo/Campus%20Network%20Design%20%26%20Operations%20-%205%20day.zip
    unzip Campus\ Network\ Design\ \&\ Operations\ -\ 5\ day.zip

(Again, if `unzip` is not installed, install it)

Type `ls` to see what you have. You should have the zipfile, and a directory with the same name:

     'Campus Network Design & Operations - 5 day'   'Campus Network Design & Operations - 5 day.zip'

You’re going to move the contents up a level:

    mv Campus\ Network\ Design\ \&\ Operations\ -\ 5\ day/* .
    rmdir Campus\ Network\ Design\ \&\ Operations\ -\ 5\ day/

Now if you type `ls` you should see:

     'Campus Network Design & Operations - 5 day.zip'   agenda.html   css   images   instructor_notes.html   networking   software

Good. This is the content of your workshop.

Next, issue the command to mount this directory inside your lab container:

    incus config device add <yourname> syncthing disk \
      source=/home/<login>/syncthing/<yourname> path=/var/www/html/current readonly=true

where:

- `<login>` is your Unix login name: e.g. if you login to your host with username “nsrc”, then it needs to `/home/nsrc/...etc`
- `<yourname>` is the name you gave to your container

The response should be:

    Device syncthing added to <yourname>

If there’s an error, ask your instructor for help.

## Recheck

Go back to the student index page, and click on “Agenda” again. This time you should see an agenda page with linked materials!

## Edit the agenda

What you see is a generic agenda. Try editing it, using an editor like `nano`:

    cd ~/syncthing/<yourname>
    nano agenda.html

For example, change the instructor name or the time schedule.

Then refresh the page in your web browser, and see if the change is reflected.

# Optional: syncthing

If time is available, you might want to try syncthing.

We are not going to give the full details here, but in summary what you need to do is:

- Install syncthing on your laptop
  - It should open the web interface at http://localhost:8384
- In another browser window, to the host’s syncthing web interface at http://local.nsrc.org:8384
- Add each other as peers
  - On one side, use `Actions > Show ID`
  - On the other side, use `+ Add Remote Device` and paste in the Device ID; set any name that helps you remember what this device is
  - (You may find the devices auto-detect each other, in which case you can just confirm the peer relationship)
- On the host, click `+ Add Folder`
  - Give the folder label as yourname
  - Give the folder path as `/home/<login>/syncthing/<yourname>`
  - Don’t change the folder ID
  - Under the “Sharing” tab, share with your laptop
- On the laptop, accept the share
  - You can choose whatever folder path you like on your laptop

The two sides should now synchronize.

Make a change to agenda.html on your laptop, and the changes should replicate within a few seconds to the host (and vice versa).

The same process would be used to synchronize to `workshops.nsrc.org` if you were running a live workshop with NSRC support.