diff --git a/docs/demo.md b/docs/demo.md index 98cde2c..c75adc1 100644 --- a/docs/demo.md +++ b/docs/demo.md @@ -151,9 +151,15 @@ rage -d -i .devenv/state/slop-demo/dev-age.key <(git -C .devenv/state/slop-demo/ ### Deploys The repository's `flake.nix` has a deploy-rs node, `box`, with one profile, `demo`, deployed as -root: a small app whose activation writes its version to `/run/demo/version`. Its `nixpkgs` is -locked to this repository's, so the builder has it already, and it uses nixpkgs' build of -deploy-rs, so a build takes moments. In `~/repo` on the agents' VM: +root: an app whose activation writes its version to `/run/demo/version`. + +- **Its `nixpkgs`** is locked to this repository's, so the builder has it already, and it uses + nixpkgs' build of deploy-rs, so nothing big needs building. +- **Its parts** stand in for a bigger build, so the progress in `slop` and the web app has + something to show. Each takes 5 to 20 seconds to build and adds a few MiB to copy, and a new + version rebuilds them all; `partCount` sets how many. + +In `~/repo` on the agents' VM: ```sh sed -i 's/version = "1.0"/version = "1.1"/' flake.nix diff --git a/nix/demo/agent.nix b/nix/demo/agent.nix index 7247c64..21d3dd7 100644 --- a/nix/demo/agent.nix +++ b/nix/demo/agent.nix @@ -39,6 +39,7 @@ let sed -i 's/version = "1.0"/version = "1.1"/' flake.nix git switch -c bump && git commit -am "Bump the app" && git push origin bump slop deploy box ` on the host moves it, standing in for a person mergin - `secrets/app.env.age` holds `DB_USER` and `DB_PASSWORD`; `secrets/wg.key.age` is a WireGuard private key, as a whole file. -`flake.nix` has a deploy-rs node, `box`, with one profile, `demo`: a small app whose activation -writes its version to `/run/demo/version`. +`flake.nix` has a deploy-rs node, `box`, with one profile, `demo`: an app whose activation writes +its version to `/run/demo/version`. Its parts take a while to build and add a few MiB each, so +builds and copies show their progress. Change secrets with `slop secret` (`slop guide` explains it), commit, and push a branch. Deploy a pushed commit with `slop deploy box`. diff --git a/nix/demo/repo/flake.nix b/nix/demo/repo/flake.nix index df7f8cc..79f9e16 100644 --- a/nix/demo/repo/flake.nix +++ b/nix/demo/repo/flake.nix @@ -13,13 +13,27 @@ # Change this, push a branch and `slop deploy box`: the approval shows the version change version = "1.0"; + # Stand-ins for a bigger build, so its progress and the copy's have something to show: each + # part takes 5 to 20 seconds and adds a few MiB to copy. A new version rebuilds them all. + partCount = 8; + parts = builtins.genList + (i: pkgs.runCommand "demo-part-${toString i}-${version}" { } '' + for step in 1 2 3 4 5; do + echo "part ${toString i}: step $step" + sleep ${toString (1 + pkgs.lib.mod i 4)} + done + head -c ${toString (2 + i)}M /dev/urandom > $out + '') + partCount; + app = pkgs.writeTextFile { name = "demo-app-${version}"; destination = "/bin/demo-app"; executable = true; text = '' #!${pkgs.runtimeShell} - echo "demo app ${version}" + # Its parts: ${toString parts} + echo "demo app ${version}, in ${toString partCount} parts" ''; };