Skip to content

Commit

Permalink
Started adapting instructions for PDC
Browse files Browse the repository at this point in the history
  • Loading branch information
dahlo committed Oct 28, 2024
1 parent e8bee38 commit 37745b5
Show file tree
Hide file tree
Showing 10 changed files with 99 additions and 77 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,11 @@ docker run --rm --platform linux/amd64 -u $(id -u):$(id -g) -v ${PWD}:/qmd ghcr.

## Serving and automatic rendering

You can use a Flask server to serve the site, and handle automatic rebuilding of pages when any `.qmd` file is changed. The browser has to be refreshed manually though.
You can use `quarto preview` to serve the site, and handle automatic rebuilding of pages when any `.qmd` file is changed.

```bash
# serve the site
docker run --rm --platform linux/amd64 -u $(id -u):$(id -g) -v ${PWD}:/qmd -p 5000:5000 ghcr.io/nbisweden/workshop-ngsintro:latest python3 scripts/serve_quarto.py
docker run --rm --platform linux/amd64 -u $(id -u):$(id -g) -v ${PWD}:/qmd -p 8800:8800 ghcr.io/nbisweden/workshop-ngsintro:latest quarto preview --port 8800 --host 0.0.0.0
```

## Test scripts
Expand Down
6 changes: 3 additions & 3 deletions _quarto.yml
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,9 @@ filters:
- assets/custom.lua
- reveal-logo

# used site-wide wherever uppmax project ids are used
uppmax_project: naiss2024-22-1375
nsc_project: naiss2024-22-1375
# used site-wide wherever project ids are used
project_id: "edu24.uppmax"
backup_project_id: "naiss2024-22-1375"

# location options are linkoping, lund, umea, uppsala or online. For rendering the info page.
# one or more separated by commas or semicolon. online doesn't display any location info.
Expand Down
42 changes: 27 additions & 15 deletions home_precourse.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -11,23 +11,15 @@ format: html
#| include: false
library(yaml)
library(here)
upid <- yaml::read_yaml(here("_quarto.yml"))$uppmax_project
upstore <- yaml::read_yaml(here("_quarto.yml"))$uppmax_storage
project_id <- yaml::read_yaml(here("_quarto.yml"))$project_id
backup_id <- yaml::read_yaml(here("_quarto.yml"))$backup_project_id
```

## PDC

Remote computing cluster Dardel at PDC in Stockholm will be use for data analyses. A PDC account is needed to use these resources.
If you do not already have a PDC account, please fill in the form at [https://blackfish.pdc.kth.se/cgi-bin/accounts/request.py](https://blackfish.pdc.kth.se/cgi-bin/accounts/request.py) **at least 2 weeks before the course start** and use the same email that you applied to the course with. Fill in this information about which course it is:
You will have to have 3 different accounts to complete the labs in this course; one in [SUPR](https://supr.naiss.se/) to handle the two other accounts, and one each at the compute centers [PDC](https://www.pdc.kth.se/) in Stockholm and [UPPMAX](https://uppmax.uu.se) in Uppsala.

| | |
|---|---|
| __Lecturer/ Project Leader:__ | Martin Dahlö |
| __Course / Project Title:__ | edu24.uppmax |
## SUPR

## UPPMAX

Remote computing cluster UPPMAX will be use as a fallback cluster, if there should be any problems at PDC. A SUPR/NAISS account is needed to use these resources. SUPR is also the system that you will handle your own projects in if you want to use them in your research after the course.
A SUPR/NAISS account is needed to create the accounts for the computers we will be using during the course. SUPR is also the system that you will handle your own projects in if you want to use this kind of resources in your research after the course.

If you do not already have one, create an account at [SUPR/NAISS](https://supr.naiss.se). Then, Log in to [SUPR/NAISS](https://supr.naiss.se/), preferably using the SWAMID.

Expand All @@ -39,7 +31,10 @@ Before proceeding with applying for project membership and user accounts, we hav
This is where you might run into trouble if you don't have a SWAMID connected account. You will not be able to accept the user agreement online without it, so you will have to send in your acceptance in paper form together with a copy of your passport. This process can take a week or more, so please make sure you can accept the user agreement in good time.
:::

After making sure you have an accepted user agreement, go to the [**SUPR/NAISS Projects**](https://supr.naiss.se/project/) page and request membership to the project ID: [**`r paste0(upid)`**]{.badge}

## UPPMAX

Remote computing cluster UPPMAX will be use as a fallback cluster, if there should be any problems at PDC. After making sure you have an accepted user agreement, go to the [**SUPR/NAISS Projects**](https://supr.naiss.se/project/) page and request membership to the project ID: [**`r paste0(backup_id)`**]{.badge}

![](assets/images/supr-request.jpg){width="70%"}

Expand All @@ -56,8 +51,25 @@ Checking your request and approving your account requires some manual work, so y
You will get one username & password for the account on UPPMAX, and one username and password for the account on PDC. Please keep track of both, we will tell you when to use which account during the workshop.
:::


## PDC

Remote computing cluster Dardel at PDC in Stockholm will be use for data analyses. A PDC account is needed to use these resources. Normally you would do this the same way as when you applied for the UPPMAX account above, but PDC handles uses for their courses through another system.
If you **do not already have a PDC account**, please fill in the form at [https://blackfish.pdc.kth.se/cgi-bin/accounts/request.py](https://blackfish.pdc.kth.se/cgi-bin/accounts/request.py) **at least 2 weeks before the course start** and use the same email that you applied to the course with. Fill in your personal information, as well as this information about which course it is:

| | |
|---|---|
| __Lecturer/ Project Leader:__ | Martin Dahlö |
| __Course / Project Title:__ | `r paste0(backup_id)` |

We have notified PDC who the students for our course is and they will create the account needed to login to their computers. Follow the instructions you get from them to complete your account creation. The morning session on the Monday of the course will cover [how to connect to PDC](https://www.pdc.kth.se/support/documents/login/ssh_login.html#ssh-login), a bunch of steps that might not be trivial for novice users.

## Install tools

### Eduroam

Please make sure you have a working [Eduroam](https://eduroam.org/) wifi connection setup before the course, since we will only have wifi internet access in the computer room where we have the course. The instructions on how to get it working could differ university to university, so please refere to you home university's instructions on how to do that. Try searching for "eduroam" and your home university, e.g. `eduroam uppsala university`, to find it.

### ThinLinc

[![](assets/images/thinlinc.png){height="50px"}]((https://www.cendio.com/thinlinc/download))
Expand Down Expand Up @@ -102,7 +114,7 @@ Once you have logged in to UPPMAX, run the following command.
#| attr-output: "filename='bash'"
#| class-output: bash
#| echo: false
cat(paste0("mkdir /proj/", upid, "/nobackup/username"))
cat(paste0("mkdir /proj/", backup_id, "/nobackup/username"))
```

