coreapp: make, deploy and test apps on the Core in the VM
Apps are folders in Federated Core's generic services format (service, docker-compose.yml.in, env.in, install, uninstall, icon.png) plus their own Dockerfile. coreapp new scaffolds one from templates/app with an address in 192.168.200.x; deploy builds the image, copies it to the Core over SSH, installs it with installapp (and starts it, since the Core's start only knows its own apps) or updates it keeping .env; check, status, logs, shell and remove work on the Core. Apps in development aren't registered with Federated's monitoring: deploy drops MONITOR from the Core's copy of service. installapp/uninstallapp traces go to private logs, not the terminal. update.sh installs docker and docker-buildx and links coreapp into ~/.local/bin. PLAN.md: how the Core runs apps, and corrected evidence for the Core's timers running their jobs at every boot. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -8,8 +8,8 @@ a temporary folder. Run these on a machine or VM you don't mind changing.
|
||||
|
||||
```bash
|
||||
cd ~/Projects/coreapp-dev
|
||||
for f in install.sh update.sh uninstall.sh bin/coreapp-vm libvirt/network-hook.sh; do bash -n "$f"; done
|
||||
shellcheck -x install.sh update.sh uninstall.sh bin/coreapp-vm libvirt/network-hook.sh
|
||||
for f in install.sh update.sh uninstall.sh bin/coreapp-vm bin/coreapp libvirt/network-hook.sh; do bash -n "$f"; done
|
||||
shellcheck -x install.sh update.sh uninstall.sh bin/coreapp-vm bin/coreapp libvirt/network-hook.sh
|
||||
```
|
||||
|
||||
## install.sh
|
||||
@@ -139,3 +139,33 @@ On a machine you can rebuild (it removes the network every VM uses):
|
||||
3. Answering no to the data questions keeps `~/.local/share/coreapp-dev` and
|
||||
`~/.config/coreapp-dev`.
|
||||
4. `bash install.sh` puts everything back.
|
||||
|
||||
## Apps (coreapp)
|
||||
|
||||
Against a Core in the VM (`coreapp-vm list` shows it running). These install
|
||||
a test app on that Core. It must not be registered with Federated's
|
||||
monitoring: `/federated/services/hello/service` on the Core has no
|
||||
`MONITOR` line, and `~/.local/share/coreapp-dev/logs/hello-install.log` has
|
||||
no `blackboxregistrar` request.
|
||||
|
||||
1. `cd $(mktemp -d) && coreapp new hello`: `./hello` has `service`,
|
||||
`docker-compose.yml.in`, `env.in`, `install`, `uninstall`, `icon.png`,
|
||||
`Dockerfile`, `www/`, `README.md`, with no `{{...}}` left
|
||||
(`grep -r '{{' hello` prints nothing). `coreapp new hello` again refuses.
|
||||
`~/.local/share/coreapp-dev/app-addresses` has `hello 192.168.200.x`.
|
||||
2. `cd hello && coreapp deploy`: builds, copies the image, installs,
|
||||
prints `Deployed: https://hello.<domain>/`. On the Core,
|
||||
`/federated/apps/hello/.env` is root's, mode 600, with `IMAGE_VERSION`
|
||||
equal to `VERSION` and a random `APP_SECRET`.
|
||||
3. `coreapp check`: `OK: HTTP 200, valid certificate.` (the first
|
||||
certificate can take a minute).
|
||||
4. Change `www/index.html`, `coreapp deploy`: says "Updating it...", the
|
||||
container is recreated, the page shows the change, `APP_SECRET` is
|
||||
unchanged. `coreapp deploy` again: "The Core already has this image."
|
||||
5. `coreapp status`, `coreapp logs`, `coreapp shell` (exit with `exit`).
|
||||
6. `coreapp remove`, answering y: on the Core, `/federated/apps/hello`,
|
||||
`/federated/services/hello`, the container and the `coreapp/hello`
|
||||
image are gone. Nothing from `uninstallapp`'s trace is printed; it's in
|
||||
`~/.local/share/coreapp-dev/logs/hello-remove.log` (mode 600).
|
||||
7. Collisions: an app named like one of Federated's (`coreapp new nextcloud`,
|
||||
deploy) is refused; so is an `INTERNAL_IP` another container uses.
|
||||
|
||||
Reference in New Issue
Block a user