-
Notifications
You must be signed in to change notification settings - Fork 5
CD-36 - Add cloud init docs #68
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,250 @@ | ||||||||||||
| --- | ||||||||||||
| id: cloud-init | ||||||||||||
| title: Cloud-Init | ||||||||||||
| sidebar_position: 5 | ||||||||||||
| --- | ||||||||||||
|
|
||||||||||||
| ## Cloud-Init | ||||||||||||
|
|
||||||||||||
| Cube AI can be deployed on standard Ubuntu cloud images using [cloud-init](https://cloud-init.io/) for automated provisioning. This approach uses a pre-built Ubuntu base image and configures the Cube AI stack (Cube Agent, Ollama, TLS certificates) at first boot via cloud-init user-data. | ||||||||||||
|
|
||||||||||||
| :::info | ||||||||||||
| This guide covers the cloud-init based deployment using Ubuntu. For building minimal custom images from source, see the [HAL](/developer-guide/hal) guide. | ||||||||||||
| ::: | ||||||||||||
|
|
||||||||||||
| ## Overview | ||||||||||||
|
|
||||||||||||
| The cloud-init approach provisions a standard Ubuntu Noble (24.04) cloud image with: | ||||||||||||
|
|
||||||||||||
| - Cube Agent built from source at first boot | ||||||||||||
| - Ollama LLM backend installed via official installer | ||||||||||||
| - Self-signed TLS certificates for mTLS | ||||||||||||
| - Systemd services for Cube Agent and Ollama | ||||||||||||
| - Default LLM models pulled in the background | ||||||||||||
| - Support for Intel TDX confidential VMs | ||||||||||||
|
|
||||||||||||
| ## Cloud-Init vs Buildroot | ||||||||||||
|
|
||||||||||||
| | Aspect | Cloud-Init (Ubuntu) | Buildroot (HAL) | | ||||||||||||
| | --- | --- | --- | | ||||||||||||
| | Base image | Ubuntu Noble cloud image | Custom minimal Linux | | ||||||||||||
| | Build time | Minutes (downloads pre-built image) | ~1 hour (compiles everything from source) | | ||||||||||||
| | Agent install | Built from source at first boot | Pre-compiled into the image | | ||||||||||||
| | Internet required | Yes, at first boot | No, fully self-contained | | ||||||||||||
| | Image size | Larger (full Ubuntu) | Minimal | | ||||||||||||
| | Best for | Development and cloud deployments | Production and embedded deployments | | ||||||||||||
|
|
||||||||||||
| ## Prerequisites | ||||||||||||
|
|
||||||||||||
| Before running the cloud-init deployment, ensure you have: | ||||||||||||
|
|
||||||||||||
| - A Linux host machine with KVM support | ||||||||||||
| - At least 35GB free disk space | ||||||||||||
| - QEMU installed (`qemu-system-x86_64`) | ||||||||||||
| - `cloud-image-utils` package (provides `cloud-localds`) | ||||||||||||
| - `wget` for downloading the base image | ||||||||||||
| - OVMF firmware (`/usr/share/OVMF/OVMF_CODE.fd` and `OVMF_VARS.fd`) | ||||||||||||
|
|
||||||||||||
| Install dependencies on Ubuntu/Debian: | ||||||||||||
|
|
||||||||||||
| ```bash | ||||||||||||
| sudo apt-get install qemu-system-x86 cloud-image-utils wget ovmf | ||||||||||||
| ``` | ||||||||||||
|
|
||||||||||||
| ## Steps | ||||||||||||
|
|
||||||||||||
| ### 1. Clone the Cube Repository | ||||||||||||
|
|
||||||||||||
| ```bash | ||||||||||||
| git clone https://github.com/ultravioletrs/cube.git | ||||||||||||
| cd cube/hal/ubuntu | ||||||||||||
| ``` | ||||||||||||
|
Comment on lines
+56
to
+61
|
||||||||||||
|
|
||||||||||||
| ### 2. Launch the VM | ||||||||||||
|
|
||||||||||||
| The `qemu.sh` script automates the entire process — downloading the Ubuntu base image, generating cloud-init configuration, creating the seed image, and launching QEMU: | ||||||||||||
|
|
||||||||||||
| ```bash | ||||||||||||
| sudo ./qemu.sh | ||||||||||||
| ``` | ||||||||||||
|
|
||||||||||||
| The script performs the following: | ||||||||||||
|
|
||||||||||||
| 1. Downloads the Ubuntu Noble server cloud image (if not already cached) | ||||||||||||
| 2. Creates a QCOW2 overlay image with 35GB disk | ||||||||||||
| 3. Generates cloud-init user-data and meta-data | ||||||||||||
| 4. Creates a seed ISO image with `cloud-localds` | ||||||||||||
| 5. Detects TDX support and configures QEMU accordingly | ||||||||||||
| 6. Launches the VM | ||||||||||||
|
|
||||||||||||
| ### 3. First Boot Provisioning | ||||||||||||
|
|
||||||||||||
| On first boot, cloud-init automatically: | ||||||||||||
|
|
||||||||||||
| 1. Creates the `ultraviolet` user with sudo access | ||||||||||||
| 2. Creates the `ollama` system user | ||||||||||||
| 3. Installs packages: `curl`, `git`, `golang-go`, `build-essential` | ||||||||||||
| 4. Generates TLS certificates (CA, server, and client certificates for mTLS) | ||||||||||||
| 5. Installs Ollama from the official installer | ||||||||||||
| 6. Clones the Cube repository and builds the agent from source | ||||||||||||
| 7. Starts Ollama and Cube Agent systemd services | ||||||||||||
| 8. Pulls default LLM models in the background (`llama3.2:3b`, `starcoder2:3b`, `nomic-embed-text:v1.5`) | ||||||||||||
|
|
||||||||||||
| :::note | ||||||||||||
| First boot provisioning takes several minutes as it installs packages, builds the Cube Agent, and pulls LLM models. You can monitor progress via the console output or check `/var/log/cloud-init-output.log` inside the VM. | ||||||||||||
| ::: | ||||||||||||
|
|
||||||||||||
| ### 4. Access the VM | ||||||||||||
|
|
||||||||||||
| Once the VM is running, connect via SSH: | ||||||||||||
|
|
||||||||||||
| ```bash | ||||||||||||
| ssh -p 6190 ultraviolet@localhost | ||||||||||||
| ``` | ||||||||||||
|
|
||||||||||||
| Default credentials: | ||||||||||||
|
|
||||||||||||
| - **Username:** `ultraviolet` | ||||||||||||
| - **Password:** `password` | ||||||||||||
|
|
||||||||||||
| ### 5. Verify Services | ||||||||||||
|
|
||||||||||||
| Check that both services are running: | ||||||||||||
|
|
||||||||||||
| ```bash | ||||||||||||
| systemctl status cube-agent.service | ||||||||||||
| systemctl status ollama.service | ||||||||||||
| ``` | ||||||||||||
|
|
||||||||||||
| Check model pull progress: | ||||||||||||
|
|
||||||||||||
| ```bash | ||||||||||||
| tail -f /var/log/ollama-pull.log | ||||||||||||
| ``` | ||||||||||||
|
|
||||||||||||
| ## Configuration | ||||||||||||
|
|
||||||||||||
| ### Cloud-Init User-Data | ||||||||||||
|
|
||||||||||||
| The cloud-init configuration is embedded in `qemu.sh` as a heredoc. It uses the standard `#cloud-config` format with the following sections: | ||||||||||||
|
|
||||||||||||
| **Users:** | ||||||||||||
|
|
||||||||||||
| ```yaml | ||||||||||||
| users: | ||||||||||||
| - name: ultraviolet | ||||||||||||
| plain_text_passwd: password | ||||||||||||
| lock_passwd: false | ||||||||||||
| sudo: ALL=(ALL) NOPASSWD:ALL | ||||||||||||
| shell: /bin/bash | ||||||||||||
| - name: ollama | ||||||||||||
| system: true | ||||||||||||
| home: /var/lib/ollama | ||||||||||||
| shell: /usr/sbin/nologin | ||||||||||||
| ``` | ||||||||||||
|
|
||||||||||||
|
||||||||||||
| :::warning Security | |
| The example above uses `plain_text_passwd: password` for local development and testing only. **Always override this value with a strong, unique password (or, preferably, SSH key–based access) before exposing an instance to any network or using it in staging or production.** | |
| ::: |
Copilot
AI
Feb 24, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The documentation references updating docker/.env with the VM's IP address, but this path may not exist in the context where users are following this cloud-init deployment guide. Since this documentation repository doesn't contain a docker/.env file, clarify where this file is located (likely in the main Cube repository) or provide more context about which repository/directory this refers to.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The sidebar_position value of 5 conflicts with multiple other files (cvm-management.md and fine-tuning.md also use sidebar_position: 5). This will cause unexpected ordering in the documentation sidebar. Consider using sidebar_position: 6 or adjusting the positions of other files to ensure each file has a unique position value.