|
1 | | -# HOW TO Creates a Compute Environment Using Templates |
| 1 | +# HOW TO Create a new Lab Compute Environment |
2 | 2 |
|
| 3 | +This guide explains how to create a new compute environment using our automated GitHub workflow. |
3 | 4 |
|
4 | | -# Prerequisites |
5 | | - |
6 | | -!!!tip "You'll need access before begining" |
7 | | - For access refer to [request-access-to-systems.md](request-access-to-systems.md) |
| 5 | +## Prerequisites |
8 | 6 |
|
9 | 7 | Before you begin, ensure you: |
10 | 8 |
|
11 | | - - Have access to lftraining GitHub Organization. |
12 | | - - Have access to the following repos in the LF-Certification GitHub Organization. |
13 | | - - [LF-Certification/copier-compute-environment](https://github.com/LF-Certification/copier-compute-environment) |
14 | | - - LF-Certification/copier-multi-vm-shim |
15 | | - - LF-Certification/copier-product |
16 | | - - You have [setup your environment](setup-and-configure-your-environment.md) and with required tools. |
| 9 | +- Have access to the `lftraining` GitHub Organization |
| 10 | +- You are a member of the `lab-authors` team |
| 11 | + |
| 12 | +## Creating a New Compute Environment |
| 13 | +1. Open the lab repository in your browser |
| 14 | +2. Navigate to the Actions tab in the repository |
| 15 | +3. Locate and select the `New Compute Environment` workflow |
| 16 | +4. Click `Run workflow` and fill in the following parameters: |
| 17 | + |
| 18 | +  |
| 19 | + |
| 20 | + |
| 21 | +### Workflow Parameters |
| 22 | + |
| 23 | +- **Environment Template** (required) |
| 24 | + Choose one of the following templates: |
| 25 | + |
| 26 | + - `k8s-single-node`: Single node Kubernetes environment |
| 27 | + - `k8s-multi-node`: Multi-node Kubernetes environment |
| 28 | + - `linux-single`: Single Linux host environment |
| 29 | + - `linux-dual`: Dual Linux host environment |
| 30 | + |
| 31 | +- **Compute Environment** (required) |
| 32 | + - Enter the prefix for your compute environment (e.g., "LFS25800") |
| 33 | + |
| 34 | +- **Use Workstation** (required) |
| 35 | + - Choose whether to include a workstation VM for the student |
| 36 | + - Defaults to `true` |
| 37 | + |
| 38 | +### Template Configurations |
| 39 | + |
| 40 | +Each template creates different VM configurations: |
| 41 | + |
| 42 | +#### k8s-single-node |
| 43 | +- 1 control plane node |
| 44 | +- Optional workstation |
| 45 | + |
| 46 | +#### k8s-multi-node |
| 47 | +- 1 control plane node |
| 48 | +- 1 worker node |
| 49 | +- Optional workstation |
| 50 | + |
| 51 | +#### linux-single |
| 52 | +- 1 Linux host |
| 53 | +- Optional workstation |
| 54 | + |
| 55 | +#### linux-dual |
| 56 | +- 2 Linux hosts |
| 57 | +- Optional workstation |
| 58 | + |
| 59 | +## What Happens Next |
| 60 | + |
| 61 | +After triggering the workflow: |
17 | 62 |
|
18 | | -## Create a feature branch from main |
19 | | -open your devcontainer |
| 63 | +1. A new feature branch is created (`feature/implement-<compute-environment>`) |
| 64 | +2. The necessary template files are generated based on your selection |
| 65 | +3. A draft pull request is automatically created |
| 66 | +4. You can then customize the environment further by working on the created branch |
20 | 67 |
|
21 | | -Create a feature branch from main to work on the compute environment. |
| 68 | +!!!note "Next Steps" |
| 69 | + After the workflow completes, review the generated pull request and make any necessary customizations to the environment configuration. |
22 | 70 |
|
23 | | -!!!warning |
24 | | - must be named `feature/implement-<compute-environment>` |
| 71 | +### Finding Your Pull Request |
25 | 72 |
|
| 73 | +1. Navigate to the Pull Requests tab in the repository |
| 74 | +2. Look for a PR titled `Implement <your-compute-environment>` |
| 75 | +3. Open the PR to review the generated files |
26 | 76 |
|
27 | | -```bash |
28 | | -git branch feature/implement-LFS2580004 |
29 | | -``` |
| 77 | +  |
30 | 78 |
|
31 | | -switch to your branch |
| 79 | +### Working on the Environment Locally |
32 | 80 |
|
33 | | -```bash |
34 | | -git checkout feature/implement-LFS2580004 |
35 | | -``` |
| 81 | +1. Navigate to your local repository |
| 82 | +2. In the PR, click the `Code` dropdown button |
| 83 | +3. Copy the command under "Checkout with GitHub CLI" |
| 84 | +4. Paste and run the command in your terminal: |
| 85 | + ```bash |
| 86 | + gh pr checkout <PR-NUMBER> |
| 87 | + ``` |
36 | 88 |
|
37 | | - |
38 | | -cd to `compute-environments/available` |
39 | | - |
40 | | - |
41 | | -### Render the copier-multi-vm-shim template |
42 | | - |
43 | | -!!!warning |
44 | | - Before rendering copier templates, ensure your git repository is clean. |
45 | | - |
46 | | -The `copier-multi-vm-shim` creates the base compute environment directory for the lab. it allows building, packing and publishing to be executed simultaneously on all virtual machine hosts needed in the lab |
47 | | - |
48 | | -!!!note |
49 | | - TODO explain the front end service |
50 | | - explain that the lf-training one has ssh keys |
51 | | - explain the default port |
52 | | - |
53 | | - |
54 | | -```bash |
55 | | -copier copy --trust "gh:LF-Certification/copier-multi-vm-shim" ./LFS2580004 |
56 | | -🎤 What is the prefix for the compute environments? |
57 | | - LFS2580004 |
58 | | -🎤 What is the image for the front end service? |
59 | | - ghcr.io/lftraining/ttyd:1.7.7 |
60 | | -🎤 What is the port for the front end service? |
61 | | - 7681 |
62 | | - |
63 | | -Copying from template version 1.4.0 |
64 | | - create .make |
65 | | - create .make/lab |
66 | | - create .make/lab/build |
67 | | - create .make/lab/clean |
68 | | - create .make/lab/package |
69 | | - create .make/lab/publish |
70 | | - create .make/lib.sh |
71 | | - create Makefile |
72 | | - create .copier-answers.yml |
73 | | - |
74 | | -``` |
75 | | - |
76 | | -Commit the changes to the repository |
77 | | - |
78 | | -```bash |
79 | | -git add ./LFS2580004/ && git commit -sm"feat(LFS2580004): Initalize copier-multi-vm-shim" |
80 | | -``` |
81 | | - |
82 | | - |
83 | | -### Render the virtual machine directories required for hosts within the lab compute-environment |
84 | | - |
85 | | -LFS2580004 Will require 2 VMs in the lab compute environment. |
86 | | - |
87 | | -cd into the newly created directory: |
88 | | - |
89 | | -```bash |
90 | | -cd ./LFS2580004 |
91 | | -``` |
92 | | - |
93 | | -Apply the copier-compute-environment template for each host in the lab compute environment. We will start with `host1` |
94 | | - |
95 | | -!!!note |
96 | | - only `host<N>` are allowed as host names |
97 | | - |
98 | | - |
99 | | -```bash |
100 | | -copier copy --trust "gh:LF-Certification/copier-compute-environment" LFS2580004-host1 |
101 | | -🎤 What is the name of the compute environment? |
102 | | - LFS2580004-host1 |
103 | | -🎤 Which base image does the compute environment use? |
104 | | - ubuntu/kubernetes |
105 | | -🎤 How many CPU cores does the item require? |
106 | | - 2 |
107 | | -🎤 How much memory does the compute environment require? |
108 | | - 4096M |
109 | | -🎤 How much storage (MiB) does the compute environment require for the user layer? |
110 | | - 300 |
111 | | -🎤 How much storage (GiB) does the compute environment require for the build layer? |
112 | | - 5 |
113 | | -🎤 Does the compute environment require swap? |
114 | | - No |
115 | | -🎤 List of ports to expose? |
116 | | - (Finish with 'Alt+Enter' or 'Esc then Enter') |
117 | | -> [22] |
118 | | -🎤 How are the scripts implemented? |
119 | | - bashp |
120 | | - |
121 | | -Copying from template version 1.2.2 |
122 | | - create .hooks |
123 | | - create .hooks/lab |
124 | | - create .hooks/lab/post-build.sh |
125 | | - create .hooks/lab/pre-image.sh |
126 | | - create .hooks/p3 |
127 | | - create .hooks/p3/post-build.sh |
128 | | - create .hooks/p3/pre-image.sh |
129 | | - create .hooks/temu |
130 | | - create .hooks/temu/pre-image.sh |
131 | | - create .hooks/post-clean.sh |
132 | | - create .make |
133 | | - create .make/jslinux |
134 | | - create .make/jslinux/build |
135 | | - create .make/jslinux/image |
136 | | - create .make/jslinux/package |
137 | | - create .make/jslinux/publish |
138 | | - create .make/jslinux/run |
139 | | - create .make/jslinux/test |
140 | | - create .make/lab |
141 | | - create .make/lab/build |
142 | | - create .make/lab/image |
143 | | - create .make/lab/package |
144 | | - create .make/lab/publish |
145 | | - create .make/lab/run |
146 | | - create .make/lab/test |
147 | | - create .make/lib.sh |
148 | | - create .make/p3 |
149 | | - create .make/p3/Dockerfile |
150 | | - create .make/p3/build |
151 | | - create .make/p3/image |
152 | | - create .make/p3/k8s |
153 | | - create .make/p3/k8s/ssh |
154 | | - create .make/p3/k8s/ssh/id_rsa |
155 | | - create .make/p3/k8s/ssh/id_rsa.pub |
156 | | - create .make/p3/package |
157 | | - create .make/p3/publish |
158 | | - create .make/p3/run |
159 | | - create .make/p3/test |
160 | | - create .make/qemu |
161 | | - create .make/qemu/build |
162 | | - create .make/qemu/cloud-init |
163 | | - create .make/qemu/cloud-init/meta-data |
164 | | - create .make/qemu/cloud-init/user-data |
165 | | - create .make/qemu/image |
166 | | - create .make/qemu/package |
167 | | - create .make/qemu/publish |
168 | | - create .make/qemu/run |
169 | | - create .make/qemu/test |
170 | | - create .make/qemu/lib.sh |
171 | | - create .make/qti |
172 | | - create .make/qti/build |
173 | | - create .make/qti/image |
174 | | - create .make/qti/lib.sh |
175 | | - create .make/qti/package |
176 | | - create .make/qti/publish |
177 | | - create .make/temu |
178 | | - create .make/temu/build |
179 | | - create .make/temu/image |
180 | | - create .make/temu/lib.sh |
181 | | - create .make/temu/package |
182 | | - create .make/temu/publish |
183 | | - create .make/temu/run |
184 | | - create .make/temu/test |
185 | | - create Dockerfile |
186 | | - create Makefile |
187 | | - create assets |
188 | | - create assets/format-candidate-layer.sh |
189 | | - create assets/mkfs-hook.sh |
190 | | - create cli.sh |
191 | | - create k8s |
192 | | - create k8s/base |
193 | | - create k8s/base/kustomization.yaml |
194 | | - create k8s/base/virtualized-env.yaml |
195 | | - create k8s/base/manifest.yaml |
196 | | - create scripts |
197 | | - create scripts/answer.sh |
198 | | - create scripts/build.sh |
199 | | - create scripts/score.sh |
200 | | - create scripts/setup.sh |
201 | | - create temu |
202 | | - create temu/.gitattributes |
203 | | - create temu/.gitignore |
204 | | - create temu/temu.cfg |
205 | | - create temu/bbl64.bin |
206 | | - create temu/kernel-riscv64-4.19.249-minimal.bin |
207 | | - create temu/initrd |
208 | | - create .envrc |
209 | | - create .copier-answers.yml |
210 | | -``` |
211 | | - |
212 | | - |
213 | | -Now that you have created the first virtual machine directory, commit your changes before rendering the second virtual machine directory. |
214 | | - |
215 | | -```bash |
216 | | -git add ./LFS2580004-host1/ && git commit -sm"feat(host1): Initalize copier-compute-environment" |
217 | | -``` |
| 89 | +  |
0 commit comments