Add coreapp core and "What the Core offers" to the skill
coreapp core prints what the Core in the VM offers apps, live: PostgreSQL and which extensions an app can enable itself (the trusted ones; pgvector needs a superuser), MariaDB, Authelia, the mail server, Traefik, Docker and the machine. The skill has the same table with today's versions and says to check the app's requirements against it before choosing a need. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -446,6 +446,12 @@ Steps:
|
||||
- Decided 2026-12-03 (David): ordinary Core accounts sign in
|
||||
without an invitation and get the app's lowest role; admins
|
||||
raise them in the app. In the skill
|
||||
- Done 2026-12-03: "What the Core offers" in the skill (services,
|
||||
versions, which PostgreSQL extensions an app can enable: the
|
||||
trusted ones; pgvector needs a superuser), and `coreapp core`
|
||||
prints it live from the Core
|
||||
- [ ] `[postgres] extensions = ["vector"]`: the installer enables
|
||||
extensions an app can't (when an app needs one)
|
||||
- [ ] PostgreSQL 18 on the Core (Federated's), or a minimum version
|
||||
in coreapp.toml that the installer checks, so an app refuses to
|
||||
install on an older Core instead of failing later
|
||||
|
||||
@@ -88,6 +88,7 @@ each new app explains the files and the settings it gets.
|
||||
| `coreapp new --email <name>` | (With any of the above.) Sending mail through the Core's mail server, with the app's own account |
|
||||
| `coreapp deploy [--recreate]` | Build its image, copy it to the Core over SSH, install it, or update it keeping its settings and data; a failed update rolls back to the version before (`--recreate`: a fresh container even if nothing changed) |
|
||||
| `coreapp check` | It answers at `https://<name>.<domain><health>` with a valid certificate |
|
||||
| `coreapp core` | What the Core in the VM offers apps: PostgreSQL (and which extensions an app can enable), MariaDB, Authelia, the mail server and Traefik with their versions, Docker, and the machine |
|
||||
| `coreapp signin [path]` | Sign in to it as a browser would, with the Core's test account (`coreapp.test@<domain>`, made on the VM's Core when first needed), starting at `path` (default `/login`), and show each step; `--cookies <file>` keeps the app's cookies, `--code` gets a code for apps that start sign-in in the browser, `--remove-account` removes the account |
|
||||
| `coreapp status` / `logs [-f]` / `shell [command]` | Its container, its log, a shell in it (or one command, without a terminal) |
|
||||
| `coreapp list` | The apps on the Core installed this way |
|
||||
|
||||
@@ -211,6 +211,13 @@ The Core's own scripts trace secrets, so their output goes to
|
||||
5a. An app that answers 421 to an unknown `Host` (Supermarket): deploy's
|
||||
wait passes because it sends `Host: <name>.<domain>`; on the Core, curl
|
||||
of its health URL gives 421 bare, 200 with that `Host`.
|
||||
5b. `coreapp core` (anywhere, no app needed): the domain, PostgreSQL's
|
||||
version, its extensions in two lists (pg_trgm in "the app can enable",
|
||||
vector in "only the Core can enable"), MariaDB, Authelia, the mail
|
||||
server, Traefik, Docker and Compose versions, the machine, the apps'
|
||||
disk (btrfs) and what's not offered. As an app's database user,
|
||||
`CREATE EXTENSION pg_trgm` works and `CREATE EXTENSION vector` is
|
||||
refused ("Must be superuser").
|
||||
6. `coreapp status` (address and port), `coreapp logs`, `coreapp shell`
|
||||
(exit with `exit`), `coreapp shell 'id; echo $APP_URL'` (prints both,
|
||||
no terminal needed, also when piped), `coreapp list` (all apps installed
|
||||
|
||||
+10
@@ -13,6 +13,9 @@
|
||||
# coreapp status its container, address and URL
|
||||
# coreapp logs [-f] its log
|
||||
# coreapp shell [command] a shell in its container, or run one command there
|
||||
# coreapp core what the Core in the VM offers apps: its database,
|
||||
# sign-in and mail servers with their versions,
|
||||
# PostgreSQL extensions, and the machine
|
||||
# coreapp signin [path] sign in to it with the Core's test account, as a
|
||||
# browser would, starting at path (default /login;
|
||||
# a page whose button starts sign-in is pressed,
|
||||
@@ -400,6 +403,12 @@ cmd_signin() {
|
||||
fi
|
||||
}
|
||||
|
||||
cmd_core() {
|
||||
init_core
|
||||
sync_installer
|
||||
core "$REMOTE_INSTALLER/coreapps core"
|
||||
}
|
||||
|
||||
cmd_remove() {
|
||||
local answer
|
||||
load_app
|
||||
@@ -605,6 +614,7 @@ case "$cmd" in
|
||||
logs) cmd_logs "$@" ;;
|
||||
shell) cmd_shell "$@" ;;
|
||||
signin) cmd_signin "$@" ;;
|
||||
core) cmd_core ;;
|
||||
remove | rm) cmd_remove ;;
|
||||
list | ls) cmd_list ;;
|
||||
publish) cmd_publish "$@" ;;
|
||||
|
||||
@@ -23,6 +23,8 @@ coreapps login <host> <user> keep a token (read from stdin) for
|
||||
installing private apps from host
|
||||
coreapps logout <host> forget host's token
|
||||
coreapps logins the hosts this Core has tokens for
|
||||
coreapps core what this Core offers apps: its services
|
||||
and their versions, and the machine
|
||||
coreapps test-account [--remove] make (or refresh, with the password on
|
||||
stdin) the person coreapp signin signs
|
||||
in with, or remove it
|
||||
@@ -1174,6 +1176,7 @@ def wait_until_answering(m, p):
|
||||
"its log is above).")
|
||||
|
||||
|
||||
|
||||
def update(name, addon_ok):
|
||||
"""An app installed from a repository, to its newest release."""
|
||||
if not re.fullmatch(FIELDS["name"], name) or not is_ours(name):
|
||||
@@ -1244,6 +1247,60 @@ def list_apps():
|
||||
return 0
|
||||
|
||||
|
||||
# --- What this Core offers apps (coreapp core) ---------------------------------------
|
||||
|
||||
def image_tag(container):
|
||||
"""The version in a container's image tag (e.g. 4.39.22), or "?"."""
|
||||
image = run(["docker", "inspect", "-f", "{{.Config.Image}}", container]).stdout.strip()
|
||||
tag = image.rsplit(":", 1)[1] if ":" in image.rsplit("/", 1)[-1] else ""
|
||||
return tag.lstrip("v") or "?"
|
||||
|
||||
|
||||
def core_info():
|
||||
"""The Core's services, versions and machine, as apps see them."""
|
||||
domain, _ = federated_settings()
|
||||
rows = [("Domain", domain)]
|
||||
pg = run(["docker", "exec", "postgresql", "postgres", "--version"]).stdout
|
||||
found = re.search(r"\) ([0-9][0-9.]*)", pg)
|
||||
rows.append(("PostgreSQL", (found.group(1) if found else "?") + ' (needs = ["postgres"])'))
|
||||
ext = run(["docker", "exec", "postgresql", "psql", "-U", "postgres", "-Atc",
|
||||
"SELECT v.trusted, string_agg(e.name || ' ' || e.default_version, ', ' ORDER BY e.name) "
|
||||
"FROM pg_available_extensions e JOIN pg_available_extension_versions v "
|
||||
"ON v.name = e.name AND v.version = e.default_version "
|
||||
"WHERE e.name <> 'plpgsql' GROUP BY v.trusted ORDER BY v.trusted DESC"]).stdout
|
||||
for line in ext.splitlines():
|
||||
trusted, _, names = line.partition("|")
|
||||
rows.append((" extensions the app can enable" if trusted == "t" else
|
||||
" extensions only the Core can enable", names))
|
||||
maria = run(["docker", "exec", "pdnsmysql", "mariadb", "--version"]).stdout
|
||||
found = re.search(r"([0-9][0-9.]*)-MariaDB", maria)
|
||||
rows.append(("MariaDB", (found.group(1) if found else "?") + ' (needs = ["mysql"])'))
|
||||
rows.append(("Authelia", image_tag("authelia") + ' (needs = ["sso"], OpenID Connect)'))
|
||||
rows.append(("Mail server", "docker-mailserver " + image_tag("mail")
|
||||
+ ' (needs = ["email"], sending with SMTP and STARTTLS)'))
|
||||
rows.append(("Traefik", image_tag("traefik") + " (HTTPS and certificates in front of apps)"))
|
||||
docker = run(["docker", "version", "--format", "{{.Server.Version}}"]).stdout.strip()
|
||||
compose = run(["docker", "compose", "version", "--short"]).stdout.strip()
|
||||
rows.append(("Docker", f"{docker or '?'}, Compose {compose or '?'} (one container per app)"))
|
||||
arch = os.uname().machine
|
||||
mem = 0
|
||||
with open("/proc/meminfo") as f:
|
||||
for line in f:
|
||||
if line.startswith("MemTotal:"):
|
||||
mem = int(line.split()[1]) / 1024 / 1024
|
||||
disk = shutil.disk_usage(APPS)
|
||||
fstype = run(["findmnt", "-no", "FSTYPE", "--target", APPS]).stdout.strip()
|
||||
rows.append(("Machine", f"{arch} ({'amd64' if arch == 'x86_64' else arch} images), "
|
||||
f"{os.cpu_count()} CPUs, {mem:.1f} GB memory"))
|
||||
rows.append(("Apps' disk", f"{disk.free / 1e9:.0f} GB free of {disk.total / 1e9:.0f} GB, "
|
||||
f"{fstype or '?'} (/data)"))
|
||||
rows.append(("Not offered", "Redis or other services, a second container, extra host names, "
|
||||
"public ports other than HTTPS, the Core's AI model"))
|
||||
for label, value in rows:
|
||||
print(f"{label + ':':<38} {value}")
|
||||
return 0
|
||||
|
||||
|
||||
# --- The test account (coreapp signin) ---------------------------------------------
|
||||
|
||||
# A person in the Core's LDAP that coreapp signin signs in with, on a
|
||||
@@ -1372,6 +1429,8 @@ def main(args):
|
||||
return list_logins()
|
||||
if cmd == "list" and not rest:
|
||||
return list_apps()
|
||||
if cmd == "core" and not rest:
|
||||
return core_info()
|
||||
if cmd == "test-account" and rest in ([], ["--remove"]):
|
||||
return test_account(remove=bool(rest))
|
||||
sys.stderr.write(__doc__.split("\n\n", 2)[2].strip() + "\n")
|
||||
|
||||
@@ -104,6 +104,31 @@ that are read by shell and YAML:
|
||||
|
||||
`coreapp deploy` checks the file first and says exactly what's wrong.
|
||||
|
||||
## What the Core offers
|
||||
|
||||
The Core runs these for its apps. Versions are today's; `coreapp core`
|
||||
prints the ones the Core in the VM actually runs, and Federated updates
|
||||
them with the Core. Check the app's requirements against them before
|
||||
choosing a need (its docs, the images in its own compose file, its
|
||||
migrations): a feature the Core's version lacks fails only when the code
|
||||
using it runs, so deploy, `coreapp check` and a sign-in can all pass.
|
||||
|
||||
| What | Today | For the app |
|
||||
|---|---|---|
|
||||
| PostgreSQL | 17.6 | `needs = ["postgres"]` |
|
||||
| PostgreSQL extensions the app can enable (`CREATE EXTENSION` in its migrations) | btree_gin, btree_gist, citext, cube, fuzzystrmatch, hstore, intarray, isn, lo, ltree, pg_trgm, pgcrypto, seg, tablefunc, unaccent, uuid-ossp, ... | |
|
||||
| Extensions only the Core can enable | vector (pgvector 0.8.1), pg_stat_statements, dblink, postgres_fdw, ... | not available to apps yet: report it |
|
||||
| MariaDB | 12.1.2 | `needs = ["mysql"]` |
|
||||
| Authelia | 4.39 | `needs = ["sso"]`: OpenID Connect sign-in with Core accounts |
|
||||
| Mail server | docker-mailserver 16 | `needs = ["email"]`: sending, SMTP with STARTTLS |
|
||||
| Traefik | 3.7 | HTTPS and the certificate in front of every app |
|
||||
| Docker, Compose | 29, 5.1 | one container per app |
|
||||
| Machine | x86_64, 4 CPUs, 7.7 GB memory (the dev VM) | build images for `linux/amd64`; `/data` is on btrfs |
|
||||
|
||||
What's inside the image is the app's own: its language runtime, SQLite and
|
||||
other libraries are whatever the Dockerfile installs, not the Core's.
|
||||
SQLite in `/data` is a fine database for an app that supports it.
|
||||
|
||||
## Needs
|
||||
|
||||
### `postgres`: its own database
|
||||
@@ -279,6 +304,7 @@ app's container. If it's optional
|
||||
|
||||
```bash
|
||||
command -v coreapp && coreapp-vm list
|
||||
coreapp core # what this Core offers apps, with versions
|
||||
```
|
||||
|
||||
`coreapp-vm list` should show the VM `coreserver` running. If `coreapp` is
|
||||
|
||||
Reference in New Issue
Block a user