Skip to content

Commit ea995e0

Browse files
committed
doc: added developement guide
1 parent b7257f0 commit ea995e0

11 files changed

Lines changed: 1501 additions & 1 deletion

‎README.md‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,9 @@ CuOS is designed for **mass deployment**:
6767

6868
## 📦 Getting Started
6969

70-
Coming soon: Installation instructions, example Dockerfiles, and deployment guides.
70+
For system administrators looking to deploy services using CuOS, please visit [cuos-iac](https://github.com/cuos-dev/cuos-iac/), our Infrastructure as Code repository. It provides tools and templates for deploying and managing services on CuOS.
71+
72+
For developers looking to create custom CuOS-based systems, check out our [CuOS Development Guide](docs/development-guide.md).
7173

7274
---
7375

‎docs/common/btrfs-usage.md‎

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
# Advanced BTRFS Usage in CuOS
2+
3+
This document explains how CuOS uses BTRFS subvolumes for system management and updates.
4+
5+
## Overview
6+
7+
CuOS uses BTRFS subvolumes instead of traditional partitions for its A/B update system. This approach provides:
8+
- Efficient storage usage through copy-on-write (CoW)
9+
- Atomic system updates
10+
- Fast rollbacks
11+
- Data persistence across updates
12+
13+
## System Layout
14+
15+
### Disk Structure
16+
17+
```
18+
/dev/sdX # Physical disk
19+
├── partition1 # BIOS boot partition
20+
├── partition2: boot # EFI System Partition (ESP)
21+
└── partition3: system # BTRFS root partition
22+
├── @os # OS subvolume
23+
│ └── docker # Docker dir only used while updating
24+
│ ├── btrfs #
25+
│ │ ├── # image layers as btrfs subvolumes
26+
│ │ └── # use use for the OS.
27+
│ └── ...
28+
├── @data # Persistent data
29+
│ ├── docker # System docker dir
30+
│ ├── log # System logs: /var/log
31+
│ └── ...
32+
└── @swap # For the swap file
33+
```
34+
35+
GRUB is setup as boot loader for both UEFI and non-UEFI setups.
36+
37+
For partition switch we write two grub files and configure the default.
38+
39+
### Raspberry Pi
40+
41+
```
42+
/dev/sdX # Physical disk
43+
├── partition1: boot # /boot/firmware partition (vfat)
44+
└── partition2: system # BTRFS root partition (as above)
45+
```
46+
47+
Boot partition has the raspbian default structure. [RaspberryPi Documentation](https://www.raspberrypi.com/documentation/computers/config_txt.html#what-is-config-txt)
48+
49+
For partition switch we write the subvol in cmdline.txt.
50+
51+
### Mount Points
52+
```
53+
/ → /dev/sdX3/@os/docker/btrfs/... # Current system root
54+
/data → /dev/sdX3/@data # Persistent data
55+
/swap → /dev/sdX3/@swap # For the swap file
56+
```
57+
58+
## Update Process
59+
60+
1. **Preparation**
61+
```
62+
system_A (active)
63+
system_B (ready for update)
64+
```
65+
66+
2. **During Update**
67+
- Docker pulls new image
68+
- Creates new root filesystem in inactive subvolume
69+
- Updates boot configuration
70+
71+
3. **After Update**
72+
```
73+
system_A (old, fallback)
74+
system_B (new, active)
75+
```

‎docs/common/building-images.md‎

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
# Building CuOS Image Files
2+
3+
This guide explains how to build CuOS system images for different platforms (from Docker images).
4+
5+
"Image" means, that it copies the OS directly on the target. To install it using a secondary media (e.g., USB stich or virtual cdrom device) see [Installer](./installation.md).
6+
7+
## Prerequisites
8+
9+
* A `system.json` configuration file (see [under the variants](../development-guide.md))
10+
* A Docker environment to build the installation media ON the same machine architecture as the target system. Note: Building ARM64 images on x86_64 hosts (or vice versa) is not supported
11+
* Access to a container registry
12+
13+
## Image Factory
14+
15+
The image-factory creates bootable images with the CuOS partition scheme.
16+
17+
### Configuration
18+
19+
Create a `system.json` file with your image configuration:
20+
21+
```json
22+
{
23+
"os_image": "your-registry/your-os-image",
24+
"os_image_version": "1.0.0",
25+
"os_image_digest": "",
26+
"updater_image": "ghcr.io/cuos-dev/cuos-updater",
27+
"updater_image_version": "latest",
28+
"updater_image_digest": ""
29+
}
30+
```
31+
32+
### Creating Images
33+
34+
```bash
35+
./image-factory/start.sh path/to/system.json
36+
```
37+
38+
The created image will be available at `./output/image.img`.
39+
40+
### Image Structure
41+
42+
The created image includes:
43+
1. BIOS boot partition
44+
2. EFI System Partition (ESP)
45+
3. Root filesystem partition
46+
- BTRFS filesystem
47+
- Automatic snapshot management
48+
49+
For more details, see [BTRFS Usage Guide](./btrfs-usage.md).
50+
51+
52+
## Platform-Specific Images
53+
54+
### x86_64 Systems
55+
Standard image creation process as described above.
56+
57+
### Raspberry Pi (ARM64)
58+
Use the Raspberry Pi specific image configuration:
59+
```json
60+
{
61+
"rpi-arm64_image": "your-registry/your-rpi-image",
62+
"rpi-arm64_image_version": "1.0.0",
63+
"rpi-arm64_image_digest": ""
64+
}
65+
```
66+
67+
## Image Formats and Conversion
68+
69+
Convert between formats using qemu-img:
70+
```bash
71+
# Convert to QCOW2
72+
qemu-img convert -f raw -O qcow2 image.img image.qcow2
73+
74+
# Convert to VHD
75+
qemu-img convert -f raw -O vpc image.img image.vhd
76+
```
77+
78+
## Using the Image on Physical disks:
79+
80+
1. Write the image to a physical device (e.g., USB drive):
81+
```bash
82+
dd if=image.img of=/dev/sdX bs=1M status=progress
83+
```
84+
2. Boot from the device and follow on-screen instructions.
85+
86+
Note: The first boot may take longer as the system resizes partitions and sets up the filesystem.
87+
88+
## Using the image on Proxmox VE
89+
90+
1. Upload the `image.img` to your Proxmox server.
91+
2. Convert the raw image to a Proxmox-compatible format (e.g., QCOW2):
92+
```bash
93+
qemu-img convert -f raw -O qcow2 image.img image.qcow2
94+
```
95+
3. Create a new VM in Proxmox without a disk.
96+
4. Upload the converted image to the VM's disk storage:
97+
```bash
98+
qm importdisk <VMID> image.qcow2 <STORAGE>
99+
```
100+
5. Attach the disk to the VM and configure boot options.

0 commit comments

Comments
 (0)