chore: added tutorial section

This commit is contained in:
David Allen 2025-07-22 12:37:20 -06:00
parent b7614eeea9
commit 6908f9bdd1
Signed by: towk
GPG key ID: 793B2924A49B3A3F
6 changed files with 2094 additions and 8 deletions

View file

@ -0,0 +1,54 @@
For this tutorial, you will be provided with your own EC2 instance and ssh key for access to it. If you would like to replicate it outside the tutorial environment, here are the relevant details.
## Instance Information
In order to run multiple compute nodes as VMs inside your instance, you will need plenty of RAM. We've found that at least 4G per guest is necessary. It's possible to oversubscribe the instances, but performance suffers. We chose c5.metal instances to optimize for RAM and cost.
In addition, while the aarch (Graviton) instances are cheaper than the comparable x86 instances, not all of the software we rely on is confirmed to work on an ARM system. Future versions of this tutorial will likely switch to cheaper ARM instances.
### Operating System (Rocky 9)
The Operating System for the tutorial is expected to be Rocky Linux version 9. Official AMIs are available on the AWS Marketplace. See [Rocky Linux AMIs](https://aws.amazon.com/marketplace/seller-profile?id=01538adc-2664-49d5-b926-3381dffce12d) for the latest AMIs in your region and availability zone. The entitlement process is easy and doesn't add cost to the standard instance usage.
### Storage
Default root disks for instances are too small for storing the squashfs images needed. Our launch template expands `/dev/sda1` to 100G. This doesn't automatically extend the filesystem which must be done at boot time with cloud-init.
## Launch Template
AWS offers the ability to stand up multiple instances based on the same template. For tutorial development, we found the templates to be less error-prone than creating individual instances without template. We recommend creating the template and then starting instances from that template.
### Cloud-Init
Just like OpenCHAMI, AWS provides teh ability to inject cloud-config data at runtime. In the "Advanced details" section of the template or instance definition, you will find a text box for `User data`. This is what we're using for the tutorial:
**user-data:**
```
#cloud-config
packages:
- libvirt
- qemu-kvm
- virt-install
- virt-manager
- dnsmasq
- podman
- buildah
- git
- vim
- ansible-core
- openssl
- nfs-utils
# Post-package installation commands
runcmd:
- dnf install -y epel-release
- dnf install -y s3cmd
- systemctl enable --now libvirtd
- newgrp libvirt
- usermod -aG libvirt rocky
- sudo growpart /dev/xvda 4
- sudo pvresize /dev/xvda4
- sudo lvextend -l +100%FREE /dev/rocky/lvroot
- sudo xfs_growfs /
```

View file

@ -0,0 +1,88 @@
For this tutorial, you will be provided with your own compute instance and ssh key for access to it. If you would like to replicate it outside the tutorial environment, here are the relevant details.
## Instance Information
In order to run multiple compute nodes as VMs inside your instance, you will need plenty of RAM. We've found that at least 4G per guest is necessary. It's possible to oversubscribe the instances, but performance suffers. We chose m3.medium (8GB RAM) instances to optimize for RAM and cost.
In addition, we are using x86 instances since not all of the software we rely on is confirmed to work on an ARM system. Future versions of this tutorial will likely switch to cheaper ARM instances.
### Operating System (Rocky 9)
The Operating System for the tutorial is expected to be Rocky Linux version 9. Official images are available, for example **Featured-RockyLinux9**. However, see note about SELinux below.
### Storage
We use the default 60GB root disk size for the tutorial. In the launch template below, we extend the filesystem to use the full disk.
## Launch Template
Jetstream2 offers the ability to stand up multiple instances based on the same template. For tutorial development, we found the templates to be less error-prone than creating individual instances withour template. We recommend creating the template and then starting instances from that template.
### Cloud-Init
Just like OpenCHAMI, Jetstream2 provides the ability to inject cloud-config data at runtime. In the "Advanced Options`" section of the template or instance definition, you will find a text box marked **Boot Script**. Underneath the following header:
```
--=================exosphere-user-data====
Content-Transfer-Encoding: 7bit
Content-Type: text/cloud-config
Content-Disposition: attachment; filename="exosphere.yml"
```
This is what we're using for the tutorial:
> [!NOTE]
> The Rocky 9 Jetstream2 image does not allow containers to accept TCP connections, which prevents connections to Quadlet services. As a mitigation, the below cloud-config adds/enables/starts a Systemd service that marks the `container\_t` type as permissive.
```yaml
#cloud-config
packages:
- ansible-core
- buildah
- dnsmasq
- git
- libvirt
- nfs-utils
- openssl
- podman
- qemu-kvm
- vim
- virt-install
- virt-manager
write_files:
- path: /etc/systemd/system/selinux-container-permissive.service
owner: root:root
permissions: '0644'
content: |
[Unit]
Description=Make container_t domain permissive
After=network.target
[Service]
Type=oneshot
ExecStart=/usr/sbin/semanage permissive -a container_t
Restart=on-failure
RestartSec=5
StartLimitBurst=5
[Install]
WantedBy=multi-user.target
# Post-package installation commands
runcmd:
- dnf install -y epel-release
- dnf install -y s3cmd
- systemctl enable --now libvirtd
- newgrp libvirt
- usermod -aG libvirt rocky
- sudo growpart /dev/xvda 4
- sudo pvresize /dev/xvda4
- sudo lvextend -l +100%FREE /dev/rocky/lvroot
- sudo xfs_growfs /
- systemctl daemon-reload
- systemctl enable selinux-container-permissive
- systemctl start selinux-container-permissive
```