This creates a directory with your user name. You will work inside this directory for the workshop. If you cannot write to the folder, the most likely reason is that you have not requested access to the workshop project via SUPR. This is described in step 1 above.
Expand Down
Binary file added topics/other/assets/ssh_keys_pdc_001.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added topics/other/assets/ssh_keys_pdc_002.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added topics/other/assets/ssh_keys_pdc_003.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added topics/other/assets/ssh_keys_pdc_004.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added topics/other/assets/ssh_keys_pdc_005.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
120 changes: 65 additions & 55 deletions topics/other/lab_connect_pdc.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -17,96 +17,106 @@ The reason we will teach you two ways is that some parts of this course will req

## SSH connection

Let's look at the text-based SSH approach first. This type of connection work just fine even on slow internet connections since it only transmitts small amounts of text when you work with it. You will need an SSH program to do this, which fortunately is included in most major operating systems:
Let's look at the text-based SSH approach first. This type of connection work just fine even on slow internet connections since it only transmitts small amounts of text when you work with it. You will need a terminal and an SSH program to do this, which fortunately is included in most major operating systems:

- {{< fa brands linux >}} Linux: Use Terminal (Included by default)
- {{< fa brands apple >}} OSX: Use Terminal (Included by default)
- {{< fa brands windows >}} Windows: Use Powershell or Command prompt, both should be installed by default

::: {.callout-note}
Where `username` is mentioned, change to your user name.
:::
### Setting up SSH keys

