Files
lxd-profiles/demo/docker/setup.sh
T
xavierandClaude Opus 5.5 17c9b04780 docs: Backrest tutorial with recorded demos and UI screenshots (demo/backrest)
- demo/backrest/README.md (fr) and README.en.md: a backup instance reading
  the data volume of another instance read-only, restic repository on its own
  volume, Backrest configured from the web UI, then restic on the command
  line and restoring a lost file
- install and restore scenarios recorded with autocast; restore configures
  Backrest through its configuration file (autoInitialize)
- UI screenshots made by screenshots.sh: a Debian instance with Chromium
  driven by Playwright fills in the forms
- demo/lib.sh: helpers shared by the tutorial preambles
- Docker tutorial: a filesystem volume can be shared by several instances,
  two Docker daemons must not share /var/lib/docker

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018inUJkPw1qcoCubeKqfffm
2026-11-22 15:51:14 +01:00

45 lines
1.5 KiB
Bash

# shellcheck shell=bash
# Hidden preamble of the Docker demos (autocast), sourced from the repository root.
# source demo/docker/setup.sh install # nothing in LXD, fresh clone in a temporary directory
# source demo/docker/setup.sh usage # instance "docker" ready (created if missing)
# demo_cleanup (epilogue) removes what the demo created.
eval "$(mise activate bash)"
source demo/lib.sh
DEMO_INSTANCE=docker
DEMO_PROFILE=docker-unprivileged
DEMO_REPO=$PWD
DEMO_CREATED=
case "$1" in
install)
if lxc info "$DEMO_INSTANCE" >/dev/null 2>&1 || lxc profile show "$DEMO_PROFILE" >/dev/null 2>&1; then
echo "Instance $DEMO_INSTANCE or profile $DEMO_PROFILE already exists in LXD: the demo would remove them" >&2
exit 1
fi
DEMO_CREATED=yes
DEMO_TMP=$(mktemp -d)
cd "$DEMO_TMP" || exit 1
;;
usage)
if ! lxc info "$DEMO_INSTANCE" >/dev/null 2>&1; then
DEMO_CREATED=yes
mise run install --yes "$DEMO_PROFILE" >/dev/null
lxc launch ubuntu:lts "$DEMO_INSTANCE" --profile default --profile "$DEMO_PROFILE" >/dev/null
demo_wait_cloud_init "$DEMO_INSTANCE"
fi
demo_instance_shell "$DEMO_INSTANCE"
;;
esac
demo_cleanup() {
cd "$DEMO_REPO" || return
if [ -n "$DEMO_TMP" ]; then
mise trust --untrust "$DEMO_TMP/lxd-profiles" >/dev/null 2>&1
rm -rf "$DEMO_TMP"
fi
if [ -n "$DEMO_CREATED" ]; then
lxc delete --force "$DEMO_INSTANCE" >/dev/null 2>&1
lxc profile delete "$DEMO_PROFILE" >/dev/null 2>&1
fi
}