Update rehearsal: downgrade check for deploys, -N versions, failed logs
coreapp deploy refuses a lower version than the installed one without --downgrade, as coreapp install does. Versions with -N (the Coreapp's own fix on the same upstream version) order after the upstream one, for releases too. A failed start keeps the container's whole log, from its first start, in <name>-failed-start.log. coreapp status shows the installed version beside the folder's. Skill: references/updating.md (versions, what to check between versions, testing an update over real data and its rollback, no copy after a successful update); reading the installer's bash -x log. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
+16
-6
@@ -73,7 +73,7 @@ title = "My App" # shown in the Core's dashboard
|
||||
description = "What it does, in a sentence"
|
||||
docs = "https://example.com/docs" # optional; installed from a repository, defaults to it
|
||||
image = "localhost/coreapp/my-app" # image name; the Core runs image:version
|
||||
version = "0.1.0" # the image tag; raise it for each release
|
||||
version = "0.1.0" # the image tag; raise it for each release (6.2.0, then 6.2.0-1)
|
||||
port = 8080 # the port the app serves HTTP on (any; 8080 is usual)
|
||||
health = "/health" # a path that answers once it's up
|
||||
needs = ["postgres", "sso"] # what it needs from the Core, or [] ("mysql", "email" too)
|
||||
@@ -365,6 +365,13 @@ ends by running the upstream one (and written at every start, for settings
|
||||
the app keeps in its database); waiting for the database and Authelia at
|
||||
startup; a non-root user; its own `icon.png`; one container.
|
||||
|
||||
### 2c. Updating an app (a new upstream version or release)
|
||||
|
||||
Read [references/updating.md](references/updating.md) first: versions
|
||||
(`-N` for the Coreapp's own fixes), what to check between versions,
|
||||
testing an update over real data and its rollback, and what the Core's
|
||||
database copy covers.
|
||||
|
||||
### 3. Deploy and test
|
||||
|
||||
```bash
|
||||
@@ -407,7 +414,7 @@ parts were tested that way rather than through a real sign-in.
|
||||
|
||||
| Command | Shows |
|
||||
|---|---|
|
||||
| `coreapp status` | Its container, address, port, needs, URL, and the Core's PostgreSQL or MariaDB version if it needs one |
|
||||
| `coreapp status` | Its container, the version installed and the folder's, address, port, needs, URL, and the Core's PostgreSQL or MariaDB version if it needs one |
|
||||
| `coreapp mail` | What the Core's mail server did with the mail it sent (apps with `email`) |
|
||||
| `coreapp inbox [--clear]` | The mail the test account got: the newest 10, with their text (`--clear` empties it) |
|
||||
| `coreapp logs` / `coreapp logs -f` | The app's own log |
|
||||
@@ -425,9 +432,11 @@ Common causes:
|
||||
ran before, with its settings, its database and `/data` as they were
|
||||
before the update (`/data` only where the Core's filesystem can copy it
|
||||
instantly; the message says), and undid needs the update added. Whatever
|
||||
the failed version wrote is gone. Its log is printed above that line
|
||||
(`coreapp logs` now shows the old version's). When the version wasn't
|
||||
raised, the image that failed is the one running again.
|
||||
the failed version wrote is gone. The end of its log is printed above
|
||||
that line, and its whole log, from its first start, is kept on the Core
|
||||
(deploy says where; `coreapp logs` now shows the old version's). When
|
||||
the version wasn't raised, the image that failed is the one running
|
||||
again.
|
||||
- "keeps a copy of its database ... Nothing was changed. Free some space
|
||||
first.": before an update the Core copies the app's database, to roll
|
||||
back to, and the apps' disk hasn't room for it (it keeps 1 GB free for
|
||||
@@ -455,7 +464,8 @@ Common causes:
|
||||
The installer's own log (the Core's install scripts) is on the Core in
|
||||
`/federated/logs/coreapps/`. It contains secrets, so don't print it in full;
|
||||
look at the end of it with `coreapp-vm ssh tail -n 40 /federated/logs/coreapps/<name>-install.log`
|
||||
only when a deploy fails in the installer itself.
|
||||
only when a deploy fails in the installer itself. It's a shell trace
|
||||
(`bash -x`): look for the last command before the error, not for words.
|
||||
|
||||
### 5. Publishing (only when the user asks for a release)
|
||||
|
||||
|
||||
@@ -52,4 +52,4 @@ To check a release the way a Core's owner will get it:
|
||||
publish a new version.
|
||||
- Going back to an older release needs `coreapp install --downgrade
|
||||
<url>@v<old>`; the user decides that, since the older version may not
|
||||
understand the newer one's data.
|
||||
understand the newer one's data (see references/updating.md).
|
||||
|
||||
@@ -0,0 +1,69 @@
|
||||
# Updating an app: a new upstream version, or a new release of your own
|
||||
|
||||
Read this before moving an installed app to a new version (a newer
|
||||
upstream image, or your own app's next release). SKILL.md has the deploy
|
||||
and publish commands around it.
|
||||
|
||||
## Versions
|
||||
|
||||
`version` in `coreapp.toml` is the image's tag and the release's
|
||||
(`v<version>`). For a port, follow upstream's version (`6.2.0`); for a
|
||||
release that changes only the Coreapp on the same upstream version (the
|
||||
entrypoint, a setting), add `-N` (`6.2.0-1`, `6.2.0-2`): the Core orders
|
||||
`6.2.0` < `6.2.0-1` < `6.2.1`. Raise it for every release; while you're
|
||||
trying things on your own Core, you don't need to.
|
||||
|
||||
A Core refuses an older version than the one it has, unless asked:
|
||||
`coreapp deploy --downgrade` from a folder, `coreapp install --downgrade`
|
||||
from a repository. That's for the user to decide: an older version may not
|
||||
understand what the newer one left in its database and `/data`.
|
||||
|
||||
## Before: what changes
|
||||
|
||||
- Read upstream's release notes for every version in between (not only
|
||||
the newest), their upgrade steps and their migrations (in the source:
|
||||
`migrations/`). Note migrations that can't be undone (data rewritten,
|
||||
tokens hashed) and slow ones (rebuilt indexes or views on big tables).
|
||||
- Check what your Coreapp writes still fits: the settings your entrypoint
|
||||
maps or writes into the database (renamed or moved keys), the upstream
|
||||
entrypoint and `CMD` your entrypoint ends with, the image's user, ports,
|
||||
`VOLUME`s and `HEALTHCHECK` (`docker inspect` both images and compare),
|
||||
and a new minimum database version (`min_version`).
|
||||
- "Back up the database first", in upstream's steps, is done by the Core:
|
||||
before every update it copies the app's database (and `/data`, where
|
||||
its filesystem can do that instantly) and rolls back to that copy if the
|
||||
new version doesn't start. Upstream's own upgrade command (`--upgrade`,
|
||||
`migrate`) belongs in the entrypoint, so it runs at every start.
|
||||
|
||||
## Testing an update
|
||||
|
||||
Test it over an install that has real data, not a fresh one:
|
||||
|
||||
1. Deploy the version people run now (a copy under another `name` is
|
||||
fine), and use it the way people do: content, a changed setting, an
|
||||
upload, a `coreapp signin`. Commit that as the released version.
|
||||
2. Record what's there (through the app's API or SQL as its database
|
||||
user), so you can compare after.
|
||||
3. Deploy the new version over it and compare: the data, the settings
|
||||
the Core writes (sign-in and mail still work), sessions, uploads. Sign
|
||||
in again, and as a brand-new account (`coreapp signin --remove-account`
|
||||
first): new versions change first sign-in and roles.
|
||||
4. `coreapp deploy --recreate` once more on the new version.
|
||||
|
||||
To see a failed update roll back, deploy a throwaway version (say
|
||||
`6.2.0-failtest`, not committed) whose entrypoint runs the migrations and
|
||||
then exits: deploy says "Rolled back", and the old version runs with its
|
||||
database as before. A throwaway version is needed: when the version isn't
|
||||
raised, the image that failed is the one running again. The failed
|
||||
container's whole log, from its first start (where the migrations ran),
|
||||
is kept on the Core; deploy prints where.
|
||||
|
||||
## After: there's no copy to go back to
|
||||
|
||||
The Core's copy of the database is only for the update itself: once the
|
||||
new version answers, it's deleted. If a problem shows up later, the way
|
||||
forward is a fixed release (`-N`); going back to the older version means
|
||||
the older version on the newer data (refused without `--downgrade`, and
|
||||
often broken by migrations it doesn't know), or the Core's own backups,
|
||||
which are the user's. Say this in your report when an update has
|
||||
migrations that can't be undone.
|
||||
Reference in New Issue
Block a user