Fire up the available SSH program and enter the following:
(If you already have done this once, please proceed to the [next section](#connecting-to-pdc-using-ssh) instead.)

Before you can connect to PDC you will have to create SSH keys and tell PDC which key they should allow you to login with, and which computer it should be allowed to be used from. You will only have to create and register SSH keys once. Start by opening your terminal program (see list above) and follow these steps:

1. Generate a key pair.
```bash
$ ssh [email protected]
ssh-keygen
```
and accept the default names it suggests by just pressing enter on the question about `file in which to save the key`. When it asks for a password, provide the password you will use to unlock the key each time you use it. Repeat the password when asked to in the next question. Once that is done it will say something like

Enter your password when prompted. As you type, nothing will show on the screen. No stars, no dots. It is supposed to be that way. Just type the password and press enter, it will be fine.
```bash
user@computerName ~ $ ssh-keygen
Generating public/private ed25519 key pair.
Enter file in which to save the key (/home/user/.ssh/id_ed25519):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/user/.ssh/id_ed25519
Your public key has been saved in /home/user/.ssh/id_ed25519.pub
The key fingerprint is:
SHA256:6T19rVfxVndEpmHHY0vZc8/Xu03iDBYjS04//rOOvks user@computerName
The key's randomart image is:
+--[ED25519 256]--+
| oo*|
| . @=|
| +oB|
| .+ o oO|
| S+ + o O|
| . .o.= .o=|
| . ooE=.+=|
| o.o+oo|
| .===+ |
+----[SHA256]-----+
```
Now your screen should look something like this:
The cool thing with SSH keys ([public-key cryptography](https://en.wikipedia.org/wiki/Public-key_cryptography)) like this is that they consist of two parts. One is the public key, which you can publish on the internet for everyone to see. The other part is the private part, which should be kept hidden from everyone, like a password. The public key is given to, in this case, PDC and they will let anyone who has the private key in. Print your public key to the terminal and copy the text so that you can use it in the next step.
```bash
cat ~/.ssh/id_ed25519.pub
```
dahlo@dahlo-xps ~ $ ssh [email protected]
Last login: Fri May 18 15:03:59 2018 from mi04.icm.uu.se
_ _ ____ ____ __ __ _ __ __
| | | | _ \| _ \| \/ | / \ \ \/ / | System: rackham4
| | | | |_) | |_) | |\/| | / _ \ \ / | User: dahlo
| |_| | __/| __/| | | |/ ___ \ / \ |
\___/|_| |_| |_| |_/_/ \_\/_/\_\ |
###############################################################################
To register our public key we will go to [PDCs login portal](https://loginportal.pdc.kth.se/). Following a link from that page, you will login by first logging in to your SUPR account and then validating your identity to PDC through SUPR.
User Guides: http://www.uppmax.uu.se/support/user-guides
FAQ: http://www.uppmax.uu.se/support/faq
![](assets/ssh_keys_pdc_001.png)
Write to [email protected], if you have questions or comments.
Press `Add new key`
![](assets/ssh_keys_pdc_002.png)
dahlo@rackham4 ~ $
```

Now you are connected to UPPMAX and can start working.
Paste the public key content you printed to the terminal with `cat` before into the `SSH public key` field in the form, and give a `Key name` of your choosing, then press `Save`.
## Remote desktop
![](assets/ssh_keys_pdc_003.png)
You can work on UPPMAX interactively through a graphical-user-interface (GUI) desktop environment using ThinLinc.
You have now added your public key and told PDC that it should be allowed to login using this key when you are connecting form the IP (`385.142.529.933` in the screenshot above) you have at the moment. Since you might get new IPs for your computer each time you connect to the internet, we will have to add a broader list of allowed IPs for this key. Press `Add address` on the entry for the key you just added.
We have a ThinLinc server running at one of the login nodes which allows users to run a remote desktop. It can be reached from a web browser (Chrome and Firefox are the recommended web browsers) or from the ThinLink App. For more details please look here: <a href="https://uppmax.uu.se/support-sv/user-guides/thinlinc-graphical-connection-guide/" target="_blank" rel="noopener noreferrer">https://uppmax.uu.se/support-sv/user-guides/thinlinc-graphical-connection-guide/</a>
![](assets/ssh_keys_pdc_004.png)
### Web browser
Add `*.liu.se` to the field `define one yourself`. This will allow you to use this key as long as you are connecting from anywhere at Linköping university. If you want to use this key from your home university in the future you can add a similar pattern that matches your home university's (or internet provider) hostname (e.g. `*.uu.se`, `*.kth.se` or `*.telia.com`).

To be able to login via a web browser you will have to set up two-factor authentication first. Follow the <a href="https://www.uppmax.uu.se/support/user-guides/setting-up-two-factor-authentication/" target="_blank" rel="noopener noreferrer">instructions at the UPPMAX homepage</a>, and once you are done you can continue below.
![](assets/ssh_keys_pdc_005.png)

1. Go to the login page, <a href="https://rackham-gui.uppmax.uu.se/" target="_blank" rel="noopener noreferrer">https://rackham-gui.uppmax.uu.se/</a>
2. Enter your UPPMAX username.
3. Enter your UPPMAX password, followed by your current two-factor authentication code.
Eg. if your password is `hunter2` and your current two-factor authentication code is `123456` you will enter `hunter2123456` as your password.

![](assets/thinlinc_00.png){width="200px"}
### Connecting to PDC using SSH

4. It will ask you which profile you want to use, so first press the `Forward` button. Then you can choose which desktop environment you want to use. `Xfce` is pretty straight-forward and easy to use, but feel free to try either of them. You get to choose every time you login so it's not a permanent choice.

![](assets/thinlinc_01.png){width="200px"}
::: {.callout-note}
Where `username` is mentioned, change to your PDC user name.
:::

5. Once your desktop has been loaded, start a terminal either by clicking the black terminal icon at the bottom of the screen, or by pressing the `Applications` button in the top left corner and select `Terminal Emulator`.
Fire up the available SSH program and enter the following:

![](assets/thinlinc_02.png){width="200px"}
```bash
$ ssh [email protected]
```

### ThinLink App
Enter your password when prompted. As you type, nothing will show on the screen. No stars, no dots. It is supposed to be that way. Just type the password and press enter, it will be fine.

1. If you haven't already done so, download the ThinLinc client matching your local computer (i.e Windows, Linux, MacOS X or Solaris) from <a href="https://www.cendio.com/thinlinc/download" target="_blank" rel="noopener noreferrer">https://www.cendio.com/thinlinc/download</a> and install it.
2. Launch the ThinLinc client. You should see a form where you can enter your username and password, and possibly a server name. If you only see this simple form as shown below, you can click **Advanced** to be able to set the server name.
Now your screen should look something like this:

![](assets/thinlinc_03.png){width="200px"}
```bash
user@computerName ~ $ ssh [email protected]
Enter passphrase for key '/home/user/.ssh/id_ed25519':
Last login: Mon Oct 23 21:11:35 2024 from 385-142-529-933.bredband.obe.net
3. Change the **Server** setting to `rackham-gui.uppmax.uu.se`.
4. Change the **Name** setting to your UPPMAX username.
5. Set the **Password** setting to your UPPMAX password.
6. You do not need to change any other settings.
7. You will first come to the `ThinLinc profile chooser`. Press the `Forward` button to continue. Then you can choose which desktop environment you want to use. `Xfce` is pretty straight-forward and easy to use, but feel free to try either of them. You get to choose every time you login so it's not a permanent choice.
8. Press the **Connect** button.
9. If you connect for the first time you will see the "The server's host key is not cached ..." dialog.
--== Welcome to Dardel! ==--
![](assets/thinlinc_01.png){width="200px"}
username@login1 ~ $
```

10. Once your desktop has been loaded, start a terminal either by clicking the black terminal icon at the bottom of the screen, or by pressing the `Applications` button in the top left corner and select `Terminal Emulator`.
Now you are connected to PDC and can start working.

![](assets/thinlinc_02.png){width="200px"}

11. **Two factor authentication:** The ThinLinc client connects over SSH which means it **may** be required to present a two factor authentication code. If you need to use this when logging in with SSH you also need to use it when logging in with ThinLinc (it depends on where you connect from). The ThinLinc client does not know how to ask for the two factor code, so you will need to use the grace time feature. To do this, first you have to connect with regular SSH and present the required two factor code. Once you have logged in over SSH you can safely exit again. The login server will remember that you just logged in for a few minutes and will not ask for two factor authentication again, so make sure you do not wait too long to connect with the ThinLinc client.
## Remote desktop

## After connection to UPPMAX
You can work on PDC interactively through a graphical-user-interface (GUI) desktop environment using ThinLinc.

From this point forward there is no difference between the two different ways of connection to UPPMAX. Both ways result in you having a terminal running on UPPMAX and from UPPMAX point of view they are the same.
We have a ThinLinc server running at one of the login nodes which allows users to run a remote desktop. It can be reached using the ThinLink App. For more details please look here: <a href="https://intra.kth.se/en/2.79567/support/documents/login/interactive_hpc.html" target="_blank" rel="noopener noreferrer">https://intra.kth.se/en/2.79567/support/documents/login/interactive_hpc.html</a>
Loading

0 comments on commit 37745b5

Please sign in to comment.