Upgrading
Upgrading a build of your own is building the newer release and installing it over the earlier one, keeping everything else: your configuration, the install root and what it holds, every instance's state. It happens in four moments — stop and copy, build, replace, start again.
1. Stop, and copy
A newer Core brings an instance's state to its own schema the first time it starts it, and the step does not run backwards: a store written by the newer Core is refused by the older one, naming both numbers. So stop what runs, so that nothing is executing the programs being replaced, and copy what you would want to go back to (copying an instance).
- For your account
- For the whole host
Note which instances run, stop each, and copy each — a copy is taken of a stopped instance, into a path that does not exist yet:
yoke instance list
bench-a com.example.station 2.1.0 observable
bench-b com.example.station 2.1.0 stopped
yoke instance stop bench-a
mkdir -p ~/yoke-backup
yoke instance copy bench-a ~/yoke-backup/bench-a
When the last instance stops, the account's guardian exits, so nothing of the old installation is left running.
Stop the service form, and copy what it keeps — the deployment's stores are at fixed paths:
sudo yoke service stop
mkdir -p ~/yoke-backup
sudo cp -a /var/lib/yoke/registry.db /var/lib/yoke/logs.db ~/yoke-backup/
Every account that runs instances does what For your account says, as itself: an account's
instances execute the host's /usr/bin/yoke-core too.
2. Build the newer release
Move the clone to the newer release's tag, and build it into ~/yoke-stage as
building says, locally or in a container, with the packaging inputs beside the programs:
version=0.15.1
cd yoke
git fetch --tags
git checkout v$version
Check the version the new programs state before installing them, as building says: it is the new
tag, without +dirty.
3. Replace
- For your account
- For the whole host
Replace the programs and the guardian's unit with the new ones, from ~/yoke-stage. Your
configuration and your install root stay as they are:
install -m 0755 ~/yoke-stage/yoke ~/yoke-stage/yoke-core ~/yoke-stage/yoke-guardian ~/yoke-stage/yoke-auth ~/.local/bin/
install -m 0755 ~/yoke-stage/yoke-compose ~/.local/bin/
sed "s|/usr/bin/yoke-guardian|$HOME/.local/bin/yoke-guardian|" ~/yoke-stage/packaging/yoke-guardian.service \
> ~/.config/systemd/user/yoke-guardian.service
systemctl --user daemon-reload
Replace the programs and the packaging inputs with the new ones, from ~/yoke-stage, and apply
them. /etc/yoke/core.yaml is the site's and stays as it is:
sudo install -m 0755 ~/yoke-stage/yoke ~/yoke-stage/yoke-core ~/yoke-stage/yoke-guardian ~/yoke-stage/yoke-auth /usr/bin/
sudo install -m 0644 ~/yoke-stage/packaging/yoke.sysusers /usr/lib/sysusers.d/yoke.conf
sudo install -m 0644 ~/yoke-stage/packaging/yoke.tmpfiles /usr/lib/tmpfiles.d/yoke.conf
sudo install -m 0644 ~/yoke-stage/packaging/yoke.service /usr/lib/systemd/system/yoke.service
sudo install -m 0644 ~/yoke-stage/packaging/yoke-guardian.service /usr/lib/systemd/user/yoke-guardian.service
sudo systemd-sysusers yoke.conf
sudo systemd-tmpfiles --create yoke.conf
sudo systemctl daemon-reload
A workstation replaces the composer too:
sudo install -m 0755 ~/yoke-stage/yoke-compose /usr/bin/
4. Start again
- For your account
- For the whole host
Start again each instance you stopped, and check that it comes up:
yoke instance start bench-a
yoke instance list
bench-a com.example.station 2.1.0 observable
bench-b com.example.station 2.1.0 stopped
Start the service form again, and check what the init system and the instance each say:
sudo yoke service start
yoke service status
init system: yoke.service is active
instance: answers, and is ready
Each account starts again the instances it stopped, as For your account says.
To go back, install the earlier release the same way, with its version, and restore the copy into
an instance before starting it: yoke instance restore ~/yoke-backup/bench-a bench-a. A store the newer
Core has written cannot be read by the older one; the copy is what makes going back possible.