The demo's app built and copied in moments, which left nothing for the progress in `slop` and the web app to show. It now has eight parts that each take 5 to 20 seconds to build and add a few MiB to copy, and the box VM has room for them. `demo-help` shows `--logs` too. Refs #21 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
3910f482c7
commit
ce6f8437eb
5 files changed
+29
-7
No files matched your search
+9
-3
@@ -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
|
||||
|
||||
@@ -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 </dev/null & asks to use the builder, builds, then asks again
|
||||
slop deploy box --logs </dev/null & the same, with the build's log as well as its progress
|
||||
|
||||
Builds into the binary cache, which is on the box VM (its GC roots, under
|
||||
/var/lib/slop-cache/nix/var/nix/gcroots/slop-broker, show what's been pushed):
|
||||
|
||||
+1
-1
@@ -25,7 +25,7 @@ in
|
||||
graphics = false;
|
||||
diskImage = null;
|
||||
# Copied closures live in memory, the cache's too
|
||||
memorySize = 1024;
|
||||
memorySize = 2048;
|
||||
restrictNetwork = true;
|
||||
forwardPorts = [{
|
||||
from = "host";
|
||||
|
||||
@@ -8,8 +8,9 @@ only `demo-merge <branch>` 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`.
|
||||
+15
-1
@@ -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"
|
||||
'';
|
||||
};
|
||||
|
||||
|
||||
Reference in new issue
Block a user