You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: pages/training-development.md
+65-50Lines changed: 65 additions & 50 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,21 +3,40 @@ title: Training development instructions
3
3
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.
4
4
---
5
5
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." %}
7
7
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.
9
9
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." %}
10
11
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}
12
31
13
32
### Launch a VM instance
14
33
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`).
16
35
17
36
18
37
### Log in via SSH
19
38
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`).
21
40
22
41
```bash
23
42
ssh tdevNN@<IP_Address>
@@ -35,18 +54,18 @@ Once you have an active SSH connection, open your browser and go to:
35
54
Replace `<IP_Address>` with the IP address provided by the training team.
36
55
37
56
38
-
## Developing training materials {#developing-materials}
57
+
## 2. Developing training materials {#developing-materials}
39
58
40
59
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.
41
60
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." %}
43
62
44
63
Once everything works end-to-end, your home directory becomes the template.
45
64
46
65
47
66
### Disk budget {#disk-budget}
48
67
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:
50
69
51
70
- Training materials saved in the template directory (`/etc/skel/`)
52
71
- CVMFS-cached container layers and reference data (written to the CVMFS cache on first use)
sudo journalctl --vacuum-size=50M # Trim system logs
100
+
sudo cvmfs_config wipecache # CVMFS will automatically refill it with the files as needed
81
101
```
82
102
83
103
### Using CVMFS resources {#cvmfs}
84
104
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.
86
106
87
107
For a full walkthrough of what is available and how to use it, see the [CVMFS and reference data guide](tools).
88
108
89
-
#### Finding and installing tools with shelley-bio
109
+
#### Finding and installing tools with shelley
90
110
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:
92
112
93
113
```bash
94
114
# Search for available tools
95
-
shelley-bio find <toolname>
96
-
97
-
# List available versions
98
-
shelley-bio versions <toolname>
115
+
shelley find <toolname>
99
116
100
117
# Build a module-loadable tool via its CVMFS container
101
-
shelley-bio build <toolname>
118
+
shelley build <toolname>
102
119
```
103
120
104
121
#### Symlinking reference data from CVMFS {#symlinking}
### RStudio and JupyterLab environments {#interactive-envs}
122
139
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.
124
141
125
142
#### R packages
126
143
@@ -157,7 +174,7 @@ du -sh ~/.local/
157
174
158
175
### If resources are not available on CVMFS {#non-cvmfs}
159
176
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.
161
178
162
179
163
180
#### 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
179
196
{% include callout.html type="note" content="Boot-time pulls count toward your disk budget. Factor their size into your 30 GB total." %}
180
197
181
198
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
+
182
203
### Trainee directory layout {#directory-layout}
183
204
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:
185
206
186
207
```
187
208
~/
@@ -194,9 +215,9 @@ Organise your home directory to reflect what trainees should see when they first
194
215
└── results/ # Empty output directory for trainee use
195
216
```
196
217
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.
198
219
199
-
####Copy your directory into the template
220
+
### Copy your directory into the template
200
221
201
222
Before copying, check how large your home directory is:
202
223
@@ -226,30 +247,34 @@ Once you are confident the template is correct, you can clean up your own home d
226
247
rm -rf ~/*
227
248
```
228
249
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." %}
230
251
231
252
232
-
## Pre-snapshot requirements {#pre-snapshot}
253
+
## 4. Pre-snapshot requirements {#pre-snapshot}
233
254
234
255
235
256
### Cloud-init datasource check {#cloud-init}
236
257
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:
241
259
242
260
```bash
243
261
ls /etc/cloud/cloud.cfg.d/
244
262
```
245
263
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
+
<detailsmarkdown="1"id="cloud-init-fix">
269
+
<summary>Fix: <code>apt</code> has changed the cloud-init configuration</summary>
`cloud-init clean` deletes `/etc/cloud/ds-identify.cfg`, so you will need to recreate it afterwards.
268
294
269
295
```bash
270
296
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
278
297
sudo tee /etc/cloud/ds-identify.cfg << 'EOF'
279
298
policy: enabled
280
299
EOF
281
-
```
282
-
283
-
Verify it looks right:
284
-
285
-
```bash
286
300
cat /etc/cloud/ds-identify.cfg
287
301
```
288
302
289
-
Expected output: `policy: enabled`
290
-
303
+
The final command should print `policy: enabled`.
291
304
292
-
#### Step 4: Confirm the datasource
305
+
**4. Confirm the datasource**
293
306
294
307
```bash
295
308
sudo cloud-init init
@@ -302,20 +315,22 @@ Look at the `detail` line in the output. It should read `DataSourceOpenStackLoca
302
315
detail: DataSourceOpenStackLocal [net,ver=2]
303
316
```
304
317
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>
306
321
307
322
### Pre-snapshot checklist {#checklist}
308
323
309
324
Run through this before taking any snapshot:
310
325
311
326
- [ ] 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
313
328
- [ ] All references point to CVMFS paths or symlinks where available
314
329
- [ ] Input data is as small as practical
315
330
- [ ] `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
0 commit comments