diff --git a/.dev-updater.ron b/.dev-updater.ron new file mode 100644 index 0000000..1c249c0 --- /dev/null +++ b/.dev-updater.ron @@ -0,0 +1,33 @@ +// Read by Dev Updater. Structured as the body of the config: no outer +// parentheses, so nothing here is indented for the sake of a wrapper. +// +// This file sits at the checkout root because the project Dev Updater +// serves is the whole repository -- one checkout producing two things. +// Each component says where it lives with `cwd`, relative to this +// directory, rather than one of them reaching out of the other with `../`. + +// What to call this project before there is a build to read a label from. +// A built APK wins: it is the authority on what will actually install. +label: "AI Sessions", + +// Walked in order, and the order is the point: the backend is built and +// delivered first, so a failing APK build leaves the phone the APK it +// already had rather than half of a matched pair. +components: [ + Server( + name: "backend", + build: "cargo build --release", + cwd: "server", + // Installs into whichever user-service manager is here, and is how + // ai-server is started, stopped and asked about. See the script. + service: "server/service", + ), + Apk( + name: "app", + // Resolved against this directory, and run in `app/` -- the script + // cds to its own directory anyway, so the cwd is here to say where + // the app is rather than because the build needs it. + build: "app/build-apk.sh", + cwd: "app", + ), +], diff --git a/app/.dev-updater.ron b/app/.dev-updater.ron deleted file mode 100644 index 9ef6078..0000000 --- a/app/.dev-updater.ron +++ /dev/null @@ -1,21 +0,0 @@ -// Read by Dev Updater. Structured as the body of the config: no outer -// parentheses, so nothing here is indented for the sake of a wrapper. - -label: "AI Sessions", - -// The server is built and delivered before the APK: if the APK build then -// fails, the phone keeps being offered the one it already had rather than -// half of a matched pair. -components: [ - Server( - name: "backend", - build: "cargo build --release --manifest-path ../server/Cargo.toml", - // Installs into whichever user-service manager is here, and is how - // this server is started, stopped and asked about. See the script. - service: "../server/service", - ), - Apk( - name: "app", - build: "./build-apk.sh", - ), -] diff --git a/server/service b/server/service index 6ff5831..da8911b 100755 --- a/server/service +++ b/server/service @@ -3,6 +3,12 @@ # drive from the phone -- and for you to drive by hand, which is the same # thing. # +# Declared as the Server component of this checkout in `.dev-updater.ron` +# at the repository root, so the card drives it like any other project's. +# One button is worth knowing about before pressing it: on a phone that +# reaches ai-server through the tunnel rather than through Dev Updater, +# Stop leaves this server down until someone starts it again here. +# # ./service install | uninstall | start | stop | restart | status # # `status` prints exactly one of `running`, `stopped` or `not-installed` @@ -16,7 +22,10 @@ # with a message telling you to run it yourself once instead. # # User services on purpose: a system unit needs root to install, and a -# build machine's own account is where a dev server belongs. +# build machine's own account is where a dev server belongs. Note that a +# user service stops at logout unless lingering is enabled +# (`loginctl enable-linger $USER`), which you want for this one: the phone +# reaches this server whether or not anyone is logged in at the desk. set -eu SCRIPT_DIR=$(cd "$(dirname "$0")" && pwd)