Skip to content

Commit d587f70

Browse files
committed
clean up training development
1 parent 743bdb1 commit d587f70

1 file changed

Lines changed: 65 additions & 50 deletions

File tree

pages/training-development.md

Lines changed: 65 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,40 @@ title: Training development instructions
33
description: How to set up and prepare a BioShell training environment for the BioCommons Training Cooperative, including VM configuration, CVMFS use, trainee directory layout, and pre-snapshot requirements.
44
---
55

6-
{% include callout.html type="warning" content="**Draft:** These instructions are a work in progress. If anything is unclear, reach out to Mitchell directly. Feedback is very welcome." %}
6+
{% include callout.html type="warning" content="These instructions are a work in progress. If anything is unclear, reach out to the training team directly. We appreciate your support in making these as simple to follow as possible, and feedback is very welcome." %}
77

8-
This guide is for **training developers** (`tdevNN` users) who are setting up BioShell training environments for the BioCommons Training Cooperative. You will configure tools, build training materials, and prepare a template that gets automatically applied to trainee accounts when VMs are provisioned. When a VM is built from your snapshot by Giorgia or Mitchell, the provisioning script runs automatically: the trainee's username will be `userNN` (for example `user1`), their password is generated deterministically from their username and is unique per VM, the contents of `/etc/skel/` at snapshot time become the trainee's home directory, and `/etc/skel/` is cleared afterwards to reduce VM image size.
8+
This guide is for **training developers** who are setting up BioShell training environments for the BioCommons Training Cooperative. You will configure tools, build training materials, and prepare a template that gets automatically applied to trainee accounts when VMs are provisioned.
99

10+
{% include callout.html type="important" content="**New to this? Key terms used throughout this guide:**<br><br>**VM (virtual machine)** — a virtual computer provisioned in the cloud that you log into and configure. Each training developer gets a dev VM, and each trainee gets their own VM built from it.<br><br>**Snapshot** — a saved image of a VM's disk at a point in time. Once your dev VM is set up exactly how you want it, it is *snapshotted* so that identical trainee VMs can be built from that image.<br><br>**Template (`/etc/skel/`)** — the skeleton directory whose contents are copied into every new user's home directory when their account is created. Whatever you place in `/etc/skel/` is exactly what trainees see on first login.<br><br>**Provisioning script** — the script that runs automatically when a trainee VM is built. It creates the `userNN` account, sets a password, and populates the home directory from `/etc/skel/`.<br><br>**CVMFS** — a read-only, on-demand network file system providing bioinformatics tools and reference data. Content used from CVMFS does not count against your VM's disk budget.<br><br>**Symlink** — a pointer to a file stored elsewhere (for example on CVMFS), used instead of copying large files into the trainee directory.<br><br>**shelley** — a helper for finding and installing containerised tools from CVMFS as loadable modules.<br><br>**cloud-init** — the service that configures a VM on first boot (hostname, network, datasource). It must be checked before snapshotting." %}
1011

11-
## VM setup and access {#vm-setup}
12+
## How it works {#how-it-works}
13+
14+
At a high level, preparing a training environment follows five steps:
15+
16+
1. **Get a dev VM** and log in (see [VM setup and access](#vm-setup)).
17+
2. **Build and test** your training materials in your home directory, using CVMFS tools and references wherever possible (see [Developing training materials](#developing-materials)).
18+
3. **Assemble the template** by copying your home directory into `/etc/skel/`, so every trainee starts with an identical setup (see [Assemble the template](#assemble-template)).
19+
4. **Complete the pre-snapshot checks** so trainee VMs build correctly (see [Pre-snapshot requirements](#pre-snapshot)).
20+
5. **Request a snapshot.** Trainee VMs are then built from that snapshot.
21+
22+
When a trainee VM is built from your snapshot, the provisioning script runs automatically and:
23+
24+
- creates the trainee's account, with username `userNN` (for example `user1`)
25+
- sets a password that is derived deterministically from the username and is unique per VM
26+
- copies the contents of `/etc/skel/` (as it was at snapshot time) into the trainee's home directory
27+
- clears `/etc/skel/` afterwards to reduce the VM image size
28+
29+
30+
## 1. VM setup and access {#vm-setup}
1231

1332
### Launch a VM instance
1433

15-
VM instances are provisioned by Giorgia or Mitchell. Each dev machine is named with the prefix `D` followed by a number (for example `D1`).
34+
VM instances are provisioned by the training VM manager. Each dev machine is named with the prefix `D` followed by a number (for example `D1`).
1635

1736

1837
### Log in via SSH
1938

20-
The training team will provide you with a username and IP address. Your username follows the format `tdevNN`, where `NN` matches your VM's prefix number.
39+
The training team will provide you with a username and IP address. Your username follows the format `tdevNN`, where `NN` matches your VM's prefix number (for example, on VM `D1` your username is `tdev1`).
2140

2241
```bash
2342
ssh tdevNN@<IP_Address>
@@ -35,18 +54,18 @@ Once you have an active SSH connection, open your browser and go to:
3554
Replace `<IP_Address>` with the IP address provided by the training team.
3655

3756

38-
## Developing training materials {#developing-materials}
57+
## 2. Developing training materials {#developing-materials}
3958

4059
Set up your home directory (`/home/tdevNN`) exactly as you want trainees to experience it. Build and test your workflows there, using CVMFS containers and references throughout. The goal is a working, self-contained environment that a trainee could follow from start to finish.
4160

42-
{% include callout.html type="tip" content="**Keep data small:** When the Australian BioCommons dataset repository is ready, it will be the main access point for training data. Like CVMFS, data stored there will not count against VM size. Until then, use the minimum input data needed to demonstrate the workflow. If your ideal dataset is too large to copy to every trainee home directory, see [If resources are not available on CVMFS](#non-cvmfs) for how to pull it at boot time instead." %}
61+
{% include callout.html type="tip" content="**Keep data small:** Small training datasets are best practice regardless of VM size — they download and run quickly, so trainees spend their time learning rather than waiting, and the workflow fits comfortably within a workshop session. Use the minimum input data needed to demonstrate the workflow. When the Australian BioCommons dataset repository is ready, it will be served over CVMFS (like the Galaxy reference repositories), so data accessed from it will not count against VM size. Until then, if your ideal dataset is too large to copy into every trainee home directory, see [If resources are not available on CVMFS](#non-cvmfs) for how to pull it at boot time instead." %}
4362

4463
Once everything works end-to-end, your home directory becomes the template.
4564

4665

4766
### Disk budget {#disk-budget}
4867

49-
The base VM template takes up approximately **12 GB** on a **30 GB** disk, leaving roughly **16 GB** of usable space. That space has to cover:
68+
The base VM template takes up approximately **13 GB** on a **30 GB** disk, leaving roughly **16 GB** of usable space. That space has to cover:
5069

5170
- Training materials saved in the template directory (`/etc/skel/`)
5271
- CVMFS-cached container layers and reference data (written to the CVMFS cache on first use)
@@ -65,7 +84,7 @@ Example output:
6584
```
6685
Filesystem Size Used Avail Use% Mounted on
6786
tmpfs 197M 1.1M 196M 1% /run
68-
/dev/vda2 30G 12G 17G 43% /
87+
/dev/vda2 30G 14G 17G 43% /
6988
tmpfs 984M 0 984M 0% /dev/shm
7089
tmpfs 5.0M 0 5.0M 0% /run/lock
7190
tmpfs 197M 16K 197M 1% /run/user/1000
@@ -78,27 +97,25 @@ sudo apt clean # Clear apt cache (~640 MB saving)
7897
sudo rm -rf /root/.cache/go-build # Clear Go build cache (~490 MB)
7998
sudo rm -rf /tmp/* /var/tmp/* # Clear temp files
8099
sudo journalctl --vacuum-size=50M # Trim system logs
100+
sudo cvmfs_config wipecache # CVMFS will automatically refill it with the files as needed
81101
```
82102

83103
### Using CVMFS resources {#cvmfs}
84104

85-
CVMFS gives you read-only, on-demand access to reference data and Singularity containers. Importantly, CVMFS does not count against your disk budget, so you should always prefer CVMFS resources over local copies wherever possible.
105+
CVMFS gives you read-only, on-demand access to reference data and Singularity containers. Because it does not count against your disk budget, always prefer CVMFS resources over local copies wherever possible.
86106

87107
For a full walkthrough of what is available and how to use it, see the [CVMFS and reference data guide](tools).
88108

89-
#### Finding and installing tools with shelley-bio
109+
#### Finding and installing tools with shelley
90110

91-
Use `shelley-bio` to search for and install tools from CVMFS-hosted Singularity images:
111+
Use `shelley` to search for and install tools from CVMFS-hosted Singularity images:
92112

93113
```bash
94114
# Search for available tools
95-
shelley-bio find <toolname>
96-
97-
# List available versions
98-
shelley-bio versions <toolname>
115+
shelley find <toolname>
99116

100117
# Build a module-loadable tool via its CVMFS container
101-
shelley-bio build <toolname>
118+
shelley build <toolname>
102119
```
103120

104121
#### Symlinking reference data from CVMFS {#symlinking}
@@ -120,7 +137,7 @@ ln -s /cvmfs/data.galaxyproject.org/byhand/CHM13_T2T_v2.0/seq/CHM13_T2T_v2.0.fa
120137

121138
### RStudio and JupyterLab environments {#interactive-envs}
122139

123-
If your training module uses RStudio or JupyterLab, any R packages, Python packages, or Jupyter kernels you install are written to your home directory and follow the same `/etc/skel/` workflow as everything else.
140+
If your training module uses RStudio or JupyterLab, any R packages, Python packages, or Jupyter kernels you install are written to your home directory, so they follow the same `/etc/skel/` workflow as everything else. Save notebooks in the state you want trainees to open them in — for example, clear all cell outputs so each notebook starts fresh.
124141

125142
#### R packages
126143

@@ -157,7 +174,7 @@ du -sh ~/.local/
157174

158175
### If resources are not available on CVMFS {#non-cvmfs}
159176

160-
If a required container or reference dataset is not on CVMFS and is too large to include directly in the trainee directory, it needs to be fetched at boot time via the VM provisioning script. Prepare the required scripts and share them with Giorgia or Mitchell.
177+
If a required container or reference dataset is not on CVMFS and is too large to include directly in the trainee directory, it needs to be fetched at boot time via the VM provisioning script. Prepare the required scripts and share them with the training VM manager.
161178

162179

163180
#### Adding a pull step to the provisioning script
@@ -179,9 +196,13 @@ Resources pulled this way will appear in the correct location in the trainee's h
179196
{% include callout.html type="note" content="Boot-time pulls count toward your disk budget. Factor their size into your 30 GB total." %}
180197

181198

199+
## 3. Assemble the template {#assemble-template}
200+
201+
With your workflow tested and working, package your home directory into the template (`/etc/skel/`) that every trainee VM is built from.
202+
182203
### Trainee directory layout {#directory-layout}
183204

184-
Organise your home directory to reflect what trainees should see when they first log in. A typical layout might look like this:
205+
Organise your home directory to reflect what you want trainees to see when they first log in. For example:
185206

186207
```
187208
~/
@@ -194,9 +215,9 @@ Organise your home directory to reflect what trainees should see when they first
194215
└── results/ # Empty output directory for trainee use
195216
```
196217

197-
Not every module will need all of these folders. Only include what is relevant.
218+
Not every module will need all of these folders. Only include what is relevant. The next section covers copying this directory into the template.
198219

199-
#### Copy your directory into the template
220+
### Copy your directory into the template
200221

201222
Before copying, check how large your home directory is:
202223

@@ -226,30 +247,34 @@ Once you are confident the template is correct, you can clean up your own home d
226247
rm -rf ~/*
227248
```
228249

229-
{% include callout.html type="tip" content="Ask Giorgia or Mitchell to take a snapshot at key checkpoints if you want a backup before making significant changes." %}
250+
{% include callout.html type="tip" content="Ask the training VM manager to take a snapshot at key checkpoints if you want a backup before making significant changes." %}
230251

231252

232-
## Pre-snapshot requirements {#pre-snapshot}
253+
## 4. Pre-snapshot requirements {#pre-snapshot}
233254

234255

235256
### Cloud-init datasource check {#cloud-init}
236257

237-
Running `apt upgrade` during VM setup can silently change cloud-init configuration, which causes all VMs built from your snapshot to inherit the wrong hostname. Please check and fix this before asking the VM to be snapshot.
238-
239-
240-
#### Step 1: Check for the offending apt file
258+
Running `apt upgrade` during VM setup can silently change the cloud-init configuration, which causes all VMs built from your snapshot to inherit the wrong hostname. Check for this before requesting a snapshot:
241259

242260
```bash
243261
ls /etc/cloud/cloud.cfg.d/
244262
```
245263

246-
A working VM should only contain `05_logging.cfg` and `README`. If `90_dpkg.cfg` is present, remove it:
264+
A working VM contains only `05_logging.cfg` and `README`. If that is all you see, no action is needed — continue to the [pre-snapshot checklist](#checklist).
265+
266+
If `90_dpkg.cfg` is also present, `apt` has modified the cloud-init configuration and you must repair it using the steps below before snapshotting.
267+
268+
<details markdown="1" id="cloud-init-fix">
269+
<summary>Fix: <code>apt</code> has changed the cloud-init configuration</summary>
270+
271+
**1. Remove the offending apt file**
247272

248273
```bash
249274
sudo rm /etc/cloud/cloud.cfg.d/90_dpkg.cfg
250275
```
251276

252-
#### Step 2: Verify the datasource order
277+
**2. Verify the datasource order**
253278

254279
```bash
255280
cat /etc/cloud/cloud.cfg | grep -A5 "datasource_list"
@@ -263,33 +288,21 @@ datasource_list:
263288
- OpenStack
264289
```
265290
291+
**3. Clean cloud-init state**
266292
267-
#### Step 3: Clean cloud-init state
293+
`cloud-init clean` deletes `/etc/cloud/ds-identify.cfg`, so you will need to recreate it afterwards.
268294

269295
```bash
270296
sudo cloud-init clean --logs
271-
```
272-
273-
{% include callout.html type="important" content="`cloud-init clean` deletes `/etc/cloud/ds-identify.cfg`." %}
274-
275-
You will need to recreate it:
276-
277-
```bash
278297
sudo tee /etc/cloud/ds-identify.cfg << 'EOF'
279298
policy: enabled
280299
EOF
281-
```
282-
283-
Verify it looks right:
284-
285-
```bash
286300
cat /etc/cloud/ds-identify.cfg
287301
```
288302

289-
Expected output: `policy: enabled`
290-
303+
The final command should print `policy: enabled`.
291304

292-
#### Step 4: Confirm the datasource
305+
**4. Confirm the datasource**
293306

294307
```bash
295308
sudo cloud-init init
@@ -302,20 +315,22 @@ Look at the `detail` line in the output. It should read `DataSourceOpenStackLoca
302315
detail: DataSourceOpenStackLocal [net,ver=2]
303316
```
304317

305-
If it reads `DataSourceNoCloud`, work through Steps 1 to 4 again. If it still does not resolve, contact Mitchell or Giorgia.
318+
If it reads `DataSourceNoCloud`, work through these steps again. If it still does not resolve, contact the training team.
319+
320+
</details>
306321

307322
### Pre-snapshot checklist {#checklist}
308323

309324
Run through this before taking any snapshot:
310325

311326
- [ ] Workflow tested end-to-end from a trainee's perspective
312-
- [ ] All tools use CVMFS Singularity containers installed via `shelley-bio` where available
327+
- [ ] All tools use CVMFS Singularity containers installed via `shelley` where available
313328
- [ ] All references point to CVMFS paths or symlinks where available
314329
- [ ] Input data is as small as practical
315330
- [ ] `du -sh /home/<username>/` confirms the directory size is acceptable
316-
- [ ] Any non-CVMFS resources that are too large to bundle have been prepared as provisioning script pull steps and shared with Giorgia or Mitchell
331+
- [ ] Any non-CVMFS resources that are too large to bundle have been prepared as provisioning script pull steps and shared with the training VM manager
317332
- [ ] `sudo cp -r /home/<username>/. /etc/skel/` completed successfully
318333
- [ ] `/etc/skel/` contents verified before snapshotting
319334
- [ ] All symlinks in `/etc/skel/` point to CVMFS paths or relative paths (no absolute paths into `/home/tdevNN/`)
320-
- [ ] Total estimated disk usage (base ~12 GB + skel + boot-time pulls) is comfortably under 30 GB
335+
- [ ] Total estimated disk usage (base ~14 GB + skel + boot-time pulls) is comfortably under 30 GB
321336
- [ ] `/etc/cloud/ds-identify.cfg` is present and reads `policy: enabled`

0 commit comments

Comments
 (0)