From 80533c18c4ab63beefbd3ccc92b3fc4d9755ca90 Mon Sep 17 00:00:00 2001 From: Xavier Logerais Date: Sat, 21 Nov 2026 15:40:12 +0100 Subject: [PATCH] docs: French README, plain lxc usage and demo, colored status emoji MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - README in French (README.md) with an English version (README.en.md), linked from each other - Usage split between plain lxc (mise is optional) and mise, with the prerequisites of each case - New demo of plain lxc usage (demo/lxc.yaml), one subsection per demo - list: 📝 instead of ⚠️ for profiles that differ, rendered in color like the other status emojis Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_018inUJksoKAfKRWoSo1tvv6 --- .mise/tasks/list | 4 +- README.en.md | 102 +++++ README.md | 110 +++-- demo/README.md | 10 +- demo/install.cast | 1007 ++++++++++++++++++++++----------------------- demo/install.gif | Bin 369785 -> 372006 bytes demo/lxc.cast | 412 +++++++++++++++++++ demo/lxc.gif | Bin 0 -> 221649 bytes demo/lxc.yaml | 35 ++ demo/tour.cast | 582 +++++++++++++------------- demo/tour.gif | Bin 568869 -> 577536 bytes mise.demo.toml | 2 +- mise.toml | 2 +- 13 files changed, 1436 insertions(+), 830 deletions(-) create mode 100644 README.en.md create mode 100644 demo/lxc.cast create mode 100644 demo/lxc.gif create mode 100644 demo/lxc.yaml diff --git a/.mise/tasks/list b/.mise/tasks/list index 3b2dc6f..fea9f82 100755 --- a/.mise/tasks/list +++ b/.mise/tasks/list @@ -44,7 +44,7 @@ while IFS=$'\t' read -r name file; do row "✅" "$GREEN" "$name" "$desc" "${used[$name]}" "$file" "$extra" same=$((same + 1)) else - row "⚠️" "$YELLOW" "$name" "$desc" "${used[$name]}" "$file" "$extra" + row "📝" "$YELLOW" "$name" "$desc" "${used[$name]}" "$file" "$extra" changed=$((changed + 1)) fi done < <(repo_index) @@ -59,4 +59,4 @@ if [ "${usage_all:-false}" = "true" ] && [ "${#others[@]}" -gt 0 ]; then fi echo -echo " ✅ ${same} à jour ⚠️ ${changed} différent(s) ${D}(mise run diff)${R} ⬜ ${absent} non installé(s) 🔹 ${#others[@]} hors dépôt${D}$([ "${usage_all:-false}" = "true" ] || echo ' (--all)')${R}" +echo " ✅ ${same} à jour 📝 ${changed} différent(s) ${D}(mise run diff)${R} ⬜ ${absent} non installé(s) 🔹 ${#others[@]} hors dépôt${D}$([ "${usage_all:-false}" = "true" ] || echo ' (--all)')${R}" diff --git a/README.en.md b/README.en.md new file mode 100644 index 0000000..4e368b1 --- /dev/null +++ b/README.en.md @@ -0,0 +1,102 @@ +# LXD Profiles + +🇫🇷 [Lire en français](README.md) + +This repository contains a collection of LXD profiles and network configurations designed to streamline the deployment and management of LXD containers. + +## Directory Structure + +- `profiles/`: Contains various LXD profile definitions categorized by their purpose (e.g., applications, networking, storage). +- `network/`: Defines LXD network configurations. +- `docs/`: Additional documentation and helper scripts. +- `demo/`: Animated demos of the mise tasks ([how they are made](demo/README.md)). +- `mise.toml`, `.mise/`: optional [mise](https://mise.jdx.dev) tasks to manage LXD profiles (`mise.demo.toml`: demo recording tools). + +## Demo + +### Plain `lxc`, without mise + +![Create a profile from its YAML file with lxc](demo/lxc.gif) + +### Tour of the mise tasks + +Welcome message when entering the directory, profile list with their state in +LXD, profile content and diff between LXD and the repository. + +![Welcome message, profile list, profile content and diff](demo/tour.gif) + +### Install, update and import a profile + +A profile is installed, then changed directly in LXD: installing it again shows +the diff and asks for confirmation; `import` brings the change back into the +repository instead. + +![Install a profile, update it after a change in LXD, import it back](demo/install.gif) + +## Usage + +Profiles can be used with the `lxc` client alone; [mise](https://mise.jdx.dev) +is optional and only adds comfort on top of it. + +| Use case | Prerequisites | +|---|---| +| Plain `lxc` | LXD and the `lxc` client | +| With mise | LXD, the `lxc` client and [mise](https://mise.jdx.dev) (it installs `yq`, `gum`, `delta` and `bat` with `mise install`) | + +### Plain `lxc`, without mise + +Each `*.profile.yaml` file is a regular LXD profile, as printed by +`lxc profile show`: it can be applied as is. + +```bash +# Create (or update) a profile from its file +lxc profile create docker +lxc profile edit docker < profiles/containerization/docker.profile.yaml + +# Use it when launching an instance +lxc launch ubuntu:24.04 web -p default -p docker + +# Compare the installed profile with the repository +# (raw diff: field order, quoting and used_by also show up) +diff <(lxc profile show docker) profiles/containerization/docker.profile.yaml + +# Save a profile changed in LXD back into the repository +# (then remove the read-only used_by and project fields) +lxc profile show docker > profiles/containerization/docker.profile.yaml +``` + +### With mise + +The mise tasks wrap the same `lxc` commands and add: + +- a short help displayed when entering the directory (mise `enter` hook), and + `mise tasks` to list every task; +- a profile list showing each one's state in LXD (up to date, different, not + installed); +- colored diffs (`delta`) computed on a normalized form, so formatting or + quoting alone never shows up as a change; +- interactivity: profile selection and yes/no confirmation before overwriting + a profile that differs (`gum`), YAML highlighting (`bat`); +- a clean import of LXD profiles into the repository. + +A profile can be designated by its name (`docker`) or its file +(`profiles/containerization/docker.profile.yaml`). + +| Task | Description | +|---|---| +| `mise run list [--all]` | Repository profiles and their state in LXD: ✅ up to date, 📝 installed but different, ⬜ not installed. `--all` also shows 🔹 profiles installed in LXD but missing from the repository | +| `mise run show [profile] [--lxd]` | Displays a repository profile (YAML highlighted with `bat`), or with `--lxd` the version installed in LXD | +| `mise run diff [profile...]` | Diff between the installed profile (LXD) and the repository file. Without argument, every installed profile that differs. `--exit-code` returns 1 when there are differences | +| `mise run install [profile...]` | Creates or updates profiles. An existing profile that differs shows its diff and asks for confirmation (`--yes` to skip). Without argument, interactive selection; `--all` for every profile | +| `mise run import [profile] [file]` | Writes an installed LXD profile to the repository (without `used_by`, `project`, empty `config`/`devices`). Defaults to the repository file declaring that name, or `profiles/.profile.yaml`. Review with `git diff` before committing | + +Differences are computed on a normalized form (keys sorted, values as strings, +read-only fields dropped). Top-level keys unknown to LXD (silently ignored by `lxc profile edit`) +are reported, and `install` refuses such files. + +```bash +mise run list --all +mise run diff docker +mise run install docker profiles/applications/traefik.profile.yaml +mise run import s3 profiles/applications/s3.profile.yaml && git diff +``` diff --git a/README.md b/README.md index 4f3d388..2633ca1 100644 --- a/README.md +++ b/README.md @@ -1,44 +1,100 @@ -# LXD Profiles +# Profils LXD -This repository contains a collection of LXD profiles and network configurations designed to streamline the deployment and management of LXD containers. +🇬🇧 [Read in English](README.en.md) -## Directory Structure +Ce dépôt rassemble des profils et des configurations réseau LXD, pour simplifier +le déploiement et la gestion de conteneurs LXD. -- `profiles/`: Contains various LXD profile definitions categorized by their purpose (e.g., applications, networking, storage). -- `network/`: Defines LXD network configurations. -- `docs/`: Additional documentation and helper scripts. -- `demo/`: Animated demos of the mise tasks ([how they are made](demo/README.md)). -- `mise.toml`, `.mise/`: [mise](https://mise.jdx.dev) tasks to manage LXD profiles. +## Organisation du dépôt -## Demo +- `profiles/` : les profils LXD, classés par usage (applications, réseau, stockage…). +- `network/` : les configurations réseau LXD. +- `docs/` : documentation complémentaire et scripts d'aide. +- `demo/` : les démos animées ([comment elles sont produites](demo/README.md)). +- `mise.toml`, `.mise/` : tâches [mise](https://mise.jdx.dev), optionnelles, pour gérer les profils LXD (`mise.demo.toml` : outils d'enregistrement des démos). -![Welcome message, profile list, profile content and diff](demo/tour.gif) +## Démo -![Install a profile, update it after a change in LXD, import it back](demo/install.gif) +### Avec `lxc` seul, sans mise -## Usage +![Création d'un profil à partir de son fichier YAML avec lxc](demo/lxc.gif) -Prerequisites: [mise](https://mise.jdx.dev) and the `lxc` client. mise installs the -other tools declared in `mise.toml` (`yq`, `gum`, `delta`, `bat`) with `mise install`. +### Tour des tâches mise -A short help message is displayed when entering the directory (mise `enter` hook), -and `mise tasks` lists all available tasks. +Message d'accueil à l'entrée dans le dossier, liste des profils avec leur état +dans LXD, contenu d'un profil et différences entre LXD et le dépôt. -A profile can be designated by its name (`docker`) or its file +![Message d'accueil, liste des profils, contenu d'un profil et diff](demo/tour.gif) + +### Installer, mettre à jour et importer un profil + +Un profil est installé, puis modifié directement dans LXD : le réinstaller +affiche le diff et demande une confirmation ; `import` rapatrie au contraire +la modification dans le dépôt. + +![Installation d'un profil, mise à jour après une modification dans LXD, puis import](demo/install.gif) + +## Utilisation + +Les profils s'utilisent avec le seul client `lxc` ; [mise](https://mise.jdx.dev) +est optionnel et n'apporte que du confort en plus. + +| Cas d'usage | Prérequis | +|---|---| +| `lxc` seul | LXD et le client `lxc` | +| Avec mise | LXD, le client `lxc` et [mise](https://mise.jdx.dev) (qui installe `yq`, `gum`, `delta` et `bat` avec `mise install`) | + +### Avec `lxc` seul, sans mise + +Chaque fichier `*.profile.yaml` est un profil LXD ordinaire, au format de +`lxc profile show` : il s'applique tel quel. + +```bash +# Créer (ou mettre à jour) un profil à partir de son fichier +lxc profile create docker +lxc profile edit docker < profiles/containerization/docker.profile.yaml + +# L'utiliser au lancement d'une instance +lxc launch ubuntu:24.04 web -p default -p docker + +# Comparer le profil installé avec le dépôt +# (diff brut : l'ordre des champs, les guillemets et used_by apparaissent aussi) +diff <(lxc profile show docker) profiles/containerization/docker.profile.yaml + +# Enregistrer dans le dépôt un profil modifié dans LXD +# (puis retirer les champs en lecture seule used_by et project) +lxc profile show docker > profiles/containerization/docker.profile.yaml +``` + +### Avec mise + +Les tâches mise s'appuient sur les mêmes commandes `lxc` et ajoutent : + +- une aide courte affichée à l'entrée dans le dossier (hook `enter` de mise), + et `mise tasks` pour lister toutes les tâches ; +- une liste des profils avec l'état de chacun dans LXD (à jour, différent, + non installé) ; +- des diff colorés (`delta`), calculés sur une forme normalisée : une simple + différence de mise en forme ou de guillemets n'apparaît jamais ; +- de l'interactivité : sélection des profils et confirmation oui/non avant + d'écraser un profil qui diffère (`gum`), coloration du YAML (`bat`) ; +- un import propre des profils LXD dans le dépôt. + +Un profil se désigne par son nom (`docker`) ou par son fichier (`profiles/containerization/docker.profile.yaml`). -| Task | Description | +| Tâche | Description | |---|---| -| `mise run list [--all]` | Repository profiles and their state in LXD: ✅ up to date, ⚠️ installed but different, ⬜ not installed. `--all` also shows 🔹 profiles installed in LXD but missing from the repository | -| `mise run show [profile] [--lxd]` | Displays a repository profile (YAML highlighted with `bat`), or with `--lxd` the version installed in LXD | -| `mise run diff [profile...]` | Diff between the installed profile (LXD) and the repository file. Without argument, every installed profile that differs. `--exit-code` returns 1 when there are differences | -| `mise run install [profile...]` | Creates or updates profiles. An existing profile that differs shows its diff and asks for confirmation (`--yes` to skip). Without argument, interactive selection; `--all` for every profile | -| `mise run import [profile] [file]` | Writes an installed LXD profile to the repository (without `used_by`, `project`, empty `config`/`devices`). Defaults to the repository file declaring that name, or `profiles/.profile.yaml`. Review with `git diff` before committing | +| `mise run list [--all]` | Profils du dépôt et leur état dans LXD : ✅ à jour, 📝 installé mais différent, ⬜ non installé. `--all` affiche aussi 🔹 les profils installés dans LXD mais absents du dépôt | +| `mise run show [profil] [--lxd]` | Affiche un profil du dépôt (YAML coloré par `bat`), ou avec `--lxd` la version installée dans LXD | +| `mise run diff [profil...]` | Diff entre le profil installé (LXD) et le fichier du dépôt. Sans argument, tous les profils installés qui diffèrent. `--exit-code` renvoie 1 s'il y a des différences | +| `mise run install [profil...]` | Crée ou met à jour des profils. Un profil existant qui diffère affiche son diff et demande confirmation (`--yes` pour passer outre). Sans argument, sélection interactive ; `--all` pour tous les profils | +| `mise run import [profil] [fichier]` | Écrit un profil installé dans LXD vers le dépôt (sans `used_by`, `project`, ni `config`/`devices` vides). Par défaut, le fichier du dépôt qui déclare ce nom, sinon `profiles/.profile.yaml`. À relire avec `git diff` avant de commiter | -Differences are computed on a normalized form (keys sorted, values as strings, -read-only fields dropped), so formatting or quoting alone never shows up as a -change. Top-level keys unknown to LXD (silently ignored by `lxc profile edit`) -are reported, and `install` refuses such files. +Les différences sont calculées sur une forme normalisée (clés triées, valeurs +converties en chaînes, champs en lecture seule écartés). Les clés de premier +niveau inconnues de LXD (ignorées sans avertissement par `lxc profile edit`) +sont signalées, et `install` refuse ces fichiers. ```bash mise run list --all diff --git a/demo/README.md b/demo/README.md index b3cf247..bdb5cec 100644 --- a/demo/README.md +++ b/demo/README.md @@ -12,6 +12,7 @@ The `.cast` files can be played in Gitea's file view (asciinema player). | Scenario | Demo | Prerequisites | |---|---|---| | `tour.yaml` | welcome message, `list`, `show`, `diff` (read only) | LXD | +| `lxc.yaml` | plain `lxc`, without mise: create a profile from its YAML file | LXD, profile `unattended-upgrades` not installed | | `install.yaml` | `install`, diff and confirmation after a change in LXD, `import` | LXD, profile `unattended-upgrades` not installed | ## Recording a demo @@ -24,10 +25,11 @@ MISE_ENV=demo mise run demo # demo/.cast and demo/