|
1 | | -# VM Images for OpenStack |
| 1 | +# VM Images |
2 | 2 |
|
3 | | -Creates Ubuntu VM Images with following things installed: |
| 3 | +Builds Ubuntu 24.04 images for OpenStack with Docker and NVIDIA drivers (GPU only). |
4 | 4 |
|
5 | | -- Nvidia drivers (GPU images only) |
6 | | -- Docker |
| 5 | +## Quick Start |
| 6 | + |
| 7 | +From the repo root, run: |
7 | 8 |
|
8 | | -The created image is uploaded to a GCS bucket, which is then retrieved by a self-hosted GHA runner running on our OpenStack instance. |
| 9 | +```bash |
| 10 | +# Build CPU image (can run anywhere) |
| 11 | +make build-cpu |
9 | 12 |
|
10 | | -## GHA workflows |
| 13 | +# Build GPU image (MUST run on GPU server) |
| 14 | +make build-gpu |
11 | 15 |
|
12 | | -These should automate the creation of the images: |
| 16 | +# Upload to OpenStack |
| 17 | +make upload-cpu |
| 18 | +make upload-gpu |
| 19 | +``` |
13 | 20 |
|
14 | | -- `.github/workflows/build-vm-images.yml` - Github Action to build the image |
15 | | -- `.github/workflows/openstack.yml` - Github Action to upload the VM image to OpenStack |
| 21 | +## Requirements |
16 | 22 |
|
17 | | -## Building manually on Linux |
| 23 | +- `uv` package manager ([install here](https://docs.astral.sh/uv/)) |
| 24 | +- Linux (builds won't work on Mac) |
| 25 | +- Root access (diskimage-builder needs it) |
| 26 | +- OpenStack credentials from `/etc/kolla/admin-openrc.sh` on GPU server (for uploads only) |
18 | 27 |
|
19 | | -1. Install `diskimage-builder` manually via `pip install -r requirements.txt`. A virtual environment is advised. Check if you have all the system dependencies in `ubuntu24-system-requirements.txt`) |
20 | | -2. Run `scripts/build-image.sh` to build the image. This will create a `.qcow2` file. |
21 | | - - Export `$IMAGE_YAML` to choose a different image to build (e.g. `cpu-image.yaml`, `gpu-image.yaml`). |
22 | | - - Export `$OUTPUT_IMAGE` to change the qcow2 output filename. |
| 28 | +## Build Directory |
23 | 29 |
|
24 | | -## Add Image to OpenStack |
| 30 | +By default images build to `/tmp/vm-images-build-{timestamp}`. Override with: |
25 | 31 |
|
26 | 32 | ```bash |
27 | | -openstack image create ubuntu-2404-nvidia-docker \ |
| 33 | +make build-cpu BUILD_DIR=/path/to/build |
| 34 | +``` |
| 35 | + |
| 36 | +## Custom UV Path |
| 37 | + |
| 38 | +If uv isn't in your PATH: |
| 39 | + |
| 40 | +```bash |
| 41 | +make build-cpu UV=/path/to/uv |
| 42 | +``` |
| 43 | + |
| 44 | +## Automated Builds |
| 45 | + |
| 46 | +GitHub Actions automatically builds and uploads images on push to `main` or `aktech/*` branches. Check `.github/workflows/build-images-ssh.yml`. |
| 47 | + |
| 48 | +The workflow SSHs into the GPU server to run both CPU and GPU builds. GPU images require actual GPU hardware - they'll fail without it. |
| 49 | + |
| 50 | +## Image Contents |
| 51 | + |
| 52 | +**Both images:** |
| 53 | +- Ubuntu 24.04 (Noble) |
| 54 | +- Docker |
| 55 | +- Node.js |
| 56 | +- cloud-init |
| 57 | + |
| 58 | +**GPU images only:** |
| 59 | +- NVIDIA drivers |
| 60 | +- CUDA |
| 61 | + |
| 62 | +## Manual Upload |
| 63 | + |
| 64 | +If you need to upload manually: |
| 65 | + |
| 66 | +```bash |
| 67 | +source /etc/kolla/admin-openrc.sh |
| 68 | +openstack image create my-image-name \ |
28 | 69 | --public --disk-format qcow2 \ |
29 | 70 | --container-format bare \ |
30 | | - --file <created-image>.qcow2 |
| 71 | + --file path/to/image.qcow2 |
| 72 | +``` |
| 73 | + |
| 74 | +## Cleanup |
| 75 | + |
| 76 | +```bash |
| 77 | +make clean BUILD_DIR=/path/to/build |
31 | 78 | ``` |
0 commit